The save button should be enabled when:
a new BPMN or DMN file is created OR an existing file is modified (shape moved, property edited, renamed, etc.) The save button should be disabled when: an existing file is loaded (but not modified yet) a new file is saved (but not modified after save) I have tested and I think I've got everything working.
This commit is contained in:
parent
0cf7a00dcf
commit
0c8d8a704c
|
@ -47,6 +47,7 @@ export class ModelerComponent implements AfterViewInit {
|
|||
private diagramType: FileType;
|
||||
private workflowSpecId: string;
|
||||
private fileMetaId: number;
|
||||
private isNew = false;
|
||||
|
||||
constructor(
|
||||
private api: ApiService,
|
||||
|
@ -92,7 +93,15 @@ export class ModelerComponent implements AfterViewInit {
|
|||
|
||||
this.importError = error;
|
||||
this.importWarnings = warnings;
|
||||
this.draftXml = this.xml + ' ';
|
||||
|
||||
// if this is a new file then we want to enable the save button
|
||||
// otherwise not
|
||||
if (this.isNew ) {
|
||||
this.draftXml = this.xml + ' ';
|
||||
this.isNew = false;
|
||||
} else {
|
||||
this.draftXml = this.xml;
|
||||
}
|
||||
}
|
||||
|
||||
onSubmitFileToOpen() {
|
||||
|
@ -175,6 +184,7 @@ export class ModelerComponent implements AfterViewInit {
|
|||
this.fileName = '';
|
||||
this.diagramFileMeta = undefined;
|
||||
this.diagramFile = undefined;
|
||||
this.isNew = true;
|
||||
this.diagramType = diagramType;
|
||||
this.diagramComponent.openDiagram(undefined, diagramType);
|
||||
}
|
||||
|
@ -188,6 +198,7 @@ export class ModelerComponent implements AfterViewInit {
|
|||
|
||||
dialogRef.afterClosed().subscribe((data: OpenFileDialogData) => {
|
||||
if (data && data.file) {
|
||||
this.isNew = true;
|
||||
this.diagramFile = data.file;
|
||||
this.onSubmitFileToOpen();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue