Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
package org.ow2.proactive_grid_cloud_portal.rm.client;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;

Expand Down Expand Up @@ -139,11 +140,13 @@ Canvas build() {
this.nsDetails.setCanSelectText(true);
DetailViewerField n1 = new DetailViewerField("sourceName", "Node Source");
DetailViewerField n2 = new DetailViewerField("infrastructure", "Infrastructure");
DetailViewerField n3 = new DetailViewerField("policy", "Policy");
DetailViewerField n4 = new DetailViewerField("nodeProvider", "Owner");
DetailViewerField n5 = new DetailViewerField("hosts", "Hosts");
DetailViewerField n6 = new DetailViewerField("nodes", "Nodes");
this.nsDetails.setFields(n1, n2, n3, n4, n5, n6);
DetailViewerField n3 = new DetailViewerField("infrastructureParameters", "Infrastructure Params");
DetailViewerField n4 = new DetailViewerField("policy", "Policy");
DetailViewerField n5 = new DetailViewerField("policyParameters", "Policy Params");
DetailViewerField n6 = new DetailViewerField("nodeProvider", "Owner");
DetailViewerField n7 = new DetailViewerField("hosts", "Hosts");
DetailViewerField n8 = new DetailViewerField("nodes", "Nodes");
this.nsDetails.setFields(n1, n2, n3, n4, n5, n6, n7, n8);
// Define node source canvas and append sections
this.nsCanvas = new VLayout();
this.nsCanvas.setWidth100();
Expand Down Expand Up @@ -375,10 +378,13 @@ public void nodeSourceSelected(NodeSource ns) {
numNodes += h.getNodes().size();
}

// Infrastructure and policy description
String infrastructure = "NO INFRASTRUCTURE DESCRIPTION";
String policy = "NO POLICY DESCRIPTION";
String infrastructure = null;
String infrastructureParams = null;
String policy = null;
String policyParams = null;

String[] NSPolicyAndInfra = ns.getSourceDescription().split("Infrastructure: |, Policy: ");

if (NSPolicyAndInfra.length == 3) {
infrastructure = NSPolicyAndInfra[1].trim();
policy = NSPolicyAndInfra[2].trim();
Expand All @@ -388,8 +394,22 @@ public void nodeSourceSelected(NodeSource ns) {
policy = NSPolicyAndInfra[0].trim();
}

if (infrastructure != null) {
String[] result = splitAndExtractNameAndParamsFromDescription(infrastructure);
infrastructure = result[0];
infrastructureParams = result[1];
}

if (policy != null) {
String[] result = splitAndExtractNameAndParamsFromDescription(policy);
policy = result[0];
policyParams = result[1];
}

dv.setAttribute("infrastructure", infrastructure);
dv.setAttribute("infrastructureParameters", infrastructureParams);
dv.setAttribute("policy", policy);
dv.setAttribute("policyParameters", policyParams);
dv.setAttribute("sourceName", ns.getSourceName());
dv.setAttribute("nodeProvider", ns.getNodeSourceAdmin());
dv.setAttribute("nodes", numNodes);
Expand Down Expand Up @@ -451,4 +471,8 @@ public void hostSelected(Host h) {
this.selNS = null;
this.selNode = null;
}

private String[] splitAndExtractNameAndParamsFromDescription(String input) {
return input.split("[,\\s]+", 2);
}
}