If we create a new file, and it dies when we try to save it,

make sure that the save button is still enabled, and make sure we have the ability to save it. (previously, it would not save after the first error)
This commit is contained in:
Kelly McDonald 2021-01-21 10:47:09 -05:00
parent 0c8d8a704c
commit 1abb796637
1 changed files with 6 additions and 1 deletions

View File

@ -168,7 +168,7 @@ export class ModelerComponent implements AfterViewInit {
}
hasChanged(): boolean {
return this.xml !== this.draftXml;
return (this.xml !== this.draftXml) || this.isNew;
}
loadDbFile(bf: FileMeta) {
@ -314,6 +314,11 @@ export class ModelerComponent implements AfterViewInit {
this.api.addFileMeta({workflow_spec_id: this.workflowSpec.id}, this.diagramFileMeta).subscribe(fileMeta => {
this.router.navigate(['/modeler', this.workflowSpec.id, fileMeta.id]);
this.snackBar.open(`Saved new file ${fileMeta.name} to workflow spec ${this.workflowSpec.name}.`, 'Ok', {duration: 5000});
}, x => {
// if this fails, we make sure that the file is treated as still new,
// and we make the user re-enter the file details as they weren't actually saved.
this.isNew = true;
this.diagramFileMeta = undefined;
});
}
}