OLD | NEW |
1 package autotest.afe; | 1 package autotest.afe; |
2 | 2 |
3 import autotest.common.StaticDataRepository; | 3 import autotest.common.StaticDataRepository; |
4 import autotest.common.Utils; | 4 import autotest.common.Utils; |
5 import autotest.common.table.RpcDataSource; | 5 import autotest.common.table.RpcDataSource; |
6 import autotest.common.ui.NotifyManager; | 6 import autotest.common.ui.NotifyManager; |
7 | 7 |
8 import com.google.gwt.json.client.JSONArray; | 8 import com.google.gwt.json.client.JSONArray; |
9 import com.google.gwt.json.client.JSONObject; | 9 import com.google.gwt.json.client.JSONObject; |
10 import com.google.gwt.json.client.JSONString; | 10 import com.google.gwt.json.client.JSONString; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 protected List<JSONObject> handleJsonResult(JSONValue result) { | 46 protected List<JSONObject> handleJsonResult(JSONValue result) { |
47 List<JSONObject> queueEntries = super.handleJsonResult(result); | 47 List<JSONObject> queueEntries = super.handleJsonResult(result); |
48 List<JSONObject> rows = new ArrayList<JSONObject>(); | 48 List<JSONObject> rows = new ArrayList<JSONObject>(); |
49 Map<List<String>, JSONObject> metaHostEntries= new HashMap<List<String>,
JSONObject>(); | 49 Map<List<String>, JSONObject> metaHostEntries= new HashMap<List<String>,
JSONObject>(); |
50 for(JSONObject queueEntry : queueEntries) { | 50 for(JSONObject queueEntry : queueEntries) { |
51 // translate status | 51 // translate status |
52 String status = queueEntry.get("status").isString().stringValue(); | 52 String status = queueEntry.get("status").isString().stringValue(); |
53 String translation = translateStatus(status); | 53 String translation = translateStatus(status); |
54 queueEntry.put("status", new JSONString(translation)); | 54 queueEntry.put("status", new JSONString(translation)); |
55 | 55 |
56 JSONValue host = queueEntry.get("host"); | 56 boolean hasHost = (queueEntry.get("host").isNull() == null); |
57 if (host.isNull() != null) { | 57 boolean hasMetaHost = (queueEntry.get("meta_host") == null); |
| 58 |
| 59 if (!hasHost && !hasMetaHost) { |
| 60 queueEntry.put("hostname", new JSONString("(hostless)")); |
| 61 rows.add(queueEntry); |
| 62 |
| 63 } else if (!hasHost && hasMetaHost) { |
58 // metahost | 64 // metahost |
59 incrementMetaHostCount(metaHostEntries, queueEntry); | 65 incrementMetaHostCount(metaHostEntries, queueEntry); |
60 continue; | 66 } else { |
| 67 // non-metahost |
| 68 processHostData(queueEntry); |
| 69 rows.add(queueEntry); |
61 } | 70 } |
62 | |
63 // non-metahost | |
64 processHostData(queueEntry); | |
65 rows.add(queueEntry); | |
66 } | 71 } |
67 | 72 |
68 addMetaHostRows(metaHostEntries, rows); | 73 addMetaHostRows(metaHostEntries, rows); |
69 | 74 |
70 return rows; | 75 return rows; |
71 } | 76 } |
72 | 77 |
73 protected void processHostData(JSONObject queueEntry) { | 78 protected void processHostData(JSONObject queueEntry) { |
74 JSONObject host = queueEntry.get("host").isObject(); | 79 JSONObject host = queueEntry.get("host").isObject(); |
75 queueEntry.put("hostname", host.get("hostname")); | 80 queueEntry.put("hostname", host.get("hostname")); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 String label = Utils.jsonToString(entry.get("meta_host")); | 117 String label = Utils.jsonToString(entry.get("meta_host")); |
113 String status = Utils.jsonToString(entry.get("status")); | 118 String status = Utils.jsonToString(entry.get("status")); |
114 int count = entry.get("id_list").isArray().size(); | 119 int count = entry.get("id_list").isArray().size(); |
115 | 120 |
116 entry.put("hostname", new JSONString(label + " (label)")); | 121 entry.put("hostname", new JSONString(label + " (label)")); |
117 entry.put("status", new JSONString(Integer.toString(count) + " " + s
tatus)); | 122 entry.put("status", new JSONString(Integer.toString(count) + " " + s
tatus)); |
118 rows.add(entry); | 123 rows.add(entry); |
119 } | 124 } |
120 } | 125 } |
121 } | 126 } |
OLD | NEW |