Home | History | Annotate | Download | only in tko
      1 package autotest.tko;
      2 
      3 import autotest.common.Utils;
      4 import autotest.common.ui.SimpleDialog;
      5 import autotest.tko.TableView.TableViewConfig;
      6 
      7 import com.google.gwt.json.client.JSONObject;
      8 import com.google.gwt.user.client.ui.HTML;
      9 
     10 class MachineQualHistogram extends Plot {
     11     public MachineQualHistogram() {
     12         super("create_qual_histogram");
     13     }
     14 
     15     /**
     16      * drilldownParams contains:
     17      * * type: "normal", "not_applicable", or "empty"
     18      * for type "normal":
     19      *   * filterString: SQL filter for selected bucket
     20      * for type "not_applicable":
     21      *   * hosts: HTML list of hosts in this bucket
     22      */
     23     @Override
     24     protected void showDrilldownImpl(JSONObject drilldownParams) {
     25         String type = Utils.jsonToString(drilldownParams.get("type"));
     26         if (type.equals("normal")) {
     27             String filterString = Utils.jsonToString(drilldownParams.get("filterString"));
     28             showNormalDrilldown(filterString);
     29         } else if (type.equals("not_applicable")) {
     30             String hosts = Utils.jsonToString(drilldownParams.get("hosts"));
     31             showNADialog(hosts);
     32         } else if (type.equals("empty")) {
     33             showEmptyDialog();
     34         }
     35     }
     36 
     37     private void showNormalDrilldown(final String filterString) {
     38         CommonPanel.getPanel().setSqlCondition(filterString);
     39         listener.onSwitchToTable(TableViewConfig.PASS_RATE);
     40     }
     41 
     42     private void showNADialog(String hosts) {
     43         new SimpleDialog("Did not run any of the selected tests:", new HTML(hosts)).center();
     44     }
     45 
     46     private void showEmptyDialog() {
     47         new SimpleDialog("No hosts in this pass rate range", new HTML()).center();
     48     }
     49 }
     50