Skip to content

Commit

Permalink
Feature/splitting (#161)
Browse files Browse the repository at this point in the history
* add logic for script splitting

* add icon, fix qrm upload

* fix icon of splitting candidate

* reorganize code

* fix qrm handling

* fix id and namespace

* fix data handling

* fix qrm matching when updating id

* fix config of repo path

* fix error when combining script and pattern solutions

* fix qrm handling

* fix lint

* fix that automatically updates qrms

* fix id mapping inside subprocess

* set provider of execution task

* update splitting logic

* refactoring

* add fix for subprocess script analysis

* unify log for performance measurement

* update performance logs

* update tosca check for qaa export

* Improve logging

* fix workflow rewrite

* fix upload of qrms

* remove code duplicate and add auto qrm update after patternselection

* fix for runtime pattern combination

* fix for runtime pattern combination

---------

Co-authored-by: LaviniaStiliadou <livia_16@live.de>
Co-authored-by: mbeisel <beiselmn@gmail.com>
  • Loading branch information
3 people authored Jul 31, 2024
1 parent 8f79f4f commit 1a7d505
Show file tree
Hide file tree
Showing 36 changed files with 2,468 additions and 334 deletions.
11 changes: 11 additions & 0 deletions components/bpmn-q/modeler-component/editor/EditorConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,14 @@ export const INITIAL_DIAGRAM_XML =
" </bpmndi:BPMNPlane>\n" +
" </bpmndi:BPMNDiagram>\n" +
"</bpmn2:definitions>";

export const EMPTY_DIAGRAM_XML =
'<?xml version="1.0" encoding="UTF-8"?>\n' +
'<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">\n' +
' <bpmn2:process id="Process_1" isExecutable="true">\n' +
" </bpmn2:process>\n" +
' <bpmndi:BPMNDiagram id="BPMNDiagram_1">\n' +
' <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">\n' +
" </bpmndi:BPMNPlane>\n" +
" </bpmndi:BPMNDiagram>\n" +
"</bpmn2:definitions>";
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const defaultConfig = {
githubRepositoryPath: process.env.QRM_REPOPATH,
uploadGithubRepositoryName: process.env.UPLOAD_GITHUB_REPO,
uploadGithubRepositoryOwner: process.env.UPLOAD_GITHUB_USER,
uploadGithubRepositoryPath: process.env.UPLOAD_GITHUB_REPOPATH,
uploadFileName: process.env.UPLOAD_FILE_NAME,
uploadBranchName: process.env.UPLOAD_BRANCH_NAME,
};
Expand Down Expand Up @@ -383,6 +384,32 @@ export function setUploadBranchName(uploadBranchName) {
}
}

/**
* Get the local path to the folder in the repository containing the QRMs
*
* @return {string} the specified repository path
*/
export function getUploadGithubRepositoryPath() {
if (config.uploadGithubRepositoryPath === undefined) {
setUploadGithubRepositoryPath(
getPluginConfig("editor").uploadGithubRepositoryPath ||
defaultConfig.uploadGithubRepositoryPath
);
}
return config.uploadGithubRepositoryPath;
}

/**
* Set the local path to the folder in the repository containing the QRMs
*
* @param repositoryPath the repository path
*/
export function setUploadGithubRepositoryPath(repositoryPath) {
if (repositoryPath !== null && repositoryPath !== undefined) {
config.uploadGithubRepositoryPath = repositoryPath;
}
}

/**
* Resets the current editor configs
*/
Expand Down
29 changes: 29 additions & 0 deletions components/bpmn-q/modeler-component/editor/config/GitHubTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export default function GitHubTab() {
const [uploadBranchName, setUploadBranchName] = useState(
config.getUploadBranchName()
);
const [uploadGithubRepositoryPath, setUploadGithubRepositoryPath] = useState(
config.getUploadGithubRepositoryPath
);
const modeler = getModeler();

const editorActions = modeler.get("editorActions");
Expand Down Expand Up @@ -104,6 +107,14 @@ export default function GitHubTab() {
});
}

if (!editorActions._actions.hasOwnProperty("uploadGithubRepoPathChanged")) {
editorActions.register({
uploadGithubRepoPathChanged: function (uploadGithubRepoPath) {
self.modeler.config.uploadGithubRepositoryPath = uploadGithubRepoPath;
},
});
}

