Trying to fix modifying workflow_spec_id issues

This commit is contained in:
Aaron Louie 2020-01-15 17:10:58 -05:00
parent e74e1c309a
commit d381328472
3 changed files with 32 additions and 19 deletions

6
package-lock.json generated
View File

@ -9917,9 +9917,9 @@
"dev": true
},
"sartography-workflow-lib": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.8.tgz",
"integrity": "sha512-0fOCHoLUWuMh828iXJVUlADiMCNdU/WBihJ9DCvFbdU24qvuKklAXxgF9a7pu3CrCHPTajNrL7pfAbjSUwx21w==",
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.10.tgz",
"integrity": "sha512-Awy80Q7h+fvNRYsCEOPFlvbZ5X0wtUEOWPmGzdxQCZB4btBkxE2utxcazzVSigl/2ai5Fmr8JIgWDn2M5y1vVQ==",
"requires": {
"tslib": "^1.9.0"
}

View File

@ -41,7 +41,7 @@
"file-saver": "^2.0.2",
"hammerjs": "^2.0.8",
"rxjs": "~6.5.4",
"sartography-workflow-lib": "^0.0.8",
"sartography-workflow-lib": "^0.0.10",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},

View File

@ -116,7 +116,7 @@ export class AppComponent implements AfterViewInit {
if (this.diagramFileMeta && this.diagramFileMeta.workflow_spec_id) {
this.xml = this.draftXml;
this.diagramFileMeta.file = new File([this.xml], this.diagramFileMeta.name, {type: 'text/xml'});
this.api.updateFileMeta(this.diagramFileMeta).subscribe(() => {
this.api.updateFileMeta(this.workflowSpec.id, this.diagramFileMeta).subscribe(() => {
this.snackBar.open('Saved changes.', 'Ok', {duration: 5000});
});
} else {
@ -197,7 +197,9 @@ export class AppComponent implements AfterViewInit {
description: data.description,
};
const fileMetaId = this.diagramFileMeta ? this.diagramFileMeta.id : undefined;
this.diagramFileMeta = {
id: fileMetaId,
content_type: 'text/xml',
name: data.fileName,
type: FileType.BPMN,
@ -214,7 +216,7 @@ export class AppComponent implements AfterViewInit {
if (specId) {
// Update existing workflow spec and file
this.api.updateWorkflowSpecification(specId, newSpec).subscribe(spec => {
this.api.updateFileMeta(this.diagramFileMeta).subscribe(fileMeta => {
this.api.updateFileMeta(specId, this.diagramFileMeta).subscribe(fileMeta => {
this.loadFilesFromDb();
this.snackBar.open('Saved changes to workflow spec and file.', 'Ok', {duration: 5000});
});
@ -236,22 +238,33 @@ export class AppComponent implements AfterViewInit {
}
getFileMetaDisplayString(fileMeta: FileMeta) {
const wfsName = this.getWorkflowSpec(fileMeta.workflow_spec_id).display_name;
const lastUpdated = new DatePipe('en-us').transform(fileMeta.last_updated);
return `${wfsName} (${fileMeta.name}) - v${fileMeta.version} (${lastUpdated})`;
const spec = this.getWorkflowSpec(fileMeta.workflow_spec_id);
if (spec) {
const specName = spec.display_name;
const lastUpdated = new DatePipe('en-us').transform(fileMeta.last_updated);
return `${specName} (${fileMeta.name}) - v${fileMeta.version} (${lastUpdated})`;
} else {
return 'Loading...';
}
}
getFileMetaTooltipText(fileMeta: FileMeta) {
const wfs = this.getWorkflowSpec(fileMeta.workflow_spec_id);
const lastUpdated = new DatePipe('en-us').transform(fileMeta.last_updated);
return `
Workflow spec ID: ${wfs.id}
Display name: ${wfs.display_name}
Description: ${wfs.description}
File name: ${fileMeta.name}
Last updated: ${lastUpdated}
Version: ${fileMeta.version}
`;
const spec = this.getWorkflowSpec(fileMeta.workflow_spec_id);
if (spec) {
const lastUpdated = new DatePipe('en-us').transform(fileMeta.last_updated);
return `
Workflow spec ID: ${spec.id}
Display name: ${spec.display_name}
Description: ${spec.description}
File name: ${fileMeta.name}
Last updated: ${lastUpdated}
Version: ${fileMeta.version}
`;
} else {
return 'Loading...';
}
}
private isXmlFile(file: File) {