mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Updated import results response handling with new error format
refs 7904c303a7
- Adds failed import records details to post members import screen
This commit is contained in:
parent
060b0e759b
commit
e2db84d23b
2 changed files with 21 additions and 18 deletions
|
@ -1,6 +1,6 @@
|
||||||
<header class="modal-header" data-test-modal="import-members">
|
<header class="modal-header" data-test-modal="import-members">
|
||||||
<h1>
|
<h1>
|
||||||
{{#if this.response}}
|
{{#if this.importResponse}}
|
||||||
Import complete
|
Import complete
|
||||||
{{else}}
|
{{else}}
|
||||||
Import members
|
Import members
|
||||||
|
@ -9,24 +9,27 @@
|
||||||
</header>
|
</header>
|
||||||
<a class="close" href="" role="button" title="Close" {{action "closeModal"}}>{{svg-jar "close"}}<span class="hidden">Close</span></a>
|
<a class="close" href="" role="button" title="Close" {{action "closeModal"}}>{{svg-jar "close"}}<span class="hidden">Close</span></a>
|
||||||
|
|
||||||
{{#if this.response}}
|
{{#if this.importResponse}}
|
||||||
<div class="modal-body bg-whitegrey-l2 ba b--whitegrey br3">
|
<div class="modal-body bg-whitegrey-l2 ba b--whitegrey br3">
|
||||||
<table class="gh-members-import-results">
|
<table class="gh-members-import-results">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Imported:</td>
|
<td>Imported:</td>
|
||||||
<td align="left" data-test-text="import-members-imported">{{this.response.imported}}</td>
|
<td align="left" data-test-text="import-members-imported">{{this.importResponse.imported.count}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{#if this.response.duplicates}}
|
{{#if this.importResponse.invalid.count}}
|
||||||
<tr>
|
|
||||||
<td>Duplicates:</td>
|
|
||||||
<td align="left" data-test-text="import-members-duplicates">{{this.response.duplicates}}</td>
|
|
||||||
</tr>
|
|
||||||
{{/if}}
|
|
||||||
{{#if this.response.invalid}}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="red">Invalid:</td>
|
<td class="red">Invalid:</td>
|
||||||
<td align="left" data-test-text="import-members-invalid" class="red">{{this.response.invalid}}</td>
|
<td align="left" data-test-text="import-members-invalid" class="red">{{this.importResponse.invalid.count}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">Details:</td>
|
||||||
|
</tr>
|
||||||
|
{{#each this.importResponse.invalid.errors as |error|}}
|
||||||
|
<tr>
|
||||||
|
<td>{{error.message}}</td>
|
||||||
|
<td>{{error.count}}</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -73,8 +76,8 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class="modal-footer {{if (and this.filePresent (not this.failureMessage) (not this.response)) "modal-footer-spread"}}">
|
<div class="modal-footer {{if (and this.filePresent (not this.failureMessage) (not this.importResponse)) "modal-footer-spread"}}">
|
||||||
{{#if this.response}}
|
{{#if this.importResponse}}
|
||||||
<button {{action "closeModal"}} disabled={{this.closeDisabled}} class="gh-btn gh-btn-blue" data-test-button="close-import-members">
|
<button {{action "closeModal"}} disabled={{this.closeDisabled}} class="gh-btn gh-btn-blue" data-test-button="close-import-members">
|
||||||
<span>Done</span>
|
<span>Done</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default ModalComponent.extend({
|
||||||
paramName: 'membersfile',
|
paramName: 'membersfile',
|
||||||
uploading: false,
|
uploading: false,
|
||||||
uploadPercentage: 0,
|
uploadPercentage: 0,
|
||||||
response: null,
|
importResponse: null,
|
||||||
failureMessage: null,
|
failureMessage: null,
|
||||||
validationErrors: null,
|
validationErrors: null,
|
||||||
labels: null,
|
labels: null,
|
||||||
|
@ -189,8 +189,8 @@ export default ModalComponent.extend({
|
||||||
|
|
||||||
return xhr;
|
return xhr;
|
||||||
}
|
}
|
||||||
}).then((response) => {
|
}).then((importResponse) => {
|
||||||
this._uploadSuccess(JSON.parse(response));
|
this._uploadSuccess(JSON.parse(importResponse));
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
this._validationFailed(error);
|
this._validationFailed(error);
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
@ -211,8 +211,8 @@ export default ModalComponent.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_uploadSuccess(response) {
|
_uploadSuccess(importResponse) {
|
||||||
this.set('response', response.meta.stats);
|
this.set('importResponse', importResponse.meta.stats);
|
||||||
// invoke the passed in confirm action to refresh member data
|
// invoke the passed in confirm action to refresh member data
|
||||||
this.confirm();
|
this.confirm();
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue