Skip to content

Commit

Permalink
Implement changes suggested in review
Browse files Browse the repository at this point in the history
  • Loading branch information
lokmanfl committed Oct 1, 2023
1 parent 892bada commit 2028743
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 30 deletions.
2 changes: 0 additions & 2 deletions .vscode/settings.json

This file was deleted.

11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ ARG ENABLE_PLANQK_PLUGIN
ARG ENABLE_QHANA_PLUGIN
ARG ENABLE_QUANTME_PLUGIN
ARG ENABLE_OPENTOSCA_PLUGIN
ARG AUTOSAVE_INTERVAL
ARG CAMUNDA_ENDPOINT
ARG DOWNLOAD_FILE_NAME
ARG GITHUB_TOKEN
ARG QHANA_LIST_PLUGINS_URL
ARG SERVICE_DATA_CONFIG
ARG UPLOAD_BRANCH_NAME
ARG UPLOAD_FILE_NAME
ARG UPLOAD_GITHUB_REPO
ARG UPLOAD_GITHUB_USER

RUN env
RUN npm run build -- --mode=production

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ to start the modeler in a simple html website which runs on localhost:8080.
## Execution in Docker
To serve the application from a Docker container execute:
```
docker run --name workflow-modeler -p 8080:8080 ghcr.io/sequenc-consortium/workflow-modeler
docker run --name workflow-modeler -p 8080:8080 planqk/workflow-modeler
```
Afterwards the application is available in a browser on localhost:8080

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PlanQKPlugin from '../../extensions/planqk/PlanQKPlugin';
import QuantMEPlugin from '../../extensions/quantme/QuantMEPlugin';
import OpenToscaPlugin from "../../extensions/opentosca/OpenTOSCAPlugin";
import OpenTOSCAPlugin from "../../extensions/opentosca/OpenTOSCAPlugin";
import DataFlowPlugin from '../../extensions/data-extension/DataFlowPlugin';
import QHAnaPlugin from '../../extensions/qhana/QHAnaPlugin';
import { getAllConfigs } from './PluginConfigHandler';
Expand Down Expand Up @@ -32,7 +32,7 @@ const PLUGINS = [
dependencies: []
},
{
plugin: OpenToscaPlugin,
plugin: OpenTOSCAPlugin,
dependencies: []
}
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React from "react";

import OpenTOSCATab from "./configTabs/OpenTOSCATab";

import opentoscaStyles from './styling/opentosca.css';
import OpenTOSCAStyles from './styling/opentosca.css';
import DeploymentPlugin from "./ui/deployment/services/DeploymentPlugin";
import OpenToscaExtensionModule from "./modeling";
let openToscaModdleExtension = require('./resources/opentosca4bpmn.json');
import OpenTOSCAExtensionModule from "./modeling";
let OpenTOSCAModdleExtension = require('./resources/opentosca4bpmn.json');


