mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Added automatic filter of members list after CSV import
requires 8ceabbcfba
- if the API responds with `meta.import_label` after an import, use it to reset and apply the filter across the members list so that it's quick to see the results of the import and perform further bulk actions (coming later)
- added ability to pass arguments through `<GhFullscreenModal>`'s `@confirm` action
- added a `console.error()` call to the members csv import so that any underlying error is not completely lost by the custom error handling
This commit is contained in:
parent
3a37e539b8
commit
42b3e3a412
3 changed files with 20 additions and 4 deletions
|
@ -39,11 +39,11 @@ const FullScreenModalComponent = Component.extend({
|
|||
|
||||
actions: {
|
||||
close() {
|
||||
return this.close();
|
||||
return this.close(...arguments);
|
||||
},
|
||||
|
||||
confirm() {
|
||||
return this.confirm();
|
||||
return this.confirm(...arguments);
|
||||
},
|
||||
|
||||
clickOverlay() {
|
||||
|
|
|
@ -67,6 +67,7 @@ export default ModalComponent.extend({
|
|||
ajax: service(),
|
||||
notifications: service(),
|
||||
memberImportValidator: service(),
|
||||
store: service(),
|
||||
|
||||
labelText: 'Select or drop a CSV file',
|
||||
|
||||
|
@ -317,8 +318,17 @@ export default ModalComponent.extend({
|
|||
}
|
||||
|
||||
this.set('importResponse', importResponse.meta.stats);
|
||||
|
||||
// insert auto-created import label into store immediately if present
|
||||
// ready for filtering the members list
|
||||
if (importResponse.meta.import_label) {
|
||||
this.store.pushPayload({
|
||||
labels: [importResponse.meta.import_label]
|
||||
});
|
||||
}
|
||||
|
||||
// invoke the passed in confirm action to refresh member data
|
||||
this.confirm();
|
||||
this.confirm({label: importResponse.meta.import_label});
|
||||
},
|
||||
|
||||
_uploadFinished() {
|
||||
|
@ -344,6 +354,7 @@ export default ModalComponent.extend({
|
|||
} else if (error.payload && error.payload.errors && !isBlank(error.payload.errors[0].message)) {
|
||||
message = htmlSafe(error.payload.errors[0].message);
|
||||
} else {
|
||||
console.error(error); // eslint-disable-line
|
||||
message = 'Something went wrong :(';
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Controller from '@ember/controller';
|
||||
import {action} from '@ember/object';
|
||||
import {inject as controller} from '@ember/controller';
|
||||
import {resetQueryParams} from 'ghost-admin/helpers/reset-query-params';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default class ImportController extends Controller {
|
||||
|
@ -8,7 +9,11 @@ export default class ImportController extends Controller {
|
|||
@controller members;
|
||||
|
||||
@action
|
||||
refreshMembers() {
|
||||
refreshMembers({label} = {}) {
|
||||
if (label) {
|
||||
let queryParams = Object.assign(resetQueryParams('members.index'), {label: label.slug});
|
||||
this.router.transitionTo({queryParams});
|
||||
}
|
||||
this.members.refreshData();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue