Skip to content

Commit 98dfaad

Browse files
author
Mark Robinson
committed
Displaying steps in workflows on output page
Currently only draft versions of CWL supported
1 parent f85b2b3 commit 98dfaad

File tree

5 files changed

+39
-23
lines changed

5 files changed

+39
-23
lines changed

src/main/java/org/commonwl/viewer/domain/CWLCollection.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,17 @@ private Map<String, CWLStep> getSteps(JsonNode cwlDoc) {
181181
if (steps.getClass() == ArrayNode.class) {
182182
// Explicit ID and other fields within each input list
183183
for (JsonNode step : steps) {
184-
String id = step.get("id").asText();
185-
CWLStep stepObject = new CWLStep(extractID(step), extractDoc(step),
184+
CWLStep stepObject = new CWLStep(extractLabel(step), extractDoc(step),
186185
extractTypes(step), getInputs(step), getOutputs(step));
187-
returnMap.put(id, stepObject);
186+
returnMap.put(extractID(step), stepObject);
188187
}
189188
} else if (steps.getClass() == ObjectNode.class) {
190189
// ID is the key of each object
191190
Iterator<Map.Entry<String, JsonNode>> iterator = steps.fields();
192191
while (iterator.hasNext()) {
193192
Map.Entry<String, JsonNode> stepNode = iterator.next();
194193
JsonNode stepJson = stepNode.getValue();
195-
CWLStep stepObject = new CWLStep(extractID(stepJson), extractDoc(stepJson),
194+
CWLStep stepObject = new CWLStep(extractLabel(stepJson), extractDoc(stepJson),
196195
extractTypes(stepJson), getInputs(stepJson), getOutputs(stepJson));
197196
returnMap.put(stepNode.getKey(), stepObject);
198197
}

src/main/java/org/commonwl/viewer/services/DotWriter.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,19 @@ private void writeSteps(Workflow workflow) throws IOException {
166166
// Write links between the remaining steps
167167
int defaultCount = 0;
168168
for (Map.Entry<String, CWLStep> step : workflow.getSteps().entrySet()) {
169-
for (Map.Entry<String, CWLElement> input : step.getValue().getInputs().entrySet()) {
170-
String sourceID = input.getValue().getSourceID();
171-
String defaultVal = input.getValue().getDefaultVal();
172-
if (sourceID != null) {
173-
writeLine(" \"" + sourceID + "\" -> \"" + step.getKey() + "\";");
174-
} else if (defaultVal != null) {
175-
defaultCount++;
176-
writeLine(" \"default" + defaultCount + "\" [label=\"" + defaultVal + "\", fillcolor=\"#D5AEFC\"]");
177-
writeLine(" \"default" + defaultCount + "\" -> \"" + step.getKey() + "\";");
169+
if (step.getValue().getInputs() != null) {
170+
for (Map.Entry<String, CWLElement> input : step.getValue().getInputs().entrySet()) {
171+
String sourceID = input.getValue().getSourceID();
172+
String defaultVal = input.getValue().getDefaultVal();
173+
if (sourceID != null) {
174+
// Regular link from source step to destination step
175+
writeLine(" \"" + sourceID + "\" -> \"" + step.getKey() + "\";");
176+
} else if (defaultVal != null) {
177+
// New node for a default value to be used as the source
178+
defaultCount++;
179+
writeLine(" \"default" + defaultCount + "\" [label=\"" + defaultVal + "\", fillcolor=\"#D5AEFC\"]");
180+
writeLine(" \"default" + defaultCount + "\" -> \"" + step.getKey() + "\";");
181+
}
178182
}
179183
}
180184
}

src/main/java/org/commonwl/viewer/services/WorkflowFactory.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.springframework.beans.factory.annotation.Autowired;
2828
import org.springframework.stereotype.Service;
2929

30-
import java.io.IOException;
3130
import java.util.Date;
3231

3332
@Service
@@ -37,15 +36,12 @@ public class WorkflowFactory {
3736

3837
private final GitHubService githubService;
3938
private final ROBundleFactory ROBundleFactory;
40-
private final WorkflowRepository workflowRepository;
4139

4240
@Autowired
4341
public WorkflowFactory(GitHubService githubService,
44-
ROBundleFactory ROBundleFactory,
45-
WorkflowRepository workflowRepository) {
42+
ROBundleFactory ROBundleFactory) {
4643
this.githubService = githubService;
4744
this.ROBundleFactory = ROBundleFactory;
48-
this.workflowRepository = workflowRepository;
4945
}
5046

5147
/**
@@ -77,7 +73,7 @@ public Workflow workflowFromGithub(GithubDetails githubInfo) {
7773
logger.error("No workflow could be found");
7874
}
7975
} catch (Exception ex) {
80-
logger.error(ex.getMessage());
76+
logger.error("Error creating workflow: " + ex.getMessage());
8177
}
8278

8379
return null;

src/main/resources/static/bower_components/graphviz-d3-renderer/.bower.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphviz-d3-renderer",
3-
"version": "0.9.20",
3+
"version": "0.9.21",
44
"dependencies": {
55
"requirejs": "2.1.15",
66
"d3": "3.5.3",
@@ -46,11 +46,11 @@
4646
"karma.conf.js"
4747
],
4848
"homepage": "https://github.com/mstefaniuk/graph-viz-d3-js",
49-
"_release": "0.9.20",
49+
"_release": "0.9.21",
5050
"_resolution": {
5151
"type": "version",
52-
"tag": "0.9.20",
53-
"commit": "077cadb3005a37e6c69a9873520dd3f8cde72206"
52+
"tag": "0.9.21",
53+
"commit": "9cba7e58b832f59e51271f8f98367ab676ef206f"
5454
},
5555
"_source": "https://github.com/mstefaniuk/graph-viz-d3-js.git",
5656
"_target": "^0.9.18",

src/main/resources/templates/workflow.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,23 @@ <h2>Outputs</h2>
167167
</tr>
168168
</tbody>
169169
</table>
170+
<h2>Steps</h2>
171+
<table class="table table-striped">
172+
<thead>
173+
<th>ID</th>
174+
<th>Type</th>
175+
<th>Label</th>
176+
<th>Doc</th>
177+
</thead>
178+
<tbody>
179+
<tr th:each="step : ${workflow.steps}">
180+
<td th:text="${step.key}">ID</td>
181+
<td th:text="${step.value.type}">Type</td>
182+
<td th:text="${step.value.label}">Label</td>
183+
<td th:text="${step.value.doc}">Description</td>
184+
</tr>
185+
</tbody>
186+
</table>
170187
</div>
171188
</div>
172189
</div>

0 commit comments

Comments
 (0)