// save changed config entries on close
GitHubTab.prototype.onClose = () => {
modeler.config.githubRepositoryName = githubRepositoryName;
Expand All @@ -114,6 +125,7 @@ export default function GitHubTab() {
modeler.config.uploadGithubRepositoryOwner = uploadGithubOwner;
modeler.config.uploadFileName = uploadFileName;
modeler.config.uploadBranchName = uploadBranchName;
modeler.config.uploadGithubRepositoryPath = uploadGithubRepositoryPath;

config.setUploadGithubRepositoryName(uploadGithubRepositoryName);
config.setUploadGithubRepositoryOwner(uploadGithubOwner);
Expand All @@ -123,6 +135,7 @@ export default function GitHubTab() {
config.setQRMUserName(githubUsername);
config.setQRMRepositoryPath(githubRepositoryPath);
config.setGitHubToken(githubToken);
config.setUploadGithubRepositoryPath(uploadGithubRepositoryPath);
};

return (
Expand Down Expand Up @@ -237,6 +250,20 @@ export default function GitHubTab() {
/>
</td>
</tr>
<tr className="spaceUnder">
<td align="right">GitHub Repository Path:</td>
<td align="left">
<input
className="qwm-input"
type="string"
name="uploadGithubRepositoryPath"
value={uploadGithubRepositoryPath}
onChange={(event) =>
setUploadGithubRepositoryPath(event.target.value)
}
/>
</td>
</tr>
<tr className="spaceUnder">
<td align="right">Workflow File Name:</td>
<td align="left">
Expand Down Expand Up @@ -269,4 +296,6 @@ GitHubTab.prototype.config = () => {
config.getUploadGithubRepositoryOwner();
modeler.config.uploadFileName = config.getUploadFileName();
modeler.config.uploadBranchName = config.getUploadBranchName();
modeler.config.uploadGithubRepositoryPath =
config.getUploadGithubRepositoryPath();
};
20 changes: 0 additions & 20 deletions components/bpmn-q/modeler-component/editor/plugin/PluginHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,26 +122,6 @@ export function getAdditionalModules() {
return modules;
}

/**
* Returns all css style modules the active plugins define in their styling property as an array.
*
* @returns {*[]} Array of css style modules defined by the active plugins.
*/
export function getStyles() {
let styles = [];

// load css styles of the active plugins
for (let plugin of getActivePlugins()) {
if (plugin.styling) {
styles = styles.concat(plugin.styling);
}
}

console.log("\n Get Plugin Styling");
console.log(styles);
return styles;
}

/**
* Returns an objects with all moddle extensions for the bpmn-js modeler the active plugins define in their moddleDescription property.
* The returned object contains a property for each plugin with its name and the moddle extension as value.
Expand Down
19 changes: 16 additions & 3 deletions components/bpmn-q/modeler-component/editor/util/IoUtilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } 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";
Expand Down Expand Up @@ -592,6 +592,7 @@ export async function saveQAA(
views,
qaaFileName = editorConfig.getFileName()
) {
let startTimeStepH = Date.now();
console.log("Storing QAA for workflow with name: ", qaaFileName);
let suggestedName = qaaFileName;
if (suggestedName.includes(saveFileFormats.BPMN)) {
Expand All @@ -614,7 +615,15 @@ export async function saveQAA(
}

// Add CSARs to Zip if OpenTOSCA plugin is enabled
if (checkEnabledStatus(pluginNames.OPENTOSCA)) {
let openToscaActive = false;
for (let plugin of getActivePlugins()) {
console.log(plugin.name);
if (plugin.name === pluginNames.OPENTOSCA) {
openToscaActive = true;
}
}

if (openToscaActive) {
console.log("OpenTOSCA plugin is enabled. Adding CSARs to QAA...");
const deploymentModelFolder = zip.folder("deployment-models");

Expand All @@ -634,7 +643,9 @@ export async function saveQAA(
csarUrl = csarUrl.replace("{{ wineryEndpoint }}", getWineryEndpoint());
}
console.log("Downloading CSAR from URL: ", csarUrl);
const csar = await (await fetch(csarUrl)).blob();
const result = await fetch(csarUrl);
console.log(result);
const csar = await result.blob();
console.log("CSAR: ", csar);

// store CSAR in zip file
Expand Down Expand Up @@ -667,6 +678,8 @@ export async function saveQAA(
xml,
editorConfig.getFileName()
);
const elapsedTimeStepH = Date.now() - startTimeStepH;
console.log(`Time taken for step H: ${elapsedTimeStepH}ms`);
}

function getTimestamp() {
Expand Down
Loading

0 comments on commit 1a7d505

Please sign in to comment.