Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: frontend/client/src/autotest/planner/triage/TriageViewPresenter.java

Issue 1595019: Merge remote branch 'origin/upstream' into tempbranch (Closed)
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 package autotest.planner.triage;
2
3 import autotest.common.JsonRpcCallback;
4 import autotest.common.JsonRpcProxy;
5 import autotest.planner.TestPlanSelector;
6
7 import com.google.gwt.json.client.JSONArray;
8 import com.google.gwt.json.client.JSONObject;
9 import com.google.gwt.json.client.JSONString;
10 import com.google.gwt.json.client.JSONValue;
11
12 public class TriageViewPresenter {
13
14 public interface Display {
15 public void setLoading(boolean loading);
16 public void clearAllFailureTables();
17 public FailureTable.Display generateFailureTable();
18 }
19
20 private TestPlanSelector selector;
21 private Display display;
22
23 public TriageViewPresenter(TestPlanSelector selector) {
24 this.selector = selector;
25 }
26
27 public void bindDisplay(Display display) {
28 this.display = display;
29 }
30
31 public void refresh() {
32 String planId = selector.getSelectedPlan();
33 if (planId == null) {
34 return;
35 }
36
37 display.setLoading(true);
38
39 JSONObject params = new JSONObject();
40 params.put("plan_id", new JSONString(planId));
41
42 JsonRpcProxy.getProxy().rpcCall("get_failures", params, new JsonRpcCallb ack() {
43 @Override
44 public void onSuccess(JSONValue result) {
45 display.clearAllFailureTables();
46 generateFailureTables(result.isObject());
47 display.setLoading(false);
48 }
49 });
50 }
51
52 private void generateFailureTables(JSONObject failures) {
53 for (String group : failures.keySet()) {
54 FailureTable table = new FailureTable(group);
55 FailureTable.Display tableDisplay = display.generateFailureTable();
56 table.bindDisplay(tableDisplay);
57
58 JSONArray groupFailures = failures.get(group).isArray();
59
60 for (int i = 0; i < groupFailures.size(); i++) {
61 table.addFailure(groupFailures.get(i).isObject());
62 }
63
64 table.renderDisplay();
65 }
66 }
67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698