mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-01-11 17:44:32 +00:00
Updates API calls to match new endpoint params structure
This commit is contained in:
parent
6ee06f09a1
commit
c1a0f2f79e
6
package-lock.json
generated
6
package-lock.json
generated
@ -11635,9 +11635,9 @@
|
|||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
"sartography-workflow-lib": {
|
"sartography-workflow-lib": {
|
||||||
"version": "0.0.25",
|
"version": "0.0.27",
|
||||||
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.25.tgz",
|
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.27.tgz",
|
||||||
"integrity": "sha512-km+08X+xt3vkL/QjXA/xSlHkq0z3T5cq4pqwDLgwJBrg/hhRCFMYIbuypmo4UFrhJ9TdFfouo/rRgHVCplld0Q==",
|
"integrity": "sha512-eopRRJjwTgKEwNcmCqIkAekwnzUrFglQzRHO4/fEwtN/yaLHYJv+b8O4/YcQtBkBp7hbYj+9MbmC8FU3o387yg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
"file-saver": "^2.0.2",
|
"file-saver": "^2.0.2",
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
"rxjs": "~6.5.4",
|
"rxjs": "~6.5.4",
|
||||||
"sartography-workflow-lib": "^0.0.25",
|
"sartography-workflow-lib": "^0.0.27",
|
||||||
"tslib": "^1.10.0",
|
"tslib": "^1.10.0",
|
||||||
"uuid": "^3.4.0",
|
"uuid": "^3.4.0",
|
||||||
"zone.js": "~0.9.1"
|
"zone.js": "~0.9.1"
|
||||||
|
@ -13,6 +13,11 @@ describe('GetIconCodePipe', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should get an icon code for each file type', () => {
|
it('should get an icon code for each file type', () => {
|
||||||
Object.values(FileType).forEach(ft => expect(pipe.transform(ft)).toBeTruthy());
|
const types = [
|
||||||
|
FileType.BPMN,
|
||||||
|
FileType.DMN,
|
||||||
|
FileType.SVG
|
||||||
|
];
|
||||||
|
types.forEach(ft => expect(pipe.transform(ft)).toBeTruthy());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -81,7 +81,7 @@ describe('FileListComponent', () => {
|
|||||||
expect(fmsNoFiles.every(fm => !fm.file)).toEqual(true);
|
expect(fmsNoFiles.every(fm => !fm.file)).toEqual(true);
|
||||||
expect(justFiles.every(f => !!f.name)).toEqual(true);
|
expect(justFiles.every(f => !!f.name)).toEqual(true);
|
||||||
|
|
||||||
const fmsReq = httpMock.expectOne(`apiRoot/file?spec_id=${mockWorkflowSpec0.id}`);
|
const fmsReq = httpMock.expectOne(`apiRoot/file?workflow_spec_id=${mockWorkflowSpec0.id}`);
|
||||||
expect(fmsReq.request.method).toEqual('GET');
|
expect(fmsReq.request.method).toEqual('GET');
|
||||||
fmsReq.flush(fmsNoFiles);
|
fmsReq.flush(fmsNoFiles);
|
||||||
expect(component.fileMetas.length).toBeGreaterThan(0);
|
expect(component.fileMetas.length).toBeGreaterThan(0);
|
||||||
|
@ -72,7 +72,7 @@ export class FileListComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _loadFileMetas() {
|
private _loadFileMetas() {
|
||||||
this.api.listBpmnFiles(this.workflowSpec.id).subscribe(fms => {
|
this.api.getFileMeta({workflow_spec_id: this.workflowSpec.id}).subscribe(fms => {
|
||||||
this.fileMetas = fms;
|
this.fileMetas = fms;
|
||||||
this._loadFileData();
|
this._loadFileData();
|
||||||
});
|
});
|
||||||
|
@ -112,7 +112,7 @@ describe('ModelerComponent', () => {
|
|||||||
wfsReq.flush(mockWorkflowSpec0);
|
wfsReq.flush(mockWorkflowSpec0);
|
||||||
expect(component.workflowSpec).toEqual(mockWorkflowSpec0);
|
expect(component.workflowSpec).toEqual(mockWorkflowSpec0);
|
||||||
|
|
||||||
const req = httpMock.expectOne(`apiRoot/file?spec_id=${mockWorkflowSpec0.id}`);
|
const req = httpMock.expectOne(`apiRoot/file?workflow_spec_id=${mockWorkflowSpec0.id}`);
|
||||||
expect(req.request.method).toEqual('GET');
|
expect(req.request.method).toEqual('GET');
|
||||||
req.flush(mockFileMetas);
|
req.flush(mockFileMetas);
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ describe('ModelerComponent', () => {
|
|||||||
component.draftXml = newXml;
|
component.draftXml = newXml;
|
||||||
component._upsertFileMeta(data);
|
component._upsertFileMeta(data);
|
||||||
expect(component.xml).toEqual(newXml);
|
expect(component.xml).toEqual(newXml);
|
||||||
expect(addFileMetaSpy).toHaveBeenCalledWith(mockWorkflowSpec0.id, noDateOrVersion);
|
expect(addFileMetaSpy).toHaveBeenCalledWith({workflow_spec_id: mockWorkflowSpec0.id}, noDateOrVersion);
|
||||||
expect(loadFilesFromDbSpy).not.toHaveBeenCalled();
|
expect(loadFilesFromDbSpy).not.toHaveBeenCalled();
|
||||||
expect(routerNavigateSpy).toHaveBeenCalled();
|
expect(routerNavigateSpy).toHaveBeenCalled();
|
||||||
expect(snackBarSpy).toHaveBeenCalled();
|
expect(snackBarSpy).toHaveBeenCalled();
|
||||||
@ -371,7 +371,7 @@ describe('ModelerComponent', () => {
|
|||||||
it('should load files from the database', () => {
|
it('should load files from the database', () => {
|
||||||
const getWorkflowSpecSpy = spyOn(component.api, 'getWorkflowSpecification')
|
const getWorkflowSpecSpy = spyOn(component.api, 'getWorkflowSpecification')
|
||||||
.and.returnValue(of(mockWorkflowSpec0));
|
.and.returnValue(of(mockWorkflowSpec0));
|
||||||
const listBpmnFilesSpy = spyOn(component.api, 'listBpmnFiles')
|
const getFileMetaSpy = spyOn(component.api, 'getFileMeta')
|
||||||
.and.returnValue(of(mockFileMetas));
|
.and.returnValue(of(mockFileMetas));
|
||||||
const getFileDataSpy = spyOn(component.api, 'getFileData')
|
const getFileDataSpy = spyOn(component.api, 'getFileData')
|
||||||
.and.returnValue(of(mockFileMeta0));
|
.and.returnValue(of(mockFileMeta0));
|
||||||
@ -379,7 +379,7 @@ describe('ModelerComponent', () => {
|
|||||||
|
|
||||||
expect(getWorkflowSpecSpy).toHaveBeenCalled();
|
expect(getWorkflowSpecSpy).toHaveBeenCalled();
|
||||||
expect(component.workflowSpec).toEqual(mockWorkflowSpec0);
|
expect(component.workflowSpec).toEqual(mockWorkflowSpec0);
|
||||||
expect(listBpmnFilesSpy).toHaveBeenCalledWith(mockWorkflowSpec0.id);
|
expect(getFileMetaSpy).toHaveBeenCalledWith({workflow_spec_id: mockWorkflowSpec0.id});
|
||||||
|
|
||||||
mockFileMetas.forEach(fm => {
|
mockFileMetas.forEach(fm => {
|
||||||
expect(getFileDataSpy).toHaveBeenCalledWith(fm.id);
|
expect(getFileDataSpy).toHaveBeenCalledWith(fm.id);
|
||||||
|
@ -226,7 +226,7 @@ export class ModelerComponent implements AfterViewInit {
|
|||||||
private loadFilesFromDb() {
|
private loadFilesFromDb() {
|
||||||
this.api.getWorkflowSpecification(this.workflowSpecId).subscribe(wfs => {
|
this.api.getWorkflowSpecification(this.workflowSpecId).subscribe(wfs => {
|
||||||
this.workflowSpec = wfs;
|
this.workflowSpec = wfs;
|
||||||
this.api.listBpmnFiles(wfs.id).subscribe(files => {
|
this.api.getFileMeta({workflow_spec_id: wfs.id}).subscribe(files => {
|
||||||
this.bpmnFiles = [];
|
this.bpmnFiles = [];
|
||||||
files.forEach(f => {
|
files.forEach(f => {
|
||||||
this.api.getFileData(f.id).subscribe(d => {
|
this.api.getFileData(f.id).subscribe(d => {
|
||||||
@ -271,7 +271,7 @@ export class ModelerComponent implements AfterViewInit {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Add new file meta
|
// Add new file meta
|
||||||
this.api.addFileMeta(this.workflowSpec.id, this.diagramFileMeta).subscribe(fileMeta => {
|
this.api.addFileMeta({workflow_spec_id: this.workflowSpec.id}, this.diagramFileMeta).subscribe(fileMeta => {
|
||||||
this.router.navigate(['/modeler', this.workflowSpec.id, fileMeta.id]);
|
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});
|
this.snackBar.open(`Saved new file ${fileMeta.name} to workflow spec ${this.workflowSpec.name}.`, 'Ok', {duration: 5000});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user