Skip to content

Commit

Permalink
try to fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
mbritense committed Nov 29, 2024
1 parent afbee2c commit 34d0a21
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
8 changes: 7 additions & 1 deletion projects/valtimo/migration/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
"dest": "../../../dist/valtimo/migration",
"lib": {
"entryFile": "src/public-api.ts"
}
},
"allowedNonPeerDependencies": [
"bpmn-js-properties-panel",
"@bpmn-io/properties-panel",
"camunda-bpmn-moddle",
"camunda-bpmn-js-behaviors"
]
}
6 changes: 5 additions & 1 deletion projects/valtimo/migration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"@angular/core": "^17.2.2"
},
"dependencies": {
"tslib": "2.6.3"
"tslib": "2.6.3",
"bpmn-js-properties-panel": "5.26.0",
"@bpmn-io/properties-panel": "3.25.0",
"camunda-bpmn-moddle": "7.0.1",
"camunda-bpmn-js-behaviors": "1.7.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/

import {
AfterViewInit,
Component,
ElementRef,
EventEmitter,
Input,
OnDestroy,
OnInit,
Output,
ViewChild,
} from '@angular/core';
Expand All @@ -33,7 +33,7 @@ import {NGXLogger} from 'ngx-logger';
templateUrl: './migration-process-diagram.component.html',
styleUrls: ['./migration-process-diagram.component.scss'],
})
export class MigrationProcessDiagramComponent implements OnInit, OnDestroy {
export class MigrationProcessDiagramComponent implements AfterViewInit, OnDestroy {
private bpmnViewer: BpmnViewer;
public flowNodeMap: any = null;

Expand All @@ -43,11 +43,13 @@ export class MigrationProcessDiagramComponent implements OnInit, OnDestroy {

constructor(private logger: NGXLogger) {}

ngOnInit() {
ngAfterViewInit() {
this.bpmnViewer = new BpmnViewer();
this.bpmnViewer.attachTo(this.el.nativeElement);
this.bpmnViewer.on('import.done', ({error}: any) => {
if (!error) {
const canvas = this.bpmnViewer.get('canvas') as any;
console.log(canvas);
canvas.zoom('fit-viewport', 'auto');
}
});
Expand All @@ -64,8 +66,9 @@ export class MigrationProcessDiagramComponent implements OnInit, OnDestroy {
}

public loadXml(xml: string): void {
this.bpmnViewer.attachTo(this.el.nativeElement);
this.bpmnViewer.importXML(xml, err => {
if (err) console.log('error', err);
console.log('import', xml);
this.logger.debug(err);
const processElements = this.bpmnViewer
.getDefinitions()
Expand All @@ -78,6 +81,7 @@ export class MigrationProcessDiagramComponent implements OnInit, OnDestroy {
}
return element.$type !== 'bpmn:SequenceFlow';
});
console.log('test', processElements, this.flowNodeMap, this.name);
this.loaded.emit(this.name);
});
}
Expand Down
12 changes: 5 additions & 7 deletions projects/valtimo/migration/src/lib/migration.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
import {ProcessService, ProcessDefinition} from '@valtimo/process';
import {AfterViewInit, Component, ViewChild} from '@angular/core';
import {ProcessDefinition, ProcessService} from '@valtimo/process';
import {MigrationProcessDiagramComponent} from './migration-process-diagram/migration-process-diagram.component';
import {NGXLogger} from 'ngx-logger';
import {AlertService} from '@valtimo/components';
Expand All @@ -25,7 +25,7 @@ import {AlertService} from '@valtimo/components';
templateUrl: './migration.component.html',
styleUrls: ['./migration.component.scss'],
})
export class MigrationComponent implements OnInit, AfterViewInit {
export class MigrationComponent implements AfterViewInit, AfterViewInit {
public processDefinitions: ProcessDefinition[] = [];
public selectedVersions = {
source: [],
Expand Down Expand Up @@ -65,15 +65,12 @@ export class MigrationComponent implements OnInit, AfterViewInit {
private alertService: AlertService
) {}

ngOnInit() {
this.loadProcessDefinitions();
}

ngAfterViewInit() {
this.diagram = {
source: this.sourceDiagram,
target: this.targetDiagram,
};
this.loadProcessDefinitions();
}

public get taskMappingLength() {
Expand Down Expand Up @@ -123,6 +120,7 @@ export class MigrationComponent implements OnInit, AfterViewInit {

loadProcessDefinitionXML(id: string, type: string) {
this.processService.getProcessDefinitionXml(id).subscribe(xml => {
if (!xml.bpmn20Xml) return;
this.diagram[type].loadXml(xml['bpmn20Xml']);
this.selectedId[type] = id;
});
Expand Down

0 comments on commit 34d0a21

Please sign in to comment.