-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add linter script and fix errors * Apply prettier * Add workflow executing linters * Add working directory for npm ci * Remove unknown working-directory from linting action * Update linting workflow * Fix linting command * Fix NOTICE file * Fix licence years * Fix name in Github workflow * Enable unused variable linting rule * Run prettier * Enable unnecessary espace rule * Add .eslintignore * Adapt path to public folder * Update ignore rules for linters * Lint changes after merging master * Start fixing Readme * Lint changes from merge * Lint master merge * Lint changes after merge with origin/master * Replace renderer with correct file * Lint changes * Lint changes * Run linter * Fix lint error * Add badges to readme * New diagram dialog (#89) * dialog for new diagram, isExecutable to true Co-Authored-By: LaviniaStiliadou <livia_16@live.de> * fix lint * adjust label for canceling dialog --------- Co-authored-by: SharonNaemi <naemi_17@live.de> Co-authored-by: mbeisel <beiselmn@gmail.com> * Fix plugin handling (#87) * fix plugin handling * fix lint * add plugin pattern * scale image * allow to select patterns * store patterns correctly with each button * allow drag & drop * align buttons horizontally * fix layout of button, add endpointurl * open modal to select algorithmic patterns * fix selecting patterns to algorithmic patterns * fix warning when setting endpoint * add error message when endpoint is incorrect * update text * remove unused classes, change icon * fix selected patterns for modal * modify selection modal * change position * add delete * add message to select algorithm pattern * fix edit * fix selected content * remove quantme from pattern plugin * change adaptation to pattern selection * remove files * fix layout * fix lint * return result * fix tests * adjust + button position * disable button if response is invalid * Fix comment for PatternConfigTab * Fix comments for config-manager.js * Change button style * Remove comment * Remove unused methods * Refactor http fetch function to general utility class * remove comments * Remove unused methods * Add copyright statements * Remove wrong comment * change icon * fix lint * Small changes for pattern intro text * Remove comma * Inline variables * Fix button naming * Move pattern categories to constants * Remove pattern.json * Update default config * Activate plugins for tests --------- Co-authored-by: Benjamin Weder <benjamin.weder@iaas.uni-stuttgart.de> Co-authored-by: SharonNaemi <naemi_17@live.de> Co-authored-by: mbeisel <beiselmn@gmail.com>
- Loading branch information
1 parent
ad62bca
commit b8980d7
Showing
21 changed files
with
1,088 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
components/bpmn-q/modeler-component/editor/util/HttpUtilities.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright (c) 2023 Institute of Architecture of Application Systems - | ||
* University of Stuttgart | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* Retrieves the Json data from the given endpoint. | ||
* | ||
* @param endpoint the endpoint to retrieve the data form | ||
* @returns | ||
*/ | ||
export async function fetchDataFromEndpoint(endpoint) { | ||
try { | ||
const response = await fetch(endpoint); | ||
if (!response.ok) { | ||
throw new Error(`HTTP error! Status: ${response.status}`); | ||
} | ||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.error("Error fetching data:", error); | ||
return {}; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
components/bpmn-q/modeler-component/extensions/pattern/Constants.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Copyright (c) 2023 Institute of Architecture of Application Systems - | ||
* University of Stuttgart | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
export const PATTERN_ALGORITHM = "algorithm"; | ||
export const PATTERN_BEHAVIORAL = "behavioral"; | ||
export const PATTERN_AUGMENTATION = "augmentation"; |
33 changes: 33 additions & 0 deletions
33
components/bpmn-q/modeler-component/extensions/pattern/PatternPlugin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright (c) 2023 Institute of Architecture of Application Systems - | ||
* University of Stuttgart | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from "react"; | ||
|
||
import PatternConfigTab from "./configTabs/PatternConfigTab"; | ||
import patternStyles from "./styling/pattern.css"; | ||
import PatternPluginButton from "./ui/PatternPluginButton"; | ||
|
||
/** | ||
* Plugin Object of the QuantME extension. Used to register the plugin in the plugin handler of the modeler. | ||
*/ | ||
export default { | ||
buttons: [<PatternPluginButton />], | ||
configTabs: [ | ||
{ | ||
tabId: "PatternTab", | ||
tabTitle: "Pattern Plugin", | ||
configTab: PatternConfigTab, | ||
}, | ||
], | ||
name: "pattern", | ||
extensionModule: [], | ||
styling: [patternStyles], | ||
}; |
77 changes: 77 additions & 0 deletions
77
components/bpmn-q/modeler-component/extensions/pattern/configTabs/PatternConfigTab.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* Copyright (c) 2023 Institute of Architecture of Application Systems - | ||
* University of Stuttgart | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { useState } from "react"; | ||
import { getModeler } from "../../../editor/ModelerHandler"; | ||
import * as config from "../framework-config/config-manager"; | ||
|
||
/** | ||
* React component specifying a tab for the configuration dialog of the modeler. The tab allows the user to change | ||
* configuration entries for the pattern plugin. | ||
* | ||
* @return {JSX.Element} The tab as a React component | ||
* @constructor | ||
*/ | ||
export default function PatternAtlasConfigTab() { | ||
const [patternAtlasEndpoint, setPatternAtlasEndpoint] = useState( | ||
config.getPatternAtlasEndpoint() | ||
); | ||
const modeler = getModeler(); | ||
|
||
const editorActions = modeler.get("editorActions"); | ||
const eventBus = modeler.get("eventBus"); | ||
|
||
// register editor action listener for changes in config entries | ||
if (!editorActions._actions.hasOwnProperty("patternAtlasEndpointChanged")) { | ||
editorActions.register({ | ||
patternAtlasEndpointChanged: function (patternAtlasEndpoint) { | ||
self.modeler.config.patternAtlasEndpoint = patternAtlasEndpoint; | ||
eventBus.fire("config.updated", self.modeler.config); | ||
}, | ||
}); | ||
} | ||
|
||
// save changed config entries on close | ||
PatternAtlasConfigTab.prototype.onClose = () => { | ||
modeler.config.patternAtlasEndpoint = patternAtlasEndpoint; | ||
config.setPatternAtlasEndpoint(patternAtlasEndpoint); | ||
}; | ||
|
||
return ( | ||
<> | ||
<h3>Pattern Plugin endpoint:</h3> | ||
<table> | ||
<tbody> | ||
<tr className="spaceUnder"> | ||
<td align="right">Pattern Atlas Endpoint</td> | ||
<td align="left"> | ||
<input | ||
className="qwm-input" | ||
type="string" | ||
name="patternAtlasEndpoint" | ||
value={patternAtlasEndpoint} | ||
onChange={(event) => | ||
setPatternAtlasEndpoint(event.target.value) | ||
} | ||
/> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</> | ||
); | ||
} | ||
|
||
PatternAtlasConfigTab.prototype.config = () => { | ||
const modeler = getModeler(); | ||
|
||
modeler.config.patternAtlasEndpoint = config.getPatternAtlasEndpoint(); | ||
}; |
44 changes: 44 additions & 0 deletions
44
components/bpmn-q/modeler-component/extensions/pattern/framework-config/config-manager.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (c) 2023 Institute of Architecture of Application Systems - | ||
* University of Stuttgart | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import defaultConfig from "./config"; | ||
import { getPluginConfig } from "../../../editor/plugin/PluginConfigHandler"; | ||
|
||
let config = {}; | ||
|
||
/** | ||
* Get the endpoint of the connected Pattern Atlas | ||
*/ | ||
export function getPatternAtlasEndpoint() { | ||
if (config.patternAtlasEndpoint === undefined) { | ||
setPatternAtlasEndpoint( | ||
getPluginConfig("pattern").patternAtlasEndpoint || | ||
defaultConfig.patternAtlasEndpoint | ||
); | ||
} | ||
return config.patternAtlasEndpoint; | ||
} | ||
|
||
/** | ||
* Set the endpoint of the connected Pattern Atlas | ||
*/ | ||
export function setPatternAtlasEndpoint(patternAtlasEndpoint) { | ||
if (patternAtlasEndpoint !== null && patternAtlasEndpoint !== undefined) { | ||
config.patternAtlasEndpoint = patternAtlasEndpoint; | ||
} | ||
} | ||
/** | ||
* Reset all saved endpoints and configuration values back to default or the value of the respective plugin config | ||
* by setting this.comfig to an empty js object. | ||
*/ | ||
export function resetConfig() { | ||
config = {}; | ||
} |
16 changes: 16 additions & 0 deletions
16
components/bpmn-q/modeler-component/extensions/pattern/framework-config/config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright (c) 2023 Institute of Architecture of Application Systems - | ||
* University of Stuttgart | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// takes either the environment variables or the default values defined in webpack.config | ||
const defaultConfig = { | ||
patternAtlasEndpoint: process.env.PATTERN_ATLAS_ENDPOINT, | ||
}; | ||
export default defaultConfig; |
14 changes: 14 additions & 0 deletions
14
components/bpmn-q/modeler-component/extensions/pattern/framework-config/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Copyright (c) 2023 Institute of Architecture of Application Systems - | ||
* University of Stuttgart | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import * as configManager from "./config-manager"; | ||
|
||
const config = configManager; | ||
export default config; |
Binary file added
BIN
+62.2 KB
components/bpmn-q/modeler-component/extensions/pattern/resources/pattern-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions
48
components/bpmn-q/modeler-component/extensions/pattern/resources/select_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.