Skip to content

Commit a54bcdb

Browse files
committed
Double click on graph goes to subworkflow if possible
1 parent 76fc390 commit a54bcdb

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/main/resources/static/js/workflow.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ require(['jquery', 'bootstrap.modal', 'svg-pan-zoom', 'hammerjs', 'jquery.svg'],
8787
this.hammer.on('pinchstart pinchmove', function(ev){
8888
// On pinch start remember initial zoom
8989
if (ev.type === 'pinchstart') {
90-
initialScale = instance.getZoom()
91-
instance.zoom(initialScale * ev.scale)
90+
initialScale = instance.getZoom();
91+
instance.zoom(initialScale * ev.scale);
9292
}
9393
instance.zoom(initialScale * ev.scale)
9494
});
@@ -115,6 +115,7 @@ require(['jquery', 'bootstrap.modal', 'svg-pan-zoom', 'hammerjs', 'jquery.svg'],
115115
function enablePanZoom() {
116116
var graph = svgPanZoom('#graph svg', {
117117
zoomEnabled: true,
118+
dblClickZoomEnabled: false,
118119
controlIconsEnabled: true,
119120
customEventsHandler: eventHandler
120121
});
@@ -163,7 +164,7 @@ require(['jquery', 'bootstrap.modal', 'svg-pan-zoom', 'hammerjs', 'jquery.svg'],
163164
});
164165
}, 100);
165166
});
166-
};
167+
}
167168
});
168169

169170
/**
@@ -291,7 +292,7 @@ require(['jquery', 'jquery.svg', 'jquery.svgdom'],
291292

292293
/**
293294
* Gets the corresponding table row for a graph box
294-
* @param trElement The graph box element
295+
* @param gbElement The graph box element
295296
* @return The table row(s)
296297
*/
297298
function getTableRow(gbElement) {
@@ -334,6 +335,14 @@ require(['jquery', 'jquery.svg', 'jquery.svgdom'],
334335
thisPolygon.toggleClass("selected");
335336
}
336337
},
338+
dblclick: function() {
339+
// Follow link to subworkflow if possible
340+
var matchingTableRow = getTableRow(this);
341+
var subworkflowLink = $(matchingTableRow).find("a.subworkflow");
342+
if (subworkflowLink.length > 0) {
343+
location.href = subworkflowLink.attr("href");
344+
}
345+
},
337346
mouseenter: function() {
338347
getTableRow(this).addClass("hover");
339348
$(this).find("polygon").addClass("hover");

src/main/resources/templates/workflow.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ <h2>Steps</h2>
230230
<td th:text="${step.key}">ID</td>
231231
<td>
232232
<div th:if="${step.value.runType != null}">
233-
<a th:if="${step.value.runType.name() == 'WORKFLOW'}" th:href="${step.value.run}" th:text="${step.value.run}">workflow.cwl</a>
233+
<a th:if="${step.value.runType.name() == 'WORKFLOW'}" th:href="${step.value.run}" th:text="${step.value.run}" class="subworkflow">workflow.cwl</a>
234234
<span th:unless="${step.value.runType.name() == 'WORKFLOW'}" th:text="${step.value.run}">cmdlinetool.cwl</span>
235235
(<span th:text="${step.value.runType}">Workflow</span>)
236236
</div>

0 commit comments

Comments
 (0)