Skip to content

Commit

Permalink
Fix transformation bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeisel committed Oct 19, 2023
1 parent eb02cbf commit 44a1d6c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function TransformationToolbarButton(props) {
if (tmp && tmp.status === "transformed") {
xml = tmp.xml;
} else {
// break process if one transformation failes
// break process if one transformation fails
const cause =
tmp.cause ||
"Transformation failed because of an unexpected error.";
Expand All @@ -84,13 +84,13 @@ export default function TransformationToolbarButton(props) {
content: cause,
duration: 10000,
});
return;
}
}
}
if (xml) {
// handle transformed workflow (open in new tab, save to file storage etc.)
await handleTransformedWorkflow(xml);
}
// handle transformed workflow (open in new tab, save to file storage etc.)
await handleTransformedWorkflow(xml);

} catch (error) {
NotificationHandler.getInstance().displayNotification({
type: "warning",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import * as consts from "../../Constants";
import { addExtensionElements } from "../../../../editor/util/camunda-utils/ExtensionElementsUtil";
import {
createTempModelerFromXml,
createModeler,
createTempModeler,
} from "../../../../editor/ModelerHandler";
import {
getPropertiesToCopy,
Expand All @@ -34,6 +34,7 @@ import {
getRootProcess,
} from "../../../../editor/util/ModellingUtilities";
import { getXml } from "../../../../editor/util/IoUtilities";
import NotificationHandler from "../../../../editor/ui/notifications/NotificationHandler";

/**
* Replace the given QuantumHardwareSelectionSubprocess by a native subprocess orchestrating the hardware selection
Expand Down Expand Up @@ -394,11 +395,21 @@ function addSelectionStrategyTask(
) {
console.log("Adding task for selection strategy: %s", selectionStrategy);

if (
selectionStrategy === undefined ||
!consts.SELECTION_STRATEGY_LIST.includes(selectionStrategy)
) {
console.log("Selection strategy not supported. Aborting!");
if ( selectionStrategy === undefined ) {
return addShortestQueueSelectionStrategy(
parent,
elementRegistry,
modeling
);
}
else if (!consts.SELECTION_STRATEGY_LIST.includes(selectionStrategy)) {
NotificationHandler.getInstance().displayNotification({
type: "info",
title: "Transformation Unsuccessful!",
content:
"The chosen selection strategy is not supported. Leave blank to use default strategy: Shortest-Queue",
duration: 7000,
});
return undefined;
}

Expand Down Expand Up @@ -436,7 +447,7 @@ async function getHardwareSelectionFragment(subprocess) {
console.log("Extracting workflow fragment from subprocess: ", subprocess);

// create new modeler to extract the XML of the workflow fragment
let modeler = createModeler();
let modeler = createTempModeler();
let elementRegistry = modeler.get("elementRegistry");
let bpmnReplace = modeler.get("bpmnReplace");
let modeling = modeler.get("modeling");
Expand Down

0 comments on commit 44a1d6c

Please sign in to comment.