Revision 30159
Added by Michele Artini about 10 years ago
modules/dnet-modular-workflows-ui/branches/ds-ui/src/main/java/eu/dnetlib/functionality/modular/ui/workflows/objects/NodeInfo.java | ||
---|---|---|
7 | 7 |
public class NodeInfo { |
8 | 8 |
private String name; |
9 | 9 |
private String description; |
10 |
private List<WorkflowParam> userParams; |
|
11 |
private List<WorkflowParam> systemParams; |
|
12 |
|
|
13 |
public NodeInfo(String name, String description, List<WorkflowParam> userParams, List<WorkflowParam> systemParams) { |
|
10 |
private List<WorkflowParam> params; |
|
11 |
|
|
12 |
public NodeInfo(String name, String description, List<WorkflowParam> params) { |
|
14 | 13 |
this.name = name; |
15 | 14 |
this.description = description; |
16 |
this.userParams = userParams; |
|
17 |
this.systemParams = systemParams; |
|
15 |
this.params = params; |
|
18 | 16 |
} |
19 | 17 |
|
20 | 18 |
public String getName() { |
... | ... | |
33 | 31 |
this.description = description; |
34 | 32 |
} |
35 | 33 |
|
36 |
public List<WorkflowParam> getUserParams() {
|
|
37 |
return userParams;
|
|
34 |
public List<WorkflowParam> getParams() { |
|
35 |
return params;
|
|
38 | 36 |
} |
39 | 37 |
|
40 |
public void setUserParams(List<WorkflowParam> userParams) {
|
|
41 |
this.userParams = userParams;
|
|
38 |
public void setParams(List<WorkflowParam> params) {
|
|
39 |
this.params = params;
|
|
42 | 40 |
} |
43 | 41 |
|
44 |
public List<WorkflowParam> getSystemParams() { |
|
45 |
return systemParams; |
|
46 |
} |
|
47 |
|
|
48 |
public void setSystemParams(List<WorkflowParam> systemParams) { |
|
49 |
this.systemParams = systemParams; |
|
50 |
} |
|
51 |
|
|
52 | 42 |
} |
modules/dnet-modular-workflows-ui/branches/ds-ui/src/main/java/eu/dnetlib/functionality/modular/ui/workflows/util/ISRegistryClient.java | ||
---|---|---|
40 | 40 |
log.error("Node " + info.getName() + " not found in profile " + profile); |
41 | 41 |
} else { |
42 | 42 |
node.selectSingleNode("./DESCRIPTION").setText(info.getDescription()); |
43 |
for (WorkflowParam param : info.getUserParams()) { |
|
44 |
final String val = (param.getValue() != null) ? param.getValue() : ""; |
|
45 |
node.selectSingleNode(".//PARAM[@name='" + param.getName() + "']").setText(val); |
|
43 |
for (WorkflowParam param : info.getParams()) { |
|
44 |
if (param.isUserParam()) { |
|
45 |
final String val = (param.getValue() != null) ? param.getValue() : ""; |
|
46 |
node.selectSingleNode(".//PARAM[@name='" + param.getName() + "']").setText(val); |
|
47 |
} |
|
46 | 48 |
} |
47 | 49 |
} |
48 | 50 |
|
modules/dnet-modular-workflows-ui/branches/ds-ui/src/main/java/eu/dnetlib/functionality/modular/ui/workflows/util/TransformerUtils.java | ||
---|---|---|
47 | 47 |
try { |
48 | 48 |
final SAXReader reader = new SAXReader(); |
49 | 49 |
final Document doc = reader.read(new StringReader(xml)); |
50 |
final List<WorkflowParam> userParams = Lists.newArrayList(); |
|
51 |
final List<WorkflowParam> systemParams = Lists.newArrayList(); |
|
50 |
final List<WorkflowParam> params = Lists.newArrayList(); |
|
52 | 51 |
|
53 | 52 |
for (Object o : doc.selectNodes("//PARAM")) { |
54 | 53 |
Node n = (Node) o; |
... | ... | |
57 | 56 |
String type = n.valueOf("@type"); |
58 | 57 |
String function = n.valueOf("@function"); |
59 | 58 |
String value = n.getText(); |
60 |
if ("user".equals(n.valueOf("@managedBy"))) { |
|
61 |
userParams.add(new WorkflowParam(key, value, required, type, function)); |
|
62 |
} else { |
|
63 |
systemParams.add(new WorkflowParam(key, value, required, type, function)); |
|
64 |
} |
|
59 |
boolean userParam = "user".equals(n.valueOf("@managedBy")); |
|
60 |
|
|
61 |
params.add(new WorkflowParam(key, value, required, userParam, type, function)); |
|
65 | 62 |
} |
66 | 63 |
String name = doc.valueOf("/NODE/@name"); |
67 | 64 |
String desc = doc.valueOf("//DESCRIPTION"); |
68 | 65 |
|
69 |
return new NodeInfo(name, desc, userParams, systemParams);
|
|
66 |
return new NodeInfo(name, desc, params);
|
|
70 | 67 |
} catch (Exception e) { |
71 | 68 |
log.error("Error parsing xml: " + xml, e); |
72 | 69 |
} |
73 |
return new NodeInfo("", "", new ArrayList<WorkflowParam>(), new ArrayList<WorkflowParam>());
|
|
70 |
return new NodeInfo("", "", new ArrayList<WorkflowParam>()); |
|
74 | 71 |
} |
75 | 72 |
}; |
76 | 73 |
|
modules/dnet-modular-workflows-ui/branches/ds-ui/src/main/java/eu/dnetlib/functionality/modular/ui/workflows/util/ISLookupClient.java | ||
---|---|---|
100 | 100 |
return TransformerUtils.toNodeInfo.apply(xml); |
101 | 101 |
} catch (Exception e) { |
102 | 102 |
log.error("Error accessing node " + nodeName + " of wf " + wfId, e); |
103 |
return new NodeInfo("", "", new ArrayList<WorkflowParam>(), new ArrayList<WorkflowParam>());
|
|
103 |
return new NodeInfo("", "", new ArrayList<WorkflowParam>()); |
|
104 | 104 |
} |
105 | 105 |
} |
106 | 106 |
|
... | ... | |
264 | 264 |
final String type = param.valueOf("@type"); |
265 | 265 |
final String function = param.valueOf("@function"); |
266 | 266 |
final String value = param.getText(); |
267 |
params.add(new WorkflowParam(key, value, required, type, function)); |
|
267 |
params.add(new WorkflowParam(key, value, required, true, type, function));
|
|
268 | 268 |
} |
269 | 269 |
res.add(new NodeWithUserParams(name, desc, params)); |
270 | 270 |
} |
modules/dnet-modular-workflows-ui/branches/ds-ui/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/workflows/common/atomwf.st | ||
---|---|---|
3 | 3 |
<div class="modal-content"> |
4 | 4 |
<div class="modal-header"> |
5 | 5 |
<button type="button" class="close" data-dismiss="modal">×</button> |
6 |
<h4 class="modal-title">Workflow: <i>{{currentWorkflow.name}}</i></h4>
|
|
6 |
<h4 class="modal-title"><b>Workflow:</b> <i>{{currentWorkflow.name}}</i></h4>
|
|
7 | 7 |
</div> |
8 | 8 |
<div class="modal-body text-center" style="height: 600px; overflow-y: auto; overflow-x: auto;"> |
9 | 9 |
<div ng-hide="currentNode"> |
10 |
<h4>Click on the nodes to inspect parameters</h4>
|
|
10 |
<h5>Click on the nodes to inspect parameters</h5>
|
|
11 | 11 |
<map name="processAtomicWorkflowMap" id="processAtomicWorkflowMap" ng-bind-html="to_trusted(currentWorkflow.mapContent)"></map> |
12 | 12 |
<img ng-src="{{currentWorkflow.imageUrl}}" usemap="#processAtomicWorkflowMap"/> |
13 | 13 |
</div> |
14 | 14 |
<div ng-show="currentNode"> |
15 |
<h4 class="modal-title">
|
|
16 |
{{currentNode.name}}
|
|
15 |
<h5>
|
|
16 |
<b>Node:</b> <i>{{currentNode.name}}</i>
|
|
17 | 17 |
<small ng-show="currentNode.description"><br /><b>Description:</b> <i>{{currentNode.description}}</i></small> |
18 |
</h4> |
|
19 |
|
|
18 |
</h5> |
|
19 |
<div ng-hide="currentNode.params.length > 0" style="margin-top: 20px;"> |
|
20 |
<i>No parameters</i> |
|
21 |
</div> |
|
20 | 22 |
<div class="text-left" style="margin-top: 20px;"> |
21 |
<div ng-repeat="p in currentNode.userParams" style="border-top: 1px solid #dadada; display: inline-block; padding: 4px; width: 100%;">
|
|
23 |
<div ng-repeat="p in currentNode.params" style="border-top: 1px solid #dadada; display: inline-block; padding: 4px; width: 100%;">
|
|
22 | 24 |
<div style="display: inline-block;"><b>{{p.name}}</b></div> |
23 | 25 |
<div class="pull-right text-success text-right" ng-show="!p.required || (p.value.length > 0 && verifyType(p.value, p.type))"> |
24 | 26 |
{{p.value}} |
25 |
<span class="glyphicon glyphicon-ok pull-right" style="margin-left: 8px"></span> |
|
27 |
<span class="glyphicon glyphicon-ok pull-right" style="margin-left: 8px" ng-class="{'glyphicon-ok' : p.userParam, 'glyphicon-cog' : !p.userParam}"></span>
|
|
26 | 28 |
</div> |
27 | 29 |
<div class="pull-right text-danger text-right" ng-show="p.value.length == 0 && p.required"> |
28 | 30 |
<i>Missing value</i> |
... | ... | |
33 | 35 |
<span class="glyphicon glyphicon-remove pull-right" style="margin-left: 8px"></span> |
34 | 36 |
</div> |
35 | 37 |
</div> |
36 |
<div ng-repeat="p in currentNode.systemParams" style="border-top: 1px solid #dadada; display: inline-block; padding: 4px; width: 100%;"> |
|
37 |
<div style="display: inline-block;"><b>{{p.name}}</b></div> |
|
38 |
<div class="pull-right text-success text-right" ng-show="!p.required || (p.value.length > 0 && verifyType(p.value, p.type))"> |
|
39 |
{{p.value}} |
|
40 |
<span class="glyphicon glyphicon-cog pull-right" style="margin-left: 8px"></span> |
|
41 |
</div> |
|
42 |
<div class="pull-right text-danger text-right" ng-show="p.value.length == 0 && p.required"> |
|
43 |
<i>Missing value</i> |
|
44 |
<span class="glyphicon glyphicon-remove pull-right" style="margin-left: 8px"></span> |
|
45 |
</div> |
|
46 |
<div class="pull-right text-danger text-right" ng-show="p.value.length > 0 && !verifyType(p.value, p.type)"> |
|
47 |
invalid type for <i>{{p.value}}</i>, required is <b>{{p.type}}</b> |
|
48 |
<span class="glyphicon glyphicon-remove pull-right" style="margin-left: 8px"></span> |
|
49 |
</div> |
|
50 |
</div> |
|
51 | 38 |
</div> |
52 | 39 |
<button class="btn btn-default btn-sm" style="margin: 30px" ng-click="currentNode = null">back</button> |
53 | 40 |
</div> |
Also available in: Unified diff
refactoring