Skip to content

Commit e6d0edb

Browse files
author
Kaushik Ghose
committed
Show important step properties in graph
Information about scatter and conditionals in the step are passed on to the workflow graph. The VS Code plugin shows this information in the preview pane. Scatter steps are marked with "S" and conditional steps are marked with "?". Hovering over a step will show the scatter variables and the conditional expression. Also refactor to rename "lines" variable to "line-numbers" which is more clear in the context of a graph output.
1 parent 40440d3 commit e6d0edb

File tree

7 files changed

+31
-9
lines changed

7 files changed

+31
-9
lines changed

benten/code/workflowgraph.py

+25-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def cwl_graph(cwl: dict):
1212
graph = {
1313
"nodes": [],
1414
"edges": [],
15-
"lines": {}
15+
"line-numbers": {}
1616
}
1717

1818
inputs = ListOrMap(cwl.get("inputs", {}), key_field="id", problems=[])
@@ -34,10 +34,32 @@ def _add_nodes(graph, grp, grp_id):
3434
graph["nodes"] += [{
3535
"id": k,
3636
"label": v.get("label", k) if isinstance(v, dict) else k,
37-
"title": v.get("label", k) if isinstance(v, dict) else k,
3837
"group": grp_id
3938
}]
40-
graph["lines"][k] = grp.get_range_for_value(k).start.line
39+
_mark_step_modifiers(graph["nodes"][-1], v)
40+
graph["line-numbers"][k] = grp.get_range_for_value(k).start.line
41+
42+
43+
def _mark_step_modifiers(node_data, node):
44+
if not isinstance(node, dict):
45+
return
46+
47+
code, title = "", []
48+
_scatter = node.get("scatter")
49+
_conditional = node.get("when")
50+
if _scatter:
51+
code += "S"
52+
title += [f"Scatter on {_scatter}"]
53+
if _conditional:
54+
code += "?"
55+
title += [f"Conditional on {_conditional}"]
56+
if code:
57+
node_data["icon"] = {
58+
"code": code,
59+
"color": "#ffffff"
60+
}
61+
if title:
62+
node_data["title"] = "<br/>".join(title)
4163

4264

4365
def _add_edges(graph, inputs, outputs, steps):

benten/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Copyright (c) 2019 Seven Bridges. See LICENSE
22

3-
__version__ = "2019.11.27"
3+
__version__ = "2019.12.03"

docs/developer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ CMD + Shift + P to bring up the command bar and then type "Reload Window".
3333

3434
```
3535
python3 setup.py sdist bdist_wheel
36-
twine upload dist/...
36+
twine upload dist/*
3737
```
3838

3939
### Release on VS Code Marketplace

media/2019.12.03/full-window.png

345 KB
Loading

vscode-client/Readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# VS Code plugin for Rabix/Benten CWL language server
22

3-
<img height="400px" src="https://raw.githubusercontent.com/rabix/benten/master/media/2019.10.22/full-window.png"></img>
3+
<img height="400px" src="https://raw.githubusercontent.com/rabix/benten/master/media/2019.12.03/full-window.png"></img>
44

55
- Syntax highlighting (CWL and JS)
66
- Evaluate expression on hover

vscode-client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"publisher": "sbg-rabix",
44
"displayName": "CWL (Rabix/Benten)",
55
"description": "Autocomplete, code validation and more for CWL documents",
6-
"version": "2019.11.27",
6+
"version": "2019.12.3",
77
"preview": false,
88
"icon": "benten-icon-128px.png",
99
"galleryBanner": {

vscode-client/src/extension.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function updateWebviewContent(panel: WebviewPanel, on_disk_files: [string, Uri])
209209
var edges = new vis.DataSet(${JSON.stringify(graph_data["edges"])})
210210
211211
// metadata for scrolling to nodes
212-
var lines = ${JSON.stringify(graph_data["lines"])}
212+
var line_numbers = ${JSON.stringify(graph_data["line-numbers"])}
213213
214214
// create a network
215215
var container = document.getElementById('cwl-graph');
@@ -276,7 +276,7 @@ function updateWebviewContent(panel: WebviewPanel, on_disk_files: [string, Uri])
276276
const node_id = params.nodes[0]
277277
vscode.postMessage({
278278
"uri": "${activeEditor.document.uri.toString()}",
279-
"line": lines[node_id]});
279+
"line": line_numbers[node_id]});
280280
});
281281
282282
</script>

0 commit comments

Comments
 (0)