🐛 Fixed missing errors and confusing button text in theme upload modal

no issue
- fixed "Active with errors" button successful theme upload with no warnings/errors
- fixed fatal errors not showing due to change in API error response
- fixed "Retry" button not showing when there were fatal errors
- fixed "Upload successful!" message after clicking "Retry" on a failed upload
This commit is contained in:
Kevin Ansfield 2019-04-15 22:39:05 +01:00
parent fc5cf57961
commit 151b7a2844
3 changed files with 14 additions and 14 deletions

View File

@ -129,7 +129,7 @@ export default ModalComponent.extend({
uploadFailed(error) {
if (isThemeValidationError(error)) {
let errors = error.payload.errors[0].details;
let errors = error.payload.errors[0].details.errors;
let fatalErrors = [];
let normalErrors = [];
@ -166,6 +166,7 @@ export default ModalComponent.extend({
},
reset() {
this.set('theme', null);
this.set('validationWarnings', []);
this.set('validationErrors', []);
this.set('fatalValidationErrors', []);

View File

@ -65,7 +65,7 @@
The theme folder <strong>"{{fileThemeName}}"</strong> already exists. Do you want to overwrite it?
</p>
{{else if (or validationErrors fatalValidationErrors)}}
<p>
This theme is invalid and cannot be activated. Fix the following errors and re-upload the theme.
</p>
@ -75,7 +75,7 @@
<h2 class="mb0 mt4 f5 fw6">Fatal Errors</h2>
<p class="mb2">Must-fix to activate theme</p>
</div>
<ul class="pa0">
{{#each fatalValidationErrors as |error|}}
<li class="theme-validation-item theme-fatal-error">
@ -115,7 +115,7 @@
</div>
<div class="modal-footer">
<div class="flex items-center justify-between {{if (or displayOverwriteWarning canActivateTheme validationErrors) "flex-auto"}}">
<div class="flex items-center justify-between {{if (or displayOverwriteWarning canActivateTheme validationErrors fatalValidationErrors) "flex-auto"}}">
<button {{action "closeModal"}} disabled={{closeDisabled}} class="gh-btn" data-test-close-button>
<span>{{#if theme}}Close{{else}}Cancel{{/if}}</span>
</button>
@ -126,11 +126,11 @@
</button>
{{/if}}
{{#if canActivateTheme}}
<button {{action "activate"}} class="gh-btn" data-test-activate-now-button>
<span>Activate with errors</span>
</button>
<button {{action "activate"}} class="gh-btn" data-test-activate-now-button>
<span>Activate{{#if validationErrors}} with errors{{/if}}</span>
</button>
{{/if}}
{{#if validationErrors}}
{{#if (or validationErrors fatalValidationErrors)}}
<button {{action "reset"}} class="gh-btn gh-btn-blue ml2" data-test-try-again-button>
<span>Retry</span>
</button>

View File

@ -294,8 +294,8 @@ describe('Acceptance: Settings - Design', function () {
{
message: 'Theme is not compatible or contains errors.',
type: 'ThemeValidationError',
details: [
{
details: {
errors: [{
level: 'error',
rule: 'Assets such as CSS & JS must use the <code>{{asset}}</code> helper',
details: '<p>The listed files should be included using the <code>{{asset}}</code> helper.</p>',
@ -304,8 +304,7 @@ describe('Acceptance: Settings - Design', function () {
ref: '/assets/javascripts/ui.js'
}
]
},
{
}, {
level: 'error',
rule: 'Templates must contain valid Handlebars.',
failures: [
@ -318,8 +317,8 @@ describe('Acceptance: Settings - Design', function () {
message: 'The partial index_meta could not be found'
}
]
}
]
}]
}
}
]
});