Some fixes
This commit is contained in:
parent
3c72e778d9
commit
640d3c2f11
2 changed files with 16 additions and 9 deletions
|
@ -123,7 +123,11 @@ export default class CUD extends Component {
|
||||||
if (!isEdit) {
|
if (!isEdit) {
|
||||||
if (data.source === ImportSource.CSV_FILE) {
|
if (data.source === ImportSource.CSV_FILE) {
|
||||||
data.settings.csv = {};
|
data.settings.csv = {};
|
||||||
formData.append('csvFile', this.csvFile.files[0]);
|
|
||||||
|
// This test needs to be here because this function is also called by the form change detection mechanism
|
||||||
|
if (this.csvFile && this.csvFile.files && this.csvFile.files.length > 0) {
|
||||||
|
formData.append('csvFile', this.csvFile.files[0]);
|
||||||
|
}
|
||||||
data.settings.csv.delimiter = data.csvDelimiter.trim();
|
data.settings.csv.delimiter = data.csvDelimiter.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,6 +176,7 @@ export default class CUD extends Component {
|
||||||
formData.append('entity', JSON.stringify(
|
formData.append('entity', JSON.stringify(
|
||||||
filterData(data, ['name', 'description', 'source', 'settings', 'mapping_type', 'mapping'])
|
filterData(data, ['name', 'description', 'source', 'settings', 'mapping_type', 'mapping'])
|
||||||
));
|
));
|
||||||
|
// TODO - form change detection cannot cope with FormData
|
||||||
|
|
||||||
return formData;
|
return formData;
|
||||||
}
|
}
|
||||||
|
@ -271,13 +276,15 @@ export default class CUD extends Component {
|
||||||
if (!isEdit) {
|
if (!isEdit) {
|
||||||
this.navigateTo(`/lists/${this.props.list.id}/imports/${submitResponse}/edit`);
|
this.navigateTo(`/lists/${this.props.list.id}/imports/${submitResponse}/edit`);
|
||||||
} else {
|
} else {
|
||||||
try {
|
if (runAfterSave) {
|
||||||
await axios.post(getUrl(`rest/import-start/${this.props.list.id}/${this.props.entity.id}`));
|
try {
|
||||||
} catch (err) {
|
await axios.post(getUrl(`rest/import-start/${this.props.list.id}/${this.props.entity.id}`));
|
||||||
if (err instanceof interoperableErrors.InvalidStateError) {
|
} catch (err) {
|
||||||
// Just mask the fact that it's not possible to start anything and refresh instead.
|
if (err instanceof interoperableErrors.InvalidStateError) {
|
||||||
} else {
|
// Just mask the fact that it's not possible to start anything and refresh instead.
|
||||||
throw err;
|
} else {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default class List extends Component {
|
||||||
{ data: 2, title: t('description') },
|
{ data: 2, title: t('description') },
|
||||||
{ data: 3, title: t('source'), render: data => this.importSourceLabels[data], sortable: false, searchable: false },
|
{ data: 3, title: t('source'), render: data => this.importSourceLabels[data], sortable: false, searchable: false },
|
||||||
{ data: 4, title: t('status'), render: data => this.importStatusLabels[data], sortable: false, searchable: false },
|
{ data: 4, title: t('status'), render: data => this.importStatusLabels[data], sortable: false, searchable: false },
|
||||||
{ data: 5, title: t('lastRun'), render: data => moment(data).fromNow() },
|
{ data: 5, title: t('lastRun'), render: data => data ? moment(data).fromNow() : t('never') },
|
||||||
{
|
{
|
||||||
actions: data => {
|
actions: data => {
|
||||||
const actions = [];
|
const actions = [];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue