Ghost/ghost/admin/app/components/gh-members-import-table.js
Nazar Gargol ed98d89771 Added imported members csv data preview
no issue

- Adds a table representation of data present in a CSV file that is about to be imported. Allows to navigate through data to see how exactly the file would be parsed on server
2020-06-18 17:47:04 +12:00

34 lines
790 B
JavaScript

import Component from '@glimmer/component';
import {action} from '@ember/object';
import {tracked} from '@glimmer/tracking';
export default class GhMembersImportTable extends Component {
@tracked dataPreviewIndex = 0;
get currentlyDisplayedData() {
if (this.args && this.args.importData) {
return this.args.importData[this.dataPreviewIndex];
}
return {};
}
@action
next() {
const nextValue = this.dataPreviewIndex + 1;
if (this.args.importData[nextValue]) {
this.dataPreviewIndex = nextValue;
}
}
@action
prev() {
const nextValue = this.dataPreviewIndex - 1;
if (this.args.importData[nextValue]) {
this.dataPreviewIndex = nextValue;
}
}
}