Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/splitting #161

Merged
merged 28 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
eff9a54
add logic for script splitting
LaviniaStiliadou Jul 7, 2024
d1ecc7b
add icon, fix qrm upload
LaviniaStiliadou Jul 7, 2024
4af3c7d
fix icon of splitting candidate
LaviniaStiliadou Jul 7, 2024
68b6725
reorganize code
LaviniaStiliadou Jul 7, 2024
3c94b47
fix qrm handling
LaviniaStiliadou Jul 8, 2024
9ed0549
fix id and namespace
LaviniaStiliadou Jul 9, 2024
cc76ab9
fix data handling
LaviniaStiliadou Jul 10, 2024
3aebe51
fix qrm matching when updating id
LaviniaStiliadou Jul 10, 2024
fff9f05
fix config of repo path
LaviniaStiliadou Jul 11, 2024
236f561
fix error when combining script and pattern solutions
LaviniaStiliadou Jul 15, 2024
7a75383
fix qrm handling
LaviniaStiliadou Jul 15, 2024
5f7ee19
fix lint
LaviniaStiliadou Jul 15, 2024
473206d
fix that automatically updates qrms
mbeisel Jul 15, 2024
64c1e93
fix id mapping inside subprocess
LaviniaStiliadou Jul 15, 2024
b6b567b
Merge branch 'feature/splitting' of https://github.com/PlanQK/workflo…
LaviniaStiliadou Jul 15, 2024
26f3be2
set provider of execution task
LaviniaStiliadou Jul 15, 2024
93e6c59
update splitting logic
LaviniaStiliadou Jul 15, 2024
2cb872d
refactoring
mbeisel Jul 16, 2024
89ae61d
add fix for subprocess script analysis
mbeisel Jul 16, 2024
c2645b7
unify log for performance measurement
mbeisel Jul 17, 2024
7f3aeb3
update performance logs
mbeisel Jul 17, 2024
f26803c
update tosca check for qaa export
mbeisel Jul 17, 2024
21d4754
Improve logging
mbeisel Jul 17, 2024
7bb5b00
fix workflow rewrite
mbeisel Jul 19, 2024
936c38b
fix upload of qrms
LaviniaStiliadou Jul 21, 2024
5170ed2
remove code duplicate and add auto qrm update after patternselection
mbeisel Jul 22, 2024
f8df392
fix for runtime pattern combination
mbeisel Jul 31, 2024
c54a479
fix for runtime pattern combination
mbeisel Jul 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading