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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: frontend/client/src/autotest/planner/triage/TriageViewPresenter.java
diff --git a/frontend/client/src/autotest/planner/triage/TriageViewPresenter.java b/frontend/client/src/autotest/planner/triage/TriageViewPresenter.java
new file mode 100644
index 0000000000000000000000000000000000000000..521220b0fab45605850f31b3094efef49d3374b6
--- /dev/null
+++ b/frontend/client/src/autotest/planner/triage/TriageViewPresenter.java
@@ -0,0 +1,67 @@
+package autotest.planner.triage;
+
+import autotest.common.JsonRpcCallback;
+import autotest.common.JsonRpcProxy;
+import autotest.planner.TestPlanSelector;
+
+import com.google.gwt.json.client.JSONArray;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONString;
+import com.google.gwt.json.client.JSONValue;
+
+public class TriageViewPresenter {
+
+ public interface Display {
+ public void setLoading(boolean loading);
+ public void clearAllFailureTables();
+ public FailureTable.Display generateFailureTable();
+ }
+
+ private TestPlanSelector selector;
+ private Display display;
+
+ public TriageViewPresenter(TestPlanSelector selector) {
+ this.selector = selector;
+ }
+
+ public void bindDisplay(Display display) {
+ this.display = display;
+ }
+
+ public void refresh() {
+ String planId = selector.getSelectedPlan();
+ if (planId == null) {
+ return;
+ }
+
+ display.setLoading(true);
+
+ JSONObject params = new JSONObject();
+ params.put("plan_id", new JSONString(planId));
+
+ JsonRpcProxy.getProxy().rpcCall("get_failures", params, new JsonRpcCallback() {
+ @Override
+ public void onSuccess(JSONValue result) {
+ display.clearAllFailureTables();
+ generateFailureTables(result.isObject());
+ display.setLoading(false);
+ }
+ });
+ }
+
+ private void generateFailureTables(JSONObject failures) {
+ for (String group : failures.keySet()) {
+ FailureTable table = new FailureTable(group);
+ FailureTable.Display tableDisplay = display.generateFailureTable();
+ table.bindDisplay(tableDisplay);
+
+ JSONArray groupFailures = failures.get(group).isArray();
+
+ for (int i = 0; i < groupFailures.size(); i++) {
+ table.addFailure(groupFailures.get(i).isObject());
+ }
+
+ table.renderDisplay();
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698