forked from PlanQK/workflow-modeler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlanQKPlugin.js
32 lines (29 loc) · 1.11 KB
/
PlanQKPlugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from "react";
import planqkStyles from "./resources/css/planqk-icons.css";
import PlanQKExtensionModule from "./modeling";
import { startPlanqkReplacementProcess } from "./replacement/PlanQKTransformator";
import TransformationButton from "../../editor/ui/TransformationButton";
import { getModeler } from "../../editor/ModelerHandler";
let planqkModdleDescriptor = require("./resources/planqk-service-task-ext.json");
/**
* Plugin Object of the PlanQK extension. Used to register the plugin in the plugin handler of the modeler.
*/
export default {
name: "planqk",
extensionModule: PlanQKExtensionModule,
moddleDescription: planqkModdleDescriptor,
styling: [planqkStyles],
transformExtensionButton: (
<TransformationButton
name="PlanQK Transformation"
transformWorkflow={async (xml) => {
let modeler = getModeler();
// Initialize 'views' as an empty object if it's undefined
let views = modeler.views || {};
let transformedXml = await startPlanqkReplacementProcess(xml);
modeler.views = views;
return transformedXml;
}}
/>
),
};