/**
Expand All @@ -20,8 +20,8 @@ export default {
configTab: OpenTOSCATab,
}
],
extensionModule: OpenToscaExtensionModule,
moddleDescription: openToscaModdleExtension,
extensionModule: OpenTOSCAExtensionModule,
moddleDescription: OpenTOSCAModdleExtension,
name: 'opentosca',
styling: [opentoscaStyles]
styling: [OpenTOSCAStyles]
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Institute of Architecture of Application Systems -
* Copyright (c) 2023 Institute of Architecture of Application Systems -
* University of Stuttgart
*
* This program and the accompanying materials are made available under the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ export async function createServiceTemplate(name) {
return response.text();
}

export async function deleteArtifactTemplate(artifactTemplateName) {
// /artifacttemplates/http%253A%252F%252Fquantil.org%252Fquantme%252Fpush%252Fartifacttemplates/ArtifactTemplate-Activity_01b3qkz/
const response = await fetch(`${getWineryEndpoint()}/artifacttemplates/${encodeURIComponent(encodeURIComponent(QUANTME_NAMESPACE_PUSH + '/'))}artifacttemplates/${encodeURIComponent(encodeURIComponent(artifactTemplateName))}`, {
method: 'DELETE',
headers: {
'Accept': 'application/json'
},
});
return response.status === 204;
}

export async function serviceTemplateExists(serviceTemplateName) {
const response = await fetch(`${getWineryEndpoint()}/servicetemplates/${encodeURIComponent(encodeURIComponent(QUANTME_NAMESPACE_PUSH))}/${encodeURIComponent(encodeURIComponent(serviceTemplateName))}`, {
method: 'GET',
});
return response.status === 200;
}

export async function addNodeWithArtifactToServiceTemplateByName(serviceTemplateName, nodeTypeQName, name, artifactTemplateQName, artifactName, artifactTypeQName) {
const serviceTemplateAddress = encodeURIComponent(encodeURIComponent(QUANTME_NAMESPACE_PUSH)) + '/' + encodeURIComponent(encodeURIComponent(serviceTemplateName)) + '/';
await addNodeWithArtifactToServiceTemplate(serviceTemplateAddress, nodeTypeQName, name, artifactTemplateQName, artifactName, artifactTypeQName);
return serviceTemplateAddress;
}

export async function addNodeToServiceTemplate(serviceTemplateAddress, nodeTypeQName, name) {
const nodeTemplate = {
"documentation": [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Institute of Architecture of Application Systems -
* Copyright (c) 2023 Institute of Architecture of Application Systems -
* University of Stuttgart
*
* This program and the accompanying materials are made available under the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Institute of Architecture of Application Systems -
* Copyright (c) 2023 Institute of Architecture of Application Systems -
* University of Stuttgart
*
* This program and the accompanying materials are made available under the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Institute of Architecture of Application Systems -
* Copyright (c) 2023 Institute of Architecture of Application Systems -
* University of Stuttgart
*
* This program and the accompanying materials are made available under the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Institute of Architecture of Application Systems -
* Copyright (c) 2023 Institute of Architecture of Application Systems -
* University of Stuttgart
*
* This program and the accompanying materials are made available under the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import {
createServiceTemplateWithNodeAndArtifact,
getNodeTypeQName,
getArtifactTemplateInfo,
insertTopNodeTag
insertTopNodeTag,
serviceTemplateExists,
addNodeWithArtifactToServiceTemplateByName,
deleteArtifactTemplate
} from '../../deployment/WineryUtils';
import NotificationHandler from '../../../../editor/ui/notifications/NotificationHandler';
import {getWineryEndpoint} from "../../framework-config/config-manager";
Expand Down Expand Up @@ -78,14 +81,22 @@ export default function ArtifactUploadModal({onClose, element, commandStack}) {
try {
const namePrefix = element.businessObject.name ?? "";
const artifactTemplateName = `${namePrefix}ArtifactTemplate-${element.id}`;
await deleteArtifactTemplate(artifactTemplateName);
const artifactTemplateAddress = await createArtifactTemplateWithFile(artifactTemplateName, selectedOption, uploadFile);
const artifactTemplateInfo = await getArtifactTemplateInfo(artifactTemplateAddress);
const artifactTemplateQName = artifactTemplateInfo.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].type;
const nodeTypeQName = getNodeTypeQName(selectedOption);
const serviceTemplateName = `${namePrefix}ServiceTemplate-${element.id}`;
serviceTemplateAddress = await createServiceTemplateWithNodeAndArtifact(serviceTemplateName, nodeTypeQName,
`${namePrefix}Node-${element.id}`, artifactTemplateQName,
`${namePrefix}Artifact-${element.id}`, selectedOption);
const doesExist = await serviceTemplateExists(serviceTemplateName);
if(doesExist) {
serviceTemplateAddress = await addNodeWithArtifactToServiceTemplateByName(serviceTemplateName, nodeTypeQName,
`${namePrefix}Node-${element.id}`, artifactTemplateQName,
`${namePrefix}Artifact-${element.id}`, selectedOption);
} else {
serviceTemplateAddress = await createServiceTemplateWithNodeAndArtifact(serviceTemplateName, nodeTypeQName,
`${namePrefix}Node-${element.id}`, artifactTemplateQName,
`${namePrefix}Artifact-${element.id}`, selectedOption);
}
await insertTopNodeTag(serviceTemplateAddress, nodeTypeQName);
} catch (e) {
setTimeout(closeNotification, 1);
Expand All @@ -106,10 +117,11 @@ export default function ArtifactUploadModal({onClose, element, commandStack}) {
}
});
setTimeout(closeNotification, 1);
const content = doesExist ? 'updated' : 'created';
NotificationHandler.getInstance().displayNotification({
type: 'info',
title: 'Service Template Created',
content: 'Service Template including Nodetype with attached Deployment Artifact of chosen type was successfully created.',
title: 'Service Template ' + content.charAt(0).toUpperCase() + content.slice(1),
content: 'Service Template including Nodetype with attached Deployment Artifact of chosen type was successfully ' + content + '.',
duration: 4000
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Institute of Architecture of Application Systems -
* Copyright (c) 2023 Institute of Architecture of Application Systems -
* University of Stuttgart
*
* This program and the accompanying materials are made available under the
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Institute of Architecture of Application Systems -
* Copyright (c) 2023 Institute of Architecture of Application Systems -
* University of Stuttgart
*
* This program and the accompanying materials are made available under the
Expand Down
10 changes: 5 additions & 5 deletions components/bpmn-q/test/tests/opentosca/opentosca-config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import {setPluginConfig} from '../../../modeler-component/editor/plugin/PluginCo
import {expect} from 'chai';
import * as opentoscaConfig from '../../../modeler-component/extensions/opentosca/framework-config/config-manager';

describe('Test OpenTosca ConfigManager', function () {
describe('Test OpenTOSCA ConfigManager', function () {

describe('Test OpenTosca endpoint', function () {
describe('Test OpenTOSCA endpoint', function () {

before('Reset OpenTosca configuration', function () {
before('Reset OpenTOSCA configuration', function () {
opentoscaConfig.resetConfig();
});

afterEach('Reset OpenTosca configuration', function () {
afterEach('Reset OpenTOSCA configuration', function () {
opentoscaConfig.resetConfig();
});

it('Should configure OpenTosca endpoints', function () {
it('Should configure OpenTOSCA endpoints', function () {
setPluginConfig([
{
name: 'opentosca',
Expand Down

0 comments on commit 2028743

Please sign in to comment.