Skip to content
Snippets Groups Projects
Commit e6db9c8b authored by Florian Lambers's avatar Florian Lambers
Browse files
parents 0e24475c 53765a78
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ export class UpdateProjectComponent implements OnInit { ...@@ -26,7 +26,7 @@ export class UpdateProjectComponent implements OnInit {
diagram: string; // current BPMN-Model diagram: string; // current BPMN-Model
diagramNew: string; // updated BPMN-Model diagramNew: string; // updated BPMN-Model
diagramsLoaded: boolean = false; diagramsLoaded: boolean = false;
compareDiagramsDisabled: boolean = false;
@ViewChild('backupDiagram') backupDiagram; @ViewChild('backupDiagram') backupDiagram;
@ViewChild('newDiagram') newDiagram; @ViewChild('newDiagram') newDiagram;
...@@ -107,7 +107,6 @@ export class UpdateProjectComponent implements OnInit { ...@@ -107,7 +107,6 @@ export class UpdateProjectComponent implements OnInit {
// Testbutton Priorisierung // Testbutton Priorisierung
async callPrio() { async callPrio() {
let message = await this.prio (this.actualProject) let message = await this.prio (this.actualProject)
console.log(message)
} }
prio(projectId: number): Promise<string> { prio(projectId: number): Promise<string> {
...@@ -122,7 +121,9 @@ export class UpdateProjectComponent implements OnInit { ...@@ -122,7 +121,9 @@ export class UpdateProjectComponent implements OnInit {
} }
finally { finally {
this.diagramsLoaded = false; this.diagramsLoaded = false;
} }
} }
async loadDiagramUpdated() { async loadDiagramUpdated() {
...@@ -132,18 +133,17 @@ export class UpdateProjectComponent implements OnInit { ...@@ -132,18 +133,17 @@ export class UpdateProjectComponent implements OnInit {
} }
finally { finally {
this.diagramsLoaded = true; this.diagramsLoaded = true;
} if(this.diagram === this.diagramNew) this.compareDiagramsDisabled=true;
} }
showMigration() {
console.log('start');
} }
revertBPMN() { async revertBPMN() {
if(confirm("Are you sure to discard the new BPMN? The old BPMN will be set as the current model. This action can't be undone.")) if(confirm("Are you sure to discard the new BPMN? The current BPMN will be deleted and the old one will be set as the current model. This action can't be undone."))
{ {
console.log("revert model"); let result = await this.fileService.restoreOldBPMN(this.actualProject);
} }
} }
} }
......
...@@ -22,4 +22,15 @@ export class FileService { ...@@ -22,4 +22,15 @@ export class FileService {
const url = `${environment.apiBaseUrl}project/${projectId}/backup/bpmn/x`; const url = `${environment.apiBaseUrl}project/${projectId}/backup/bpmn/x`;
return <string>await this.http.get(url, {responseType: 'text'}).toPromise(); return <string>await this.http.get(url, {responseType: 'text'}).toPromise();
} }
// REST CALL: /project/{id}/backup/restore
public async restoreOldDSL(projectId: number): Promise<string> {
const url = `${environment.apiBaseUrl}project/${projectId}/backup/restore`;
return await this.http.get(url, {responseType: 'text'}).toPromise();
}
public async restoreOldBPMN(projectId: number): Promise<string> {
const url = `${environment.apiBaseUrl}project/${projectId}/backup/restoreBPMN`;
return await this.http.get(url, {responseType: 'text'}).toPromise();
}
} }
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { BehaviorSubject } from 'rxjs';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { BPMNFlowSet } from '../models/bpmn-flow-set'; import { BPMNFlowSet } from '../models/bpmn-flow-set';
import { MigrationResultWrapper } from '../models/migration-result-wrapper'; import { MigrationResultWrapper } from '../models/migration-result-wrapper';
...@@ -8,6 +9,8 @@ import { MigrationResultWrapper } from '../models/migration-result-wrapper'; ...@@ -8,6 +9,8 @@ import { MigrationResultWrapper } from '../models/migration-result-wrapper';
providedIn: 'root' providedIn: 'root'
}) })
export class MigrationService { export class MigrationService {
migrationResult:MigrationResultWrapper;
constructor(public http: HttpClient) { } constructor(public http: HttpClient) { }
...@@ -20,9 +23,10 @@ export class MigrationService { ...@@ -20,9 +23,10 @@ export class MigrationService {
return <Array<BPMNFlowSet>>await this.http.get(url).toPromise(); return <Array<BPMNFlowSet>>await this.http.get(url).toPromise();
} }
public async migrateMatchingFlows(projectId: number, flowSet: BPMNFlowSet): Promise<MigrationResultWrapper> { public async migrateMatchingFlows(projectId: number, flowSet: BPMNFlowSet){
const url = `${environment.apiBaseUrl}project/${projectId}/migration/changes`; const url = `${environment.apiBaseUrl}project/${projectId}/migration/changes`;
return <MigrationResultWrapper> await this.http.post(url, flowSet).toPromise(); this.migrationResult = <MigrationResultWrapper>await this.http.post(url, flowSet).toPromise();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment