added duplicate button

This commit is contained in:
David Mosbach 2023-05-28 12:55:54 +02:00
parent e48538d972
commit 3ce28ee25c
4 changed files with 27 additions and 7 deletions

View File

@ -95,6 +95,7 @@ body {
-webkit-user-select: none; -webkit-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
cursor: pointer;
} }
.contextmenu .menutop { .contextmenu .menutop {

View File

@ -28,7 +28,7 @@
<div id="sidepanel"> <div id="sidepanel">
<div id="sideheader"> <div id="sideheader">
<h1 id="sideheading">Hello</h1> <h1 id="sideheading">Hello</h1>
<svg height="15" width="15" xmlns="http://www.w3.org/2000/svg"> <svg height="15" width="15" xmlns="http://www.w3.org/2000/svg" onclick="deselect()">
<polyline points="1,1 14,14" style="fill:none;stroke:rgb(183, 76, 76);stroke-width:2" stroke-linecap="round" /> <polyline points="1,1 14,14" style="fill:none;stroke:rgb(183, 76, 76);stroke-width:2" stroke-linecap="round" />
<polyline points="14,1 1,14" style="fill:none;stroke:rgb(183, 76, 76);stroke-width:2" stroke-linecap="round" /> <polyline points="14,1 1,14" style="fill:none;stroke:rgb(183, 76, 76);stroke-width:2" stroke-linecap="round" />
X X
@ -70,6 +70,14 @@
</svg> </svg>
&nbsp;Edit &nbsp;Edit
</div> </div>
<div class="menucenter">
<svg height="10" width="10" xmlns="http://www.w3.org/2000/svg">
<rect width="5" height="5" x="1" y="4" style="fill:none;stroke:rgb(63, 63, 63);stroke-width:2"/>
<polyline points="4,4 4,1 9,1 9,6 5,6" style="fill:none;stroke:rgb(63, 63, 63);stroke-width:2" />
<!-- <polyline points="1,9 8,2" style="fill:none;stroke:rgb(63, 63, 63);stroke-width:2" stroke-linecap="round" /> -->
</svg>
&nbsp;Duplicate
</div>
<div class="menubottom" onclick="removeRightSelection()"> <div class="menubottom" onclick="removeRightSelection()">
<svg height="10" width="10" xmlns="http://www.w3.org/2000/svg"> <svg height="10" width="10" xmlns="http://www.w3.org/2000/svg">
<polyline points="1,1 9,9" style="fill:none;stroke:rgb(183, 76, 76);stroke-width:2" stroke-linecap="round" /> <polyline points="1,1 9,9" style="fill:none;stroke:rgb(183, 76, 76);stroke-width:2" stroke-linecap="round" />
@ -86,6 +94,14 @@
</svg> </svg>
&nbsp;Edit &nbsp;Edit
</div> </div>
<div class="menucenter">
<svg height="10" width="10" xmlns="http://www.w3.org/2000/svg">
<rect width="5" height="5" x="1" y="4" style="fill:none;stroke:rgb(63, 63, 63);stroke-width:2"/>
<polyline points="4,4 4,1 9,1 9,6 5,6" style="fill:none;stroke:rgb(63, 63, 63);stroke-width:2" />
<!-- <polyline points="1,9 8,2" style="fill:none;stroke:rgb(63, 63, 63);stroke-width:2" stroke-linecap="round" /> -->
</svg>
&nbsp;Duplicate
</div>
<div class="menubottom" onclick="removeRightSelection()"> <div class="menubottom" onclick="removeRightSelection()">
<svg height="10" width="10" xmlns="http://www.w3.org/2000/svg"> <svg height="10" width="10" xmlns="http://www.w3.org/2000/svg">
<polyline points="1,1 9,9" style="fill:none;stroke:rgb(183, 76, 76);stroke-width:2" stroke-linecap="round" /> <polyline points="1,1 9,9" style="fill:none;stroke:rgb(183, 76, 76);stroke-width:2" stroke-linecap="round" />

View File

@ -36,6 +36,7 @@ workflow.actions.forEach(action => {
var viewActors = []; var viewActors = [];
action.actionData['actor Viewers'].forEach(v => viewActors.push(new Role(v))); action.actionData['actor Viewers'].forEach(v => viewActors.push(new Role(v)));
action.actionData['actor Viewers'] = viewActors; action.actionData['actor Viewers'] = viewActors;
action.actionData.form = new Payload(action.actionData.form);
}) })
//Actors of the workflow //Actors of the workflow
@ -328,6 +329,11 @@ function rightSelect() {
select(rightSelection); select(rightSelection);
} }
function deselect() {
sidePanel.style.display = 'none';
selection = null;
}
/** /**
* Updates the nodes and edges of the workflow graph. * Updates the nodes and edges of the workflow graph.
@ -373,10 +379,7 @@ function removeRightSelection() {
if (rightSelection) { if (rightSelection) {
if (rightSelection.actionData) removeAction(rightSelection); if (rightSelection.actionData) removeAction(rightSelection);
else removeState(rightSelection); else removeState(rightSelection);
if (selection === rightSelection) { if (selection === rightSelection) deselect();
selection = null;
sidePanel.style.display = 'none';
}
rightSelection = null; rightSelection = null;
contextMenuEd.style.display = contextMenuSt.style.display = contextMenuBg.style.display = 'none'; contextMenuEd.style.display = contextMenuSt.style.display = contextMenuBg.style.display = 'none';
} }
@ -609,9 +612,8 @@ const Graph = ForceGraph()
}) })
.onBackgroundClick(_ => { .onBackgroundClick(_ => {
contextMenuEd.style.display = contextMenuSt.style.display = contextMenuBg.style.display = 'none'; contextMenuEd.style.display = contextMenuSt.style.display = contextMenuBg.style.display = 'none';
sidePanel.style.display = 'none'; deselect();
rightSelection = null; rightSelection = null;
selection = null;
}) })
.onBackgroundRightClick(event => { .onBackgroundRightClick(event => {
newStateCoords = Graph.screen2GraphCoords(event.layerX, event.layerY); newStateCoords = Graph.screen2GraphCoords(event.layerX, event.layerY);

View File

@ -74,6 +74,7 @@ class Payload {
constructor(json) { constructor(json) {
this.fields = []; this.fields = [];
if (json === null) return;
for (var f in json) { for (var f in json) {
this.fields.push(f); this.fields.push(f);
} }