From c54a479ee6c71883b2d784f745d6aa50cddbec36 Mon Sep 17 00:00:00 2001 From: mbeisel Date: Wed, 31 Jul 2024 11:48:23 +0200 Subject: [PATCH] fix for runtime pattern combination --- .../editor/util/IoUtilities.js | 4 ++-- .../replacement/PatternTransformator.js | 14 +++++++------- .../PatternSelectionPlugin.js | 4 +--- .../replacement/QuantMETransformator.js | 7 +++++-- .../ui/splitting/ScriptSplitterPlugin.js | 19 ++++++++++--------- .../quantme/ui/splitting/WorkflowRewriter.js | 8 ++------ .../extensions/quantme/utilities/Utilities.js | 2 +- 7 files changed, 28 insertions(+), 30 deletions(-) diff --git a/components/bpmn-q/modeler-component/editor/util/IoUtilities.js b/components/bpmn-q/modeler-component/editor/util/IoUtilities.js index 3a01cee7..df1a35e9 100644 --- a/components/bpmn-q/modeler-component/editor/util/IoUtilities.js +++ b/components/bpmn-q/modeler-component/editor/util/IoUtilities.js @@ -12,7 +12,7 @@ import fetch from "node-fetch"; import getHardwareSelectionForm from "../../extensions/quantme/replacement/hardware-selection/HardwareSelectionForm"; import JSZip from "jszip"; import NotificationHandler from "../ui/notifications/NotificationHandler"; -import {checkEnabledStatus, getActivePlugins} from "../plugin/PluginHandler"; +import { getActivePlugins } from "../plugin/PluginHandler"; import { getServiceTasksToDeploy } from "../../extensions/opentosca/deployment/DeploymentUtils"; import { getRootProcess } from "./ModellingUtilities"; import { getWineryEndpoint } from "../../extensions/opentosca/framework-config/config-manager"; @@ -618,7 +618,7 @@ export async function saveQAA( let openToscaActive = false; for (let plugin of getActivePlugins()) { console.log(plugin.name); - if (plugin.name === pluginNames.OPENTOSCA){ + if (plugin.name === pluginNames.OPENTOSCA) { openToscaActive = true; } } diff --git a/components/bpmn-q/modeler-component/extensions/pattern/replacement/PatternTransformator.js b/components/bpmn-q/modeler-component/extensions/pattern/replacement/PatternTransformator.js index c67ef585..3f3fe06e 100644 --- a/components/bpmn-q/modeler-component/extensions/pattern/replacement/PatternTransformator.js +++ b/components/bpmn-q/modeler-component/extensions/pattern/replacement/PatternTransformator.js @@ -252,8 +252,8 @@ export async function startPatternReplacementProcess(xml) { ); console.log("Begin of measurement of step F: "); startTime = Date.now(); - let optimizationCandidates = []; - if (behaviorReplacementConstructs.length !== 0 ) { + let optimizationCandidates = []; + if (behaviorReplacementConstructs.length !== 0) { optimizationCandidates = await findOptimizationCandidates(modeler); } @@ -296,7 +296,7 @@ export async function startPatternReplacementProcess(xml) { } replacementSuccess = true; optimizationCandidates = await findOptimizationCandidates(modeler); - console.log("optimization candidates: ", optimizationCandidates) + console.log("optimization candidates: ", optimizationCandidates); } if (replacementConstruct.task.$type === constants.PRE_DEPLOYED_EXECUTION) { console.log("Replace pre-deployed execution"); @@ -449,14 +449,14 @@ export async function startPatternReplacementProcess(xml) { // remove duplicate patterns from elementsToDelete let elementsToDeleteNoDuplicates = []; - for (let i = 0; i < elementsToDelete.length; i++){ + for (let i = 0; i < elementsToDelete.length; i++) { let contains = false; - for (let j = 0; j < elementsToDeleteNoDuplicates.length; j++){ - if (elementsToDeleteNoDuplicates[j].id === elementsToDelete[i].id ) { + for (let j = 0; j < elementsToDeleteNoDuplicates.length; j++) { + if (elementsToDeleteNoDuplicates[j].id === elementsToDelete[i].id) { contains = true; } } - if (!contains && elementsToDelete[i].parent !== null){ + if (!contains && elementsToDelete[i].parent !== null) { elementsToDeleteNoDuplicates.push(elementsToDelete[i]); } } diff --git a/components/bpmn-q/modeler-component/extensions/pattern/ui/pattern-selection/PatternSelectionPlugin.js b/components/bpmn-q/modeler-component/extensions/pattern/ui/pattern-selection/PatternSelectionPlugin.js index d40cbdf3..91ad280e 100644 --- a/components/bpmn-q/modeler-component/extensions/pattern/ui/pattern-selection/PatternSelectionPlugin.js +++ b/components/bpmn-q/modeler-component/extensions/pattern/ui/pattern-selection/PatternSelectionPlugin.js @@ -34,8 +34,7 @@ import NotificationHandler from "../../../../editor/ui/notifications/Notificatio import { findSplittingCandidates } from "../../../quantme/ui/splitting/CandidateDetector"; import { rewriteWorkflow } from "../../../quantme/ui/splitting/WorkflowRewriter"; import { invokeScriptSplitter } from "../../../quantme/ui/splitting/splitter/ScriptSplitterHandler"; -import {generateQrms, handleQrmUpload} from "../../../quantme/utilities/Utilities"; -import { uploadMultipleToGitHub } from "../../../quantme/qrm-manager/git-handler"; +import { handleQrmUpload } from "../../../quantme/utilities/Utilities"; const defaultState = { patternOverviewOpen: false, @@ -221,7 +220,6 @@ export default class PatternSelectionPlugin extends PureComponent { qrmsActivities = result.qrmActivities; if (qrmsActivities.length > 0) { handleQrmUpload(qrmsActivities, this.modeler); - } } else { let collapsedSubprocessStartEvent = elementFactory.createShape({ diff --git a/components/bpmn-q/modeler-component/extensions/quantme/replacement/QuantMETransformator.js b/components/bpmn-q/modeler-component/extensions/quantme/replacement/QuantMETransformator.js index 5e1fe96b..3fc38cb5 100644 --- a/components/bpmn-q/modeler-component/extensions/quantme/replacement/QuantMETransformator.js +++ b/components/bpmn-q/modeler-component/extensions/quantme/replacement/QuantMETransformator.js @@ -215,8 +215,11 @@ export async function startQuantmeReplacementProcess( console.log("Searching for splitting candidates after transformation"); const splittingCandidates = await findSplittingCandidates(modeler); if (splittingCandidates.length > 0) { - console.log("Found {} splitting candidates after transformation", splittingCandidates.length); - console.log(splittingCandidates) + console.log( + "Found {} splitting candidates after transformation", + splittingCandidates.length + ); + console.log(splittingCandidates); let qrmActivities = []; for (let i = 0; i < splittingCandidates.length; i++) { let programGenerationResult = await invokeScriptSplitter( diff --git a/components/bpmn-q/modeler-component/extensions/quantme/ui/splitting/ScriptSplitterPlugin.js b/components/bpmn-q/modeler-component/extensions/quantme/ui/splitting/ScriptSplitterPlugin.js index 61ed2a32..1684029e 100644 --- a/components/bpmn-q/modeler-component/extensions/quantme/ui/splitting/ScriptSplitterPlugin.js +++ b/components/bpmn-q/modeler-component/extensions/quantme/ui/splitting/ScriptSplitterPlugin.js @@ -146,7 +146,10 @@ export default class AdaptationPlugin extends PureComponent { const rewriteStartDate = Date.now(); let rewriteCandidate = result.candidates[result.rewriteCandidateId]; - let programGenerationResult = await this.invokeScriptSplitterForCandidate(rewriteCandidate, result.scriptSplitterName ); + let programGenerationResult = await this.invokeScriptSplitterForCandidate( + rewriteCandidate, + result.scriptSplitterName + ); // check if hybrid program generation was successful if (programGenerationResult.error) { @@ -218,23 +221,22 @@ export default class AdaptationPlugin extends PureComponent { this.setState({ rewriteOpen: false }); } - - async invokeScriptSplitterForCandidate(rewriteCandidate, scriptSplitterName){ + async invokeScriptSplitterForCandidate(rewriteCandidate, scriptSplitterName) { let programGenerationResult; switch (scriptSplitterName) { case "Script Splitter": console.log("Invoke script splitter"); programGenerationResult = await invokeScriptSplitter( - rewriteCandidate, - config, - getQRMs() + rewriteCandidate, + config, + getQRMs() ); break; default: programGenerationResult = { error: - "Unable to find suitable script splitter for: " + - scriptSplitterName, + "Unable to find suitable script splitter for: " + + scriptSplitterName, }; } return programGenerationResult; @@ -268,4 +270,3 @@ export default class AdaptationPlugin extends PureComponent { ); } } - diff --git a/components/bpmn-q/modeler-component/extensions/quantme/ui/splitting/WorkflowRewriter.js b/components/bpmn-q/modeler-component/extensions/quantme/ui/splitting/WorkflowRewriter.js index dcf4089c..15540aaa 100644 --- a/components/bpmn-q/modeler-component/extensions/quantme/ui/splitting/WorkflowRewriter.js +++ b/components/bpmn-q/modeler-component/extensions/quantme/ui/splitting/WorkflowRewriter.js @@ -75,11 +75,7 @@ export async function rewriteWorkflow( isExpanded: true, }); - modeling.createShape( - collapsedSubprocess, - { x: 50, y: 50 }, - parent - ); + modeling.createShape(collapsedSubprocess, { x: 50, y: 50 }, parent); let copyResult = copyElementsToParent( tempRootElement, @@ -97,7 +93,7 @@ export async function rewriteWorkflow( modeling, elementRegistry, collapsedSubprocess, - elementFactory + elementFactory ); modeling.removeShape(element); diff --git a/components/bpmn-q/modeler-component/extensions/quantme/utilities/Utilities.js b/components/bpmn-q/modeler-component/extensions/quantme/utilities/Utilities.js index 01043043..bc6ba8f7 100644 --- a/components/bpmn-q/modeler-component/extensions/quantme/utilities/Utilities.js +++ b/components/bpmn-q/modeler-component/extensions/quantme/utilities/Utilities.js @@ -155,6 +155,6 @@ export async function handleQrmUpload(qrmsActivities, modeler) { console.log("Iteration {}", tries); await new Promise((r) => setTimeout(r, 8000)); await updateQRMs(); - tries ++; + tries++; } }