135444864c7b6f49865a7e17aa0052987b72e4728showardpackage autotest.tko; 235444864c7b6f49865a7e17aa0052987b72e4728showard 335444864c7b6f49865a7e17aa0052987b72e4728showardimport autotest.common.JsonRpcCallback; 435444864c7b6f49865a7e17aa0052987b72e4728showardimport autotest.common.JsonRpcProxy; 535444864c7b6f49865a7e17aa0052987b72e4728showardimport autotest.common.Utils; 6c674d3ea684f75f3e05f5834b598050eb1c8856dshowardimport autotest.common.CustomHistory.HistoryToken; 7b852bce914dc3ae05b26f3655bfb437ffed001bejamesrenimport autotest.common.spreadsheet.Spreadsheet; 8b852bce914dc3ae05b26f3655bfb437ffed001bejamesrenimport autotest.common.spreadsheet.SpreadsheetSelectionManager; 9b852bce914dc3ae05b26f3655bfb437ffed001bejamesrenimport autotest.common.spreadsheet.Spreadsheet.CellInfo; 10b852bce914dc3ae05b26f3655bfb437ffed001bejamesrenimport autotest.common.spreadsheet.Spreadsheet.SpreadsheetListener; 1135444864c7b6f49865a7e17aa0052987b72e4728showardimport autotest.common.ui.ContextMenu; 1235444864c7b6f49865a7e17aa0052987b72e4728showardimport autotest.common.ui.NotifyManager; 1335444864c7b6f49865a7e17aa0052987b72e4728showardimport autotest.common.ui.TableActionsPanel; 143d6ae118f69717e68bc15b9aed7b6a6c7dd9bab0showardimport autotest.common.ui.TableActionsPanel.TableActionsWithExportCsvListener; 159dbdcda5104991cbf344ea5cba1aa58e1af444f3showardimport autotest.common.ui.TableSelectionPanel.SelectionPanelListener; 160c31bc5ef2ecdf8edf19468e1a373520110f5bc6showardimport autotest.tko.CommonPanel.CommonPanelListener; 17ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport autotest.tko.TableView.TableSwitchListener; 18ce12f55f4530950f7fc6ddc73d1867ebb954d356showardimport autotest.tko.TableView.TableViewConfig; 19a397e604073b2c8d77aab5b97fe8966dcfd40a24jamesrenimport autotest.tko.TkoSpreadsheetUtils.DrilldownType; 2035444864c7b6f49865a7e17aa0052987b72e4728showard 21a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showardimport com.google.gwt.event.dom.client.ClickEvent; 22a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showardimport com.google.gwt.event.dom.client.ClickHandler; 2379a7b0d387aac103fc1d125353eefa361030452ashowardimport com.google.gwt.event.logical.shared.ResizeEvent; 2479a7b0d387aac103fc1d125353eefa361030452ashowardimport com.google.gwt.event.logical.shared.ResizeHandler; 250d92da0fe19a095fc5678c4159e6a1756df65e48showardimport com.google.gwt.event.logical.shared.ValueChangeEvent; 260d92da0fe19a095fc5678c4159e6a1756df65e48showardimport com.google.gwt.event.logical.shared.ValueChangeHandler; 2735444864c7b6f49865a7e17aa0052987b72e4728showardimport com.google.gwt.json.client.JSONArray; 2835444864c7b6f49865a7e17aa0052987b72e4728showardimport com.google.gwt.json.client.JSONObject; 29d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshowardimport com.google.gwt.json.client.JSONString; 3035444864c7b6f49865a7e17aa0052987b72e4728showardimport com.google.gwt.json.client.JSONValue; 3135444864c7b6f49865a7e17aa0052987b72e4728showardimport com.google.gwt.user.client.Command; 3235444864c7b6f49865a7e17aa0052987b72e4728showardimport com.google.gwt.user.client.Event; 33c674d3ea684f75f3e05f5834b598050eb1c8856dshowardimport com.google.gwt.user.client.History; 3435444864c7b6f49865a7e17aa0052987b72e4728showardimport com.google.gwt.user.client.Window; 358a7f36583afe076a7198d1b34fe109aa491dc277jamesrenimport com.google.gwt.user.client.ui.Anchor; 3635444864c7b6f49865a7e17aa0052987b72e4728showardimport com.google.gwt.user.client.ui.Button; 3735444864c7b6f49865a7e17aa0052987b72e4728showardimport com.google.gwt.user.client.ui.CheckBox; 3835444864c7b6f49865a7e17aa0052987b72e4728showardimport com.google.gwt.user.client.ui.HTML; 3935444864c7b6f49865a7e17aa0052987b72e4728showardimport com.google.gwt.user.client.ui.MenuBar; 408a6eb0cf5777dded2354408e8007d9223e813c92showardimport com.google.gwt.user.client.ui.Panel; 419e494cc00c53f9dd0fabec3ef675cb874a9130adshowardimport com.google.gwt.user.client.ui.SimplePanel; 428a6eb0cf5777dded2354408e8007d9223e813c92showardimport com.google.gwt.user.client.ui.VerticalPanel; 4335444864c7b6f49865a7e17aa0052987b72e4728showard 4435444864c7b6f49865a7e17aa0052987b72e4728showardimport java.util.HashMap; 4535444864c7b6f49865a7e17aa0052987b72e4728showardimport java.util.List; 4635444864c7b6f49865a7e17aa0052987b72e4728showardimport java.util.Map; 4735444864c7b6f49865a7e17aa0052987b72e4728showard 488a7f36583afe076a7198d1b34fe109aa491dc277jamesrenpublic class SpreadsheetView extends ConditionTabView 498a7f36583afe076a7198d1b34fe109aa491dc277jamesren implements SpreadsheetListener, TableActionsWithExportCsvListener, 509dbdcda5104991cbf344ea5cba1aa58e1af444f3showard CommonPanelListener, SelectionPanelListener { 518a6eb0cf5777dded2354408e8007d9223e813c92showard private static final String HISTORY_ONLY_LATEST = "show_only_latest"; 5235444864c7b6f49865a7e17aa0052987b72e4728showard public static final String DEFAULT_ROW = "kernel"; 5335444864c7b6f49865a7e17aa0052987b72e4728showard public static final String DEFAULT_COLUMN = "platform"; 54e463a8a926964673c2517bfef5ac394206b106c6showard public static final String DEFAULT_DRILLDOWN = "job_tag"; 558a7f36583afe076a7198d1b34fe109aa491dc277jamesren 568c9b839c2f5073a755952a8a865a04db3b2d4547showard private static final String HISTORY_SHOW_INCOMPLETE = "show_incomplete"; 578c9b839c2f5073a755952a8a865a04db3b2d4547showard private static final String HISTORY_COLUMN = "column"; 588c9b839c2f5073a755952a8a865a04db3b2d4547showard private static final String HISTORY_ROW = "row"; 59194a59d6976a5dbd5b464fb2b14ceb089f91c050showard private static final String HISTORY_CONTENT = "content"; 608a7f36583afe076a7198d1b34fe109aa491dc277jamesren 6135444864c7b6f49865a7e17aa0052987b72e4728showard private static JsonRpcProxy rpcProxy = JsonRpcProxy.getProxy(); 62e732ee7d450b11261c82df0950fde8e02f839b26showard private static JsonRpcProxy afeRpcProxy = JsonRpcProxy.getProxy(JsonRpcProxy.AFE_BASE_URL); 63ce12f55f4530950f7fc6ddc73d1867ebb954d356showard private TableSwitchListener listener; 6435444864c7b6f49865a7e17aa0052987b72e4728showard protected Map<String,String[]> drilldownMap = new HashMap<String,String[]>(); 658b0ea2285c1327a686ff0b6ab245915e7fd20094showard private HeaderFieldCollection headerFields = commonPanel.getHeaderFields(); 668a7f36583afe076a7198d1b34fe109aa491dc277jamesren 678b0ea2285c1327a686ff0b6ab245915e7fd20094showard private SpreadsheetHeaderSelect rowSelect = new SpreadsheetHeaderSelect(headerFields); 688b0ea2285c1327a686ff0b6ab245915e7fd20094showard private SpreadsheetHeaderSelectorView rowSelectDisplay = new SpreadsheetHeaderSelectorView(); 698b0ea2285c1327a686ff0b6ab245915e7fd20094showard private SpreadsheetHeaderSelect columnSelect = new SpreadsheetHeaderSelect(headerFields); 708b0ea2285c1327a686ff0b6ab245915e7fd20094showard private SpreadsheetHeaderSelectorView columnSelectDisplay = new SpreadsheetHeaderSelectorView(); 718b0ea2285c1327a686ff0b6ab245915e7fd20094showard private ContentSelect contentSelect = new ContentSelect(headerFields); 72d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshoward private CheckBox showIncomplete = new CheckBox("Show incomplete tests"); 738a6eb0cf5777dded2354408e8007d9223e813c92showard private CheckBox showOnlyLatest = new CheckBox("Show only latest test per cell"); 7435444864c7b6f49865a7e17aa0052987b72e4728showard private Button queryButton = new Button("Query"); 758a6eb0cf5777dded2354408e8007d9223e813c92showard private TestGroupDataSource normalDataSource = TestGroupDataSource.getStatusCountDataSource(); 768a6eb0cf5777dded2354408e8007d9223e813c92showard private TestGroupDataSource latestDataSource = TestGroupDataSource.getLatestTestsDataSource(); 7735444864c7b6f49865a7e17aa0052987b72e4728showard private Spreadsheet spreadsheet = new Spreadsheet(); 788a7f36583afe076a7198d1b34fe109aa491dc277jamesren private SpreadsheetDataProcessor spreadsheetProcessor = 798a6eb0cf5777dded2354408e8007d9223e813c92showard new SpreadsheetDataProcessor(spreadsheet); 808a7f36583afe076a7198d1b34fe109aa491dc277jamesren private SpreadsheetSelectionManager selectionManager = 8135444864c7b6f49865a7e17aa0052987b72e4728showard new SpreadsheetSelectionManager(spreadsheet, null); 829dbdcda5104991cbf344ea5cba1aa58e1af444f3showard private TableActionsPanel actionsPanel = new TableActionsPanel(false); 839e494cc00c53f9dd0fabec3ef675cb874a9130adshoward private Panel jobCompletionPanel = new SimplePanel(); 84313ab769319f56b940a2784cc0cbdebd005c5799showard private boolean currentShowIncomplete, currentShowOnlyLatest; 8535444864c7b6f49865a7e17aa0052987b72e4728showard private boolean notYetQueried = true; 868b0ea2285c1327a686ff0b6ab245915e7fd20094showard 87ce12f55f4530950f7fc6ddc73d1867ebb954d356showard public SpreadsheetView(TableSwitchListener listener) { 8835444864c7b6f49865a7e17aa0052987b72e4728showard this.listener = listener; 890c31bc5ef2ecdf8edf19468e1a373520110f5bc6showard commonPanel.addListener(this); 908b0ea2285c1327a686ff0b6ab245915e7fd20094showard rowSelect.bindDisplay(rowSelectDisplay); 918b0ea2285c1327a686ff0b6ab245915e7fd20094showard columnSelect.bindDisplay(columnSelectDisplay); 9235444864c7b6f49865a7e17aa0052987b72e4728showard } 938a7f36583afe076a7198d1b34fe109aa491dc277jamesren 9435444864c7b6f49865a7e17aa0052987b72e4728showard @Override 9535444864c7b6f49865a7e17aa0052987b72e4728showard public String getElementId() { 9635444864c7b6f49865a7e17aa0052987b72e4728showard return "spreadsheet_view"; 9735444864c7b6f49865a7e17aa0052987b72e4728showard } 9835444864c7b6f49865a7e17aa0052987b72e4728showard 9935444864c7b6f49865a7e17aa0052987b72e4728showard @Override 10035444864c7b6f49865a7e17aa0052987b72e4728showard public void initialize() { 1019f4500a294eea35dce003cee41c558fcde3eb09fshoward super.initialize(); 102b9c6617bdc063b3b4aa760a0a45190ee069139fdshoward 1038b0ea2285c1327a686ff0b6ab245915e7fd20094showard setHeaderSelectField(rowSelect, DEFAULT_ROW); 1048b0ea2285c1327a686ff0b6ab245915e7fd20094showard setHeaderSelectField(columnSelect, DEFAULT_COLUMN); 1058b0ea2285c1327a686ff0b6ab245915e7fd20094showard 1063d6ae118f69717e68bc15b9aed7b6a6c7dd9bab0showard actionsPanel.setActionsWithCsvListener(this); 1079dbdcda5104991cbf344ea5cba1aa58e1af444f3showard actionsPanel.setSelectionListener(this); 1083d6ae118f69717e68bc15b9aed7b6a6c7dd9bab0showard actionsPanel.setVisible(false); 109f248952e42ea33c34e41a49817e50f98c65c2716showard 1100d92da0fe19a095fc5678c4159e6a1756df65e48showard contentSelect.addValueChangeHandler(new ValueChangeHandler<Boolean>() { 1118a7f36583afe076a7198d1b34fe109aa491dc277jamesren public void onValueChange(ValueChangeEvent<Boolean> event) { 1120d92da0fe19a095fc5678c4159e6a1756df65e48showard if (event.getValue()) { 1137f2b0e15c5928ea2914d078e385ca717d078c6d5showard showOnlyLatest.setValue(true); 11477401f351bd4ef6b6af99e46a9f905b161062574showard showOnlyLatest.setEnabled(false); 11577401f351bd4ef6b6af99e46a9f905b161062574showard } else { 11677401f351bd4ef6b6af99e46a9f905b161062574showard showOnlyLatest.setEnabled(true); 11777401f351bd4ef6b6af99e46a9f905b161062574showard } 11877401f351bd4ef6b6af99e46a9f905b161062574showard } 11977401f351bd4ef6b6af99e46a9f905b161062574showard }); 1208a7f36583afe076a7198d1b34fe109aa491dc277jamesren 121c674d3ea684f75f3e05f5834b598050eb1c8856dshoward updateViewFromState(); 122f248952e42ea33c34e41a49817e50f98c65c2716showard 123a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showard queryButton.addClickHandler(new ClickHandler() { 124a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showard public void onClick(ClickEvent event) { 125e299d4603ca85fb3fea2bfbac52c16c66475ac1fshoward doQueryWithCommonPanelCheck(); 12635444864c7b6f49865a7e17aa0052987b72e4728showard updateHistory(); 1278a7f36583afe076a7198d1b34fe109aa491dc277jamesren } 12835444864c7b6f49865a7e17aa0052987b72e4728showard }); 1298a7f36583afe076a7198d1b34fe109aa491dc277jamesren 13035444864c7b6f49865a7e17aa0052987b72e4728showard spreadsheet.setVisible(false); 13135444864c7b6f49865a7e17aa0052987b72e4728showard spreadsheet.setListener(this); 1328a7f36583afe076a7198d1b34fe109aa491dc277jamesren 1338a7f36583afe076a7198d1b34fe109aa491dc277jamesren Anchor swapLink = new Anchor("swap"); 134a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showard swapLink.addClickHandler(new ClickHandler() { 135a5e4d84c9616b0a987e904d3b1d1d3fd9ca1be86showard public void onClick(ClickEvent event) { 1368b0ea2285c1327a686ff0b6ab245915e7fd20094showard SpreadsheetHeaderSelect.State rowState = rowSelect.getStateFromView(); 1373f2110914421a50e509e619e6e876e0af096144cshoward rowSelect.loadFromState(columnSelect.getStateFromView()); 1383f2110914421a50e509e619e6e876e0af096144cshoward columnSelect.loadFromState(rowState); 1398a7f36583afe076a7198d1b34fe109aa491dc277jamesren } 14035444864c7b6f49865a7e17aa0052987b72e4728showard }); 1418a7f36583afe076a7198d1b34fe109aa491dc277jamesren 1428a6eb0cf5777dded2354408e8007d9223e813c92showard Panel filterOptions = new VerticalPanel(); 1438a6eb0cf5777dded2354408e8007d9223e813c92showard filterOptions.add(showIncomplete); 1448a6eb0cf5777dded2354408e8007d9223e813c92showard filterOptions.add(showOnlyLatest); 1458a7f36583afe076a7198d1b34fe109aa491dc277jamesren 1469e494cc00c53f9dd0fabec3ef675cb874a9130adshoward addWidget(filterOptions, "ss_filter_options"); 147d9e04c1a7950691cc348e70fa2470f8c414ae94fshoward addWidget(rowSelectDisplay, "ss_row_select"); 148d9e04c1a7950691cc348e70fa2470f8c414ae94fshoward addWidget(columnSelectDisplay, "ss_column_select"); 1499e494cc00c53f9dd0fabec3ef675cb874a9130adshoward addWidget(contentSelect, "ss_additional_content"); 1509e494cc00c53f9dd0fabec3ef675cb874a9130adshoward addWidget(swapLink, "ss_swap"); 1519e494cc00c53f9dd0fabec3ef675cb874a9130adshoward addWidget(queryButton, "ss_query_controls"); 1529e494cc00c53f9dd0fabec3ef675cb874a9130adshoward addWidget(actionsPanel, "ss_actions"); 1539e494cc00c53f9dd0fabec3ef675cb874a9130adshoward addWidget(spreadsheet, "ss_spreadsheet"); 1549e494cc00c53f9dd0fabec3ef675cb874a9130adshoward addWidget(jobCompletionPanel, "ss_job_completion"); 1558a7f36583afe076a7198d1b34fe109aa491dc277jamesren 15679a7b0d387aac103fc1d125353eefa361030452ashoward Window.addResizeHandler(new ResizeHandler() { 15779a7b0d387aac103fc1d125353eefa361030452ashoward public void onResize(ResizeEvent event) { 158a397e604073b2c8d77aab5b97fe8966dcfd40a24jamesren if(spreadsheet.isVisible()) { 15935444864c7b6f49865a7e17aa0052987b72e4728showard spreadsheet.fillWindow(true); 160a397e604073b2c8d77aab5b97fe8966dcfd40a24jamesren } 1618a7f36583afe076a7198d1b34fe109aa491dc277jamesren } 16235444864c7b6f49865a7e17aa0052987b72e4728showard }); 1638a7f36583afe076a7198d1b34fe109aa491dc277jamesren 16435444864c7b6f49865a7e17aa0052987b72e4728showard setupDrilldownMap(); 16535444864c7b6f49865a7e17aa0052987b72e4728showard } 166f6348c999bc60ee048510c8e28f74f944a32d97cshoward 1678a7f36583afe076a7198d1b34fe109aa491dc277jamesren private void setHeaderSelectField(SpreadsheetHeaderSelect headerSelect, 1688b0ea2285c1327a686ff0b6ab245915e7fd20094showard String defaultField) { 1698b0ea2285c1327a686ff0b6ab245915e7fd20094showard headerSelect.setSelectedItem(headerFields.getFieldBySqlName(defaultField)); 170227a7a1d0484dcfa4c6d996a1c10e95437d059efshoward } 171227a7a1d0484dcfa4c6d996a1c10e95437d059efshoward 17235444864c7b6f49865a7e17aa0052987b72e4728showard protected TestSet getWholeTableTestSet() { 17335444864c7b6f49865a7e17aa0052987b72e4728showard boolean isSingleTest = spreadsheetProcessor.getNumTotalTests() == 1; 1748a6eb0cf5777dded2354408e8007d9223e813c92showard if (isSingleTest) { 1758a6eb0cf5777dded2354408e8007d9223e813c92showard return getTestSet(spreadsheetProcessor.getLastCellInfo()); 1768a6eb0cf5777dded2354408e8007d9223e813c92showard } 177f6348c999bc60ee048510c8e28f74f944a32d97cshoward 178f6348c999bc60ee048510c8e28f74f944a32d97cshoward if (currentShowOnlyLatest) { 179f6348c999bc60ee048510c8e28f74f944a32d97cshoward List<Integer> testIndices = spreadsheet.getAllTestIndices(); 180f6348c999bc60ee048510c8e28f74f944a32d97cshoward String filter = "test_idx IN (" + Utils.joinStrings(",", testIndices) + ")"; 181f6348c999bc60ee048510c8e28f74f944a32d97cshoward ConditionTestSet tests = new ConditionTestSet(); 182f6348c999bc60ee048510c8e28f74f944a32d97cshoward tests.addCondition(filter); 183f6348c999bc60ee048510c8e28f74f944a32d97cshoward return tests; 184f6348c999bc60ee048510c8e28f74f944a32d97cshoward } 185f6348c999bc60ee048510c8e28f74f944a32d97cshoward 1868a6eb0cf5777dded2354408e8007d9223e813c92showard return new ConditionTestSet(getFullConditionArgs()); 18735444864c7b6f49865a7e17aa0052987b72e4728showard } 18835444864c7b6f49865a7e17aa0052987b72e4728showard 18935444864c7b6f49865a7e17aa0052987b72e4728showard protected void setupDrilldownMap() { 19035444864c7b6f49865a7e17aa0052987b72e4728showard drilldownMap.put("platform", new String[] {"hostname", "test_name"}); 19135444864c7b6f49865a7e17aa0052987b72e4728showard drilldownMap.put("hostname", new String[] {"job_tag", "status"}); 1928a7f36583afe076a7198d1b34fe109aa491dc277jamesren 19335444864c7b6f49865a7e17aa0052987b72e4728showard drilldownMap.put("kernel", new String[] {"test_name", "status"}); 1941c4d2394fbe949fef83661a25cfe9a32bf8569aashoward drilldownMap.put("test_name", new String[] {"subdir", "job_name", "job_tag"}); 1958a7f36583afe076a7198d1b34fe109aa491dc277jamesren 19635444864c7b6f49865a7e17aa0052987b72e4728showard drilldownMap.put("status", new String[] {"reason", "job_tag"}); 1978a7f36583afe076a7198d1b34fe109aa491dc277jamesren 19835444864c7b6f49865a7e17aa0052987b72e4728showard drilldownMap.put("job_owner", new String[] {"job_name", "job_tag"}); 1998a7f36583afe076a7198d1b34fe109aa491dc277jamesren 20035444864c7b6f49865a7e17aa0052987b72e4728showard drilldownMap.put("test_finished_time", new String[] {"status", "job_tag"}); 2018a7f36583afe076a7198d1b34fe109aa491dc277jamesren drilldownMap.put("DATE(test_finished_time)", 20235444864c7b6f49865a7e17aa0052987b72e4728showard new String[] {"test_finished_time", "job_tag"}); 2038a7f36583afe076a7198d1b34fe109aa491dc277jamesren 2041c4d2394fbe949fef83661a25cfe9a32bf8569aashoward drilldownMap.put("job_tag", new String[] {"subdir"}); 20535444864c7b6f49865a7e17aa0052987b72e4728showard } 2068a7f36583afe076a7198d1b34fe109aa491dc277jamesren 207f248952e42ea33c34e41a49817e50f98c65c2716showard protected void setSelectedHeader(HeaderSelect list, List<HeaderField> fields) { 2088b0ea2285c1327a686ff0b6ab245915e7fd20094showard list.setSelectedItems(fields); 20935444864c7b6f49865a7e17aa0052987b72e4728showard } 21035444864c7b6f49865a7e17aa0052987b72e4728showard 21135444864c7b6f49865a7e17aa0052987b72e4728showard @Override 21235444864c7b6f49865a7e17aa0052987b72e4728showard public void refresh() { 21335444864c7b6f49865a7e17aa0052987b72e4728showard notYetQueried = false; 2143d6ae118f69717e68bc15b9aed7b6a6c7dd9bab0showard actionsPanel.setVisible(true); 21535444864c7b6f49865a7e17aa0052987b72e4728showard spreadsheet.setVisible(false); 21635444864c7b6f49865a7e17aa0052987b72e4728showard selectionManager.clearSelection(); 21735444864c7b6f49865a7e17aa0052987b72e4728showard spreadsheet.clear(); 21835444864c7b6f49865a7e17aa0052987b72e4728showard setJobCompletionHtml(" "); 2198a7f36583afe076a7198d1b34fe109aa491dc277jamesren 220d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshoward final JSONObject condition = getFullConditionArgs(); 2218a7f36583afe076a7198d1b34fe109aa491dc277jamesren 22277401f351bd4ef6b6af99e46a9f905b161062574showard contentSelect.addToCondition(condition); 223c674d3ea684f75f3e05f5834b598050eb1c8856dshoward 22435444864c7b6f49865a7e17aa0052987b72e4728showard setLoading(true); 225313ab769319f56b940a2784cc0cbdebd005c5799showard if (currentShowOnlyLatest) { 2268a6eb0cf5777dded2354408e8007d9223e813c92showard spreadsheetProcessor.setDataSource(latestDataSource); 2278a6eb0cf5777dded2354408e8007d9223e813c92showard } else { 2288a6eb0cf5777dded2354408e8007d9223e813c92showard spreadsheetProcessor.setDataSource(normalDataSource); 2298a6eb0cf5777dded2354408e8007d9223e813c92showard } 2308a7f36583afe076a7198d1b34fe109aa491dc277jamesren spreadsheetProcessor.setHeaders(rowSelect.getSelectedItems(), 2318a7f36583afe076a7198d1b34fe109aa491dc277jamesren columnSelect.getSelectedItems(), 232f248952e42ea33c34e41a49817e50f98c65c2716showard getQueryParameters()); 2338c9b839c2f5073a755952a8a865a04db3b2d4547showard spreadsheetProcessor.refresh(condition, new Command() { 23435444864c7b6f49865a7e17aa0052987b72e4728showard public void execute() { 23577401f351bd4ef6b6af99e46a9f905b161062574showard condition.put("extra_info", null); 2368a7f36583afe076a7198d1b34fe109aa491dc277jamesren 2370281350135d1216c722e1d6fb85044f505c2319bshoward if (isJobFilteringCondition(condition)) { 2380281350135d1216c722e1d6fb85044f505c2319bshoward showCompletionPercentage(condition); 23935444864c7b6f49865a7e17aa0052987b72e4728showard } else { 24035444864c7b6f49865a7e17aa0052987b72e4728showard setLoading(false); 24135444864c7b6f49865a7e17aa0052987b72e4728showard } 24235444864c7b6f49865a7e17aa0052987b72e4728showard } 24335444864c7b6f49865a7e17aa0052987b72e4728showard }); 24435444864c7b6f49865a7e17aa0052987b72e4728showard } 24535444864c7b6f49865a7e17aa0052987b72e4728showard 246f248952e42ea33c34e41a49817e50f98c65c2716showard private JSONObject getQueryParameters() { 247f248952e42ea33c34e41a49817e50f98c65c2716showard JSONObject parameters = new JSONObject(); 248f248952e42ea33c34e41a49817e50f98c65c2716showard rowSelect.addQueryParameters(parameters); 249f248952e42ea33c34e41a49817e50f98c65c2716showard columnSelect.addQueryParameters(parameters); 250f248952e42ea33c34e41a49817e50f98c65c2716showard return parameters; 2518c9b839c2f5073a755952a8a865a04db3b2d4547showard } 2528c9b839c2f5073a755952a8a865a04db3b2d4547showard 253d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshoward private JSONObject getFullConditionArgs() { 254c674d3ea684f75f3e05f5834b598050eb1c8856dshoward JSONObject args = commonPanel.getConditionArgs(); 255d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshoward String condition = TkoUtils.getSqlCondition(args); 2560281350135d1216c722e1d6fb85044f505c2319bshoward if (!condition.equals("")) { 2570281350135d1216c722e1d6fb85044f505c2319bshoward condition = "(" + condition + ") AND "; 2580281350135d1216c722e1d6fb85044f505c2319bshoward } 2590281350135d1216c722e1d6fb85044f505c2319bshoward condition += "status != 'TEST_NA'"; 2600281350135d1216c722e1d6fb85044f505c2319bshoward if (!currentShowIncomplete) { 2610281350135d1216c722e1d6fb85044f505c2319bshoward condition += " AND status != 'RUNNING'"; 2620281350135d1216c722e1d6fb85044f505c2319bshoward } 263d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshoward args.put("extra_where", new JSONString(condition)); 264d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshoward return args; 2650281350135d1216c722e1d6fb85044f505c2319bshoward } 2668a7f36583afe076a7198d1b34fe109aa491dc277jamesren 267c674d3ea684f75f3e05f5834b598050eb1c8856dshoward private void updateStateFromView() { 268c674d3ea684f75f3e05f5834b598050eb1c8856dshoward rowSelect.updateStateFromView(); 269c674d3ea684f75f3e05f5834b598050eb1c8856dshoward columnSelect.updateStateFromView(); 2707f2b0e15c5928ea2914d078e385ca717d078c6d5showard currentShowIncomplete = showIncomplete.getValue(); 2717f2b0e15c5928ea2914d078e385ca717d078c6d5showard currentShowOnlyLatest = showOnlyLatest.getValue(); 272c674d3ea684f75f3e05f5834b598050eb1c8856dshoward commonPanel.updateStateFromView(); 273c674d3ea684f75f3e05f5834b598050eb1c8856dshoward } 2748a7f36583afe076a7198d1b34fe109aa491dc277jamesren 275e299d4603ca85fb3fea2bfbac52c16c66475ac1fshoward @Override 27635444864c7b6f49865a7e17aa0052987b72e4728showard public void doQuery() { 277f248952e42ea33c34e41a49817e50f98c65c2716showard List<HeaderField> rows = rowSelect.getSelectedItems(); 278f248952e42ea33c34e41a49817e50f98c65c2716showard List<HeaderField> columns = columnSelect.getSelectedItems(); 27935444864c7b6f49865a7e17aa0052987b72e4728showard if (rows.isEmpty() || columns.isEmpty()) { 28035444864c7b6f49865a7e17aa0052987b72e4728showard NotifyManager.getInstance().showError("You must select row and column fields"); 28135444864c7b6f49865a7e17aa0052987b72e4728showard return; 28235444864c7b6f49865a7e17aa0052987b72e4728showard } 2838b0ea2285c1327a686ff0b6ab245915e7fd20094showard 284c674d3ea684f75f3e05f5834b598050eb1c8856dshoward updateStateFromView(); 28535444864c7b6f49865a7e17aa0052987b72e4728showard refresh(); 28635444864c7b6f49865a7e17aa0052987b72e4728showard } 28735444864c7b6f49865a7e17aa0052987b72e4728showard 288d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshoward private void showCompletionPercentage(JSONObject condition) { 289d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshoward rpcProxy.rpcCall("get_job_ids", condition, new JsonRpcCallback() { 29035444864c7b6f49865a7e17aa0052987b72e4728showard @Override 29135444864c7b6f49865a7e17aa0052987b72e4728showard public void onSuccess(JSONValue result) { 29235444864c7b6f49865a7e17aa0052987b72e4728showard finishShowCompletionPercentage(result.isArray()); 29335444864c7b6f49865a7e17aa0052987b72e4728showard setLoading(false); 29435444864c7b6f49865a7e17aa0052987b72e4728showard } 29535444864c7b6f49865a7e17aa0052987b72e4728showard 29635444864c7b6f49865a7e17aa0052987b72e4728showard @Override 29735444864c7b6f49865a7e17aa0052987b72e4728showard public void onError(JSONObject errorObject) { 29835444864c7b6f49865a7e17aa0052987b72e4728showard super.onError(errorObject); 29935444864c7b6f49865a7e17aa0052987b72e4728showard setLoading(false); 30035444864c7b6f49865a7e17aa0052987b72e4728showard } 30135444864c7b6f49865a7e17aa0052987b72e4728showard }); 30235444864c7b6f49865a7e17aa0052987b72e4728showard } 30335444864c7b6f49865a7e17aa0052987b72e4728showard 30435444864c7b6f49865a7e17aa0052987b72e4728showard private void finishShowCompletionPercentage(JSONArray jobIds) { 30535444864c7b6f49865a7e17aa0052987b72e4728showard final int jobCount = jobIds.size(); 30635444864c7b6f49865a7e17aa0052987b72e4728showard if (jobCount == 0) { 30735444864c7b6f49865a7e17aa0052987b72e4728showard return; 30835444864c7b6f49865a7e17aa0052987b72e4728showard } 3098a7f36583afe076a7198d1b34fe109aa491dc277jamesren 31035444864c7b6f49865a7e17aa0052987b72e4728showard JSONObject args = new JSONObject(); 31135444864c7b6f49865a7e17aa0052987b72e4728showard args.put("job__id__in", jobIds); 31235444864c7b6f49865a7e17aa0052987b72e4728showard afeRpcProxy.rpcCall("get_hqe_percentage_complete", args, new JsonRpcCallback() { 31335444864c7b6f49865a7e17aa0052987b72e4728showard @Override 31435444864c7b6f49865a7e17aa0052987b72e4728showard public void onSuccess(JSONValue result) { 31535444864c7b6f49865a7e17aa0052987b72e4728showard int percentage = (int) (result.isNumber().doubleValue() * 100); 31635444864c7b6f49865a7e17aa0052987b72e4728showard StringBuilder message = new StringBuilder("Matching "); 31735444864c7b6f49865a7e17aa0052987b72e4728showard if (jobCount == 1) { 31835444864c7b6f49865a7e17aa0052987b72e4728showard message.append("job is "); 31935444864c7b6f49865a7e17aa0052987b72e4728showard } else { 32035444864c7b6f49865a7e17aa0052987b72e4728showard message.append("jobs are "); 32135444864c7b6f49865a7e17aa0052987b72e4728showard } 32235444864c7b6f49865a7e17aa0052987b72e4728showard message.append(percentage); 32335444864c7b6f49865a7e17aa0052987b72e4728showard message.append("% complete"); 32435444864c7b6f49865a7e17aa0052987b72e4728showard setJobCompletionHtml(message.toString()); 32535444864c7b6f49865a7e17aa0052987b72e4728showard } 32635444864c7b6f49865a7e17aa0052987b72e4728showard }); 32735444864c7b6f49865a7e17aa0052987b72e4728showard } 3288a7f36583afe076a7198d1b34fe109aa491dc277jamesren 32935444864c7b6f49865a7e17aa0052987b72e4728showard private void setJobCompletionHtml(String html) { 33035444864c7b6f49865a7e17aa0052987b72e4728showard jobCompletionPanel.clear(); 33135444864c7b6f49865a7e17aa0052987b72e4728showard jobCompletionPanel.add(new HTML(html)); 33235444864c7b6f49865a7e17aa0052987b72e4728showard } 33335444864c7b6f49865a7e17aa0052987b72e4728showard 334d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshoward private boolean isJobFilteringCondition(JSONObject condition) { 335d50ffb4b0ef514fb969d53b82e23ab41d4d3812eshoward return TkoUtils.getSqlCondition(condition).indexOf("job_tag") != -1; 33635444864c7b6f49865a7e17aa0052987b72e4728showard } 3378a7f36583afe076a7198d1b34fe109aa491dc277jamesren 3384cd4763a855d8eb7d25fd4963babc432eb4d25e6showard @Override 3394cd4763a855d8eb7d25fd4963babc432eb4d25e6showard public void onCellClicked(CellInfo cellInfo, boolean isRightClick) { 34035444864c7b6f49865a7e17aa0052987b72e4728showard Event event = Event.getCurrentEvent(); 34135444864c7b6f49865a7e17aa0052987b72e4728showard TestSet testSet = getTestSet(cellInfo); 342a397e604073b2c8d77aab5b97fe8966dcfd40a24jamesren DrilldownType drilldownType = TkoSpreadsheetUtils.getDrilldownType(cellInfo); 3434cd4763a855d8eb7d25fd4963babc432eb4d25e6showard if (isRightClick) { 34435444864c7b6f49865a7e17aa0052987b72e4728showard if (!selectionManager.isEmpty()) { 34535444864c7b6f49865a7e17aa0052987b72e4728showard testSet = getTestSet(selectionManager.getSelectedCells()); 34635444864c7b6f49865a7e17aa0052987b72e4728showard drilldownType = DrilldownType.DRILLDOWN_BOTH; 34735444864c7b6f49865a7e17aa0052987b72e4728showard } 34835444864c7b6f49865a7e17aa0052987b72e4728showard ContextMenu menu = getContextMenu(testSet, drilldownType); 34935444864c7b6f49865a7e17aa0052987b72e4728showard menu.showAtWindow(event.getClientX(), event.getClientY()); 35035444864c7b6f49865a7e17aa0052987b72e4728showard return; 35135444864c7b6f49865a7e17aa0052987b72e4728showard } 3528a7f36583afe076a7198d1b34fe109aa491dc277jamesren 3533b8563acf345e8327fb3f0cb4b96869ce55f5080showard if (isSelectEvent(event)) { 35435444864c7b6f49865a7e17aa0052987b72e4728showard selectionManager.toggleSelected(cellInfo); 35535444864c7b6f49865a7e17aa0052987b72e4728showard return; 35635444864c7b6f49865a7e17aa0052987b72e4728showard } 357c674d3ea684f75f3e05f5834b598050eb1c8856dshoward 358c674d3ea684f75f3e05f5834b598050eb1c8856dshoward HistoryToken historyToken; 35935444864c7b6f49865a7e17aa0052987b72e4728showard if (testSet.isSingleTest()) { 360c674d3ea684f75f3e05f5834b598050eb1c8856dshoward historyToken = listener.getSelectTestHistoryToken(testSet.getTestIndex()); 361c674d3ea684f75f3e05f5834b598050eb1c8856dshoward } else { 3628a7f36583afe076a7198d1b34fe109aa491dc277jamesren historyToken = getDrilldownHistoryToken(testSet, 3638a7f36583afe076a7198d1b34fe109aa491dc277jamesren getDefaultDrilldownRow(drilldownType), 364c674d3ea684f75f3e05f5834b598050eb1c8856dshoward getDefaultDrilldownColumn(drilldownType)); 36535444864c7b6f49865a7e17aa0052987b72e4728showard } 366c674d3ea684f75f3e05f5834b598050eb1c8856dshoward openHistoryToken(historyToken); 36735444864c7b6f49865a7e17aa0052987b72e4728showard } 3688a7f36583afe076a7198d1b34fe109aa491dc277jamesren 36935444864c7b6f49865a7e17aa0052987b72e4728showard private TestSet getTestSet(CellInfo cellInfo) { 370a397e604073b2c8d77aab5b97fe8966dcfd40a24jamesren return TkoSpreadsheetUtils.getTestSet(cellInfo, getFullConditionArgs(), 371a397e604073b2c8d77aab5b97fe8966dcfd40a24jamesren rowSelect.getSelectedItems(), columnSelect.getSelectedItems()); 37235444864c7b6f49865a7e17aa0052987b72e4728showard } 3738a7f36583afe076a7198d1b34fe109aa491dc277jamesren 37435444864c7b6f49865a7e17aa0052987b72e4728showard private TestSet getTestSet(List<CellInfo> cells) { 37535444864c7b6f49865a7e17aa0052987b72e4728showard CompositeTestSet tests = new CompositeTestSet(); 37635444864c7b6f49865a7e17aa0052987b72e4728showard for (CellInfo cell : cells) { 37735444864c7b6f49865a7e17aa0052987b72e4728showard tests.add(getTestSet(cell)); 37835444864c7b6f49865a7e17aa0052987b72e4728showard } 37935444864c7b6f49865a7e17aa0052987b72e4728showard return tests; 38035444864c7b6f49865a7e17aa0052987b72e4728showard } 38135444864c7b6f49865a7e17aa0052987b72e4728showard 3828a7f36583afe076a7198d1b34fe109aa491dc277jamesren private HistoryToken getDrilldownHistoryToken(TestSet tests, String newRowField, 383227a7a1d0484dcfa4c6d996a1c10e95437d059efshoward String newColumnField) { 384c674d3ea684f75f3e05f5834b598050eb1c8856dshoward saveHistoryState(); 38564aeecdec485192241e5377b3fa5ac7cf57a0c12showard commonPanel.refineCondition(tests); 3868b0ea2285c1327a686ff0b6ab245915e7fd20094showard rowSelect.setSelectedItem(headerFields.getFieldBySqlName(newRowField)); 3878b0ea2285c1327a686ff0b6ab245915e7fd20094showard columnSelect.setSelectedItem(headerFields.getFieldBySqlName(newColumnField)); 388c674d3ea684f75f3e05f5834b598050eb1c8856dshoward HistoryToken historyArguments = getHistoryArguments(); 389c674d3ea684f75f3e05f5834b598050eb1c8856dshoward restoreHistoryState(); 390c674d3ea684f75f3e05f5834b598050eb1c8856dshoward return historyArguments; 391c674d3ea684f75f3e05f5834b598050eb1c8856dshoward } 3928a7f36583afe076a7198d1b34fe109aa491dc277jamesren 393c674d3ea684f75f3e05f5834b598050eb1c8856dshoward private void doDrilldown(TestSet tests, String newRowField, String newColumnField) { 394c674d3ea684f75f3e05f5834b598050eb1c8856dshoward History.newItem(getDrilldownHistoryToken(tests, newRowField, newColumnField).toString()); 39535444864c7b6f49865a7e17aa0052987b72e4728showard } 39635444864c7b6f49865a7e17aa0052987b72e4728showard 39735444864c7b6f49865a7e17aa0052987b72e4728showard private String getDefaultDrilldownRow(DrilldownType type) { 39835444864c7b6f49865a7e17aa0052987b72e4728showard return getDrilldownRows(type)[0]; 39935444864c7b6f49865a7e17aa0052987b72e4728showard } 4008a7f36583afe076a7198d1b34fe109aa491dc277jamesren 40135444864c7b6f49865a7e17aa0052987b72e4728showard private String getDefaultDrilldownColumn(DrilldownType type) { 40235444864c7b6f49865a7e17aa0052987b72e4728showard return getDrilldownColumns(type)[0]; 40335444864c7b6f49865a7e17aa0052987b72e4728showard } 40435444864c7b6f49865a7e17aa0052987b72e4728showard 40535444864c7b6f49865a7e17aa0052987b72e4728showard private ContextMenu getContextMenu(final TestSet tests, DrilldownType drilldownType) { 40635444864c7b6f49865a7e17aa0052987b72e4728showard TestContextMenu menu = new TestContextMenu(tests, listener); 4078a7f36583afe076a7198d1b34fe109aa491dc277jamesren 40835444864c7b6f49865a7e17aa0052987b72e4728showard if (!menu.addViewDetailsIfSingleTest()) { 40935444864c7b6f49865a7e17aa0052987b72e4728showard MenuBar drilldownMenu = menu.addSubMenuItem("Drill down"); 41035444864c7b6f49865a7e17aa0052987b72e4728showard fillDrilldownMenu(tests, drilldownType, drilldownMenu); 41135444864c7b6f49865a7e17aa0052987b72e4728showard } 4128a7f36583afe076a7198d1b34fe109aa491dc277jamesren 41335444864c7b6f49865a7e17aa0052987b72e4728showard menu.addItem("View in table", new Command() { 41435444864c7b6f49865a7e17aa0052987b72e4728showard public void execute() { 41535444864c7b6f49865a7e17aa0052987b72e4728showard switchToTable(tests, false); 41635444864c7b6f49865a7e17aa0052987b72e4728showard } 41735444864c7b6f49865a7e17aa0052987b72e4728showard }); 41835444864c7b6f49865a7e17aa0052987b72e4728showard menu.addItem("Triage failures", new Command() { 41935444864c7b6f49865a7e17aa0052987b72e4728showard public void execute() { 42035444864c7b6f49865a7e17aa0052987b72e4728showard switchToTable(tests, true); 42135444864c7b6f49865a7e17aa0052987b72e4728showard } 42235444864c7b6f49865a7e17aa0052987b72e4728showard }); 4238a7f36583afe076a7198d1b34fe109aa491dc277jamesren 42435444864c7b6f49865a7e17aa0052987b72e4728showard menu.addLabelItems(); 42535444864c7b6f49865a7e17aa0052987b72e4728showard return menu; 42635444864c7b6f49865a7e17aa0052987b72e4728showard } 42735444864c7b6f49865a7e17aa0052987b72e4728showard 42835444864c7b6f49865a7e17aa0052987b72e4728showard private void fillDrilldownMenu(final TestSet tests, DrilldownType drilldownType, MenuBar menu) { 42935444864c7b6f49865a7e17aa0052987b72e4728showard for (final String rowField : getDrilldownRows(drilldownType)) { 43035444864c7b6f49865a7e17aa0052987b72e4728showard for (final String columnField : getDrilldownColumns(drilldownType)) { 43135444864c7b6f49865a7e17aa0052987b72e4728showard if (rowField.equals(columnField)) { 43235444864c7b6f49865a7e17aa0052987b72e4728showard continue; 43335444864c7b6f49865a7e17aa0052987b72e4728showard } 43435444864c7b6f49865a7e17aa0052987b72e4728showard menu.addItem(rowField + " vs. " + columnField, new Command() { 43535444864c7b6f49865a7e17aa0052987b72e4728showard public void execute() { 43635444864c7b6f49865a7e17aa0052987b72e4728showard doDrilldown(tests, rowField, columnField); 43735444864c7b6f49865a7e17aa0052987b72e4728showard } 43835444864c7b6f49865a7e17aa0052987b72e4728showard }); 43935444864c7b6f49865a7e17aa0052987b72e4728showard } 44035444864c7b6f49865a7e17aa0052987b72e4728showard } 44135444864c7b6f49865a7e17aa0052987b72e4728showard } 44235444864c7b6f49865a7e17aa0052987b72e4728showard 443f248952e42ea33c34e41a49817e50f98c65c2716showard private String[] getDrilldownFields(List<HeaderField> fields, DrilldownType type, 44435444864c7b6f49865a7e17aa0052987b72e4728showard DrilldownType otherType) { 445f248952e42ea33c34e41a49817e50f98c65c2716showard HeaderField lastField = fields.get(fields.size() - 1); 446f248952e42ea33c34e41a49817e50f98c65c2716showard String lastFieldName = lastField.getSqlName(); 44735444864c7b6f49865a7e17aa0052987b72e4728showard if (type == otherType) { 448f248952e42ea33c34e41a49817e50f98c65c2716showard return new String[] {lastFieldName}; 44935444864c7b6f49865a7e17aa0052987b72e4728showard } else { 450f248952e42ea33c34e41a49817e50f98c65c2716showard if (lastField instanceof MachineLabelField) { 451f248952e42ea33c34e41a49817e50f98c65c2716showard // treat machine label fields like platform, for the purpose of default drilldown 452f248952e42ea33c34e41a49817e50f98c65c2716showard lastFieldName = "platform"; 453f248952e42ea33c34e41a49817e50f98c65c2716showard } 454e463a8a926964673c2517bfef5ac394206b106c6showard if (drilldownMap.containsKey(lastFieldName)) { 455e463a8a926964673c2517bfef5ac394206b106c6showard return drilldownMap.get(lastFieldName); 456e463a8a926964673c2517bfef5ac394206b106c6showard } 457e463a8a926964673c2517bfef5ac394206b106c6showard return new String[] {DEFAULT_DRILLDOWN}; 45835444864c7b6f49865a7e17aa0052987b72e4728showard } 45935444864c7b6f49865a7e17aa0052987b72e4728showard } 46035444864c7b6f49865a7e17aa0052987b72e4728showard 46135444864c7b6f49865a7e17aa0052987b72e4728showard private String[] getDrilldownRows(DrilldownType type) { 4628a7f36583afe076a7198d1b34fe109aa491dc277jamesren return getDrilldownFields(rowSelect.getSelectedItems(), type, 463c674d3ea684f75f3e05f5834b598050eb1c8856dshoward DrilldownType.DRILLDOWN_COLUMN); 46435444864c7b6f49865a7e17aa0052987b72e4728showard } 4658a7f36583afe076a7198d1b34fe109aa491dc277jamesren 46635444864c7b6f49865a7e17aa0052987b72e4728showard private String[] getDrilldownColumns(DrilldownType type) { 4678a7f36583afe076a7198d1b34fe109aa491dc277jamesren return getDrilldownFields(columnSelect.getSelectedItems(), type, 468c674d3ea684f75f3e05f5834b598050eb1c8856dshoward DrilldownType.DRILLDOWN_ROW); 46935444864c7b6f49865a7e17aa0052987b72e4728showard } 4708a7f36583afe076a7198d1b34fe109aa491dc277jamesren 471c674d3ea684f75f3e05f5834b598050eb1c8856dshoward private void updateViewFromState() { 472c674d3ea684f75f3e05f5834b598050eb1c8856dshoward rowSelect.updateViewFromState(); 473c674d3ea684f75f3e05f5834b598050eb1c8856dshoward columnSelect.updateViewFromState(); 4747f2b0e15c5928ea2914d078e385ca717d078c6d5showard showIncomplete.setValue(currentShowIncomplete); 4757f2b0e15c5928ea2914d078e385ca717d078c6d5showard showOnlyLatest.setValue(currentShowOnlyLatest); 476c674d3ea684f75f3e05f5834b598050eb1c8856dshoward commonPanel.updateViewFromState(); 47735444864c7b6f49865a7e17aa0052987b72e4728showard } 47835444864c7b6f49865a7e17aa0052987b72e4728showard 47935444864c7b6f49865a7e17aa0052987b72e4728showard @Override 480c674d3ea684f75f3e05f5834b598050eb1c8856dshoward public HistoryToken getHistoryArguments() { 481c674d3ea684f75f3e05f5834b598050eb1c8856dshoward HistoryToken arguments = super.getHistoryArguments(); 48235444864c7b6f49865a7e17aa0052987b72e4728showard if (!notYetQueried) { 4838c9b839c2f5073a755952a8a865a04db3b2d4547showard rowSelect.addHistoryArguments(arguments, HISTORY_ROW); 4848c9b839c2f5073a755952a8a865a04db3b2d4547showard columnSelect.addHistoryArguments(arguments, HISTORY_COLUMN); 485194a59d6976a5dbd5b464fb2b14ceb089f91c050showard contentSelect.addHistoryArguments(arguments, HISTORY_CONTENT); 4868c9b839c2f5073a755952a8a865a04db3b2d4547showard arguments.put(HISTORY_SHOW_INCOMPLETE, Boolean.toString(currentShowIncomplete)); 4877f2b0e15c5928ea2914d078e385ca717d078c6d5showard arguments.put(HISTORY_ONLY_LATEST, Boolean.toString(showOnlyLatest.getValue())); 48835444864c7b6f49865a7e17aa0052987b72e4728showard commonPanel.addHistoryArguments(arguments); 48935444864c7b6f49865a7e17aa0052987b72e4728showard } 49035444864c7b6f49865a7e17aa0052987b72e4728showard return arguments; 49135444864c7b6f49865a7e17aa0052987b72e4728showard } 4928a7f36583afe076a7198d1b34fe109aa491dc277jamesren 49335444864c7b6f49865a7e17aa0052987b72e4728showard @Override 49435444864c7b6f49865a7e17aa0052987b72e4728showard public void handleHistoryArguments(Map<String, String> arguments) { 49535444864c7b6f49865a7e17aa0052987b72e4728showard super.handleHistoryArguments(arguments); 49635444864c7b6f49865a7e17aa0052987b72e4728showard commonPanel.handleHistoryArguments(arguments); 4978c9b839c2f5073a755952a8a865a04db3b2d4547showard rowSelect.handleHistoryArguments(arguments, HISTORY_ROW); 4988c9b839c2f5073a755952a8a865a04db3b2d4547showard columnSelect.handleHistoryArguments(arguments, HISTORY_COLUMN); 499194a59d6976a5dbd5b464fb2b14ceb089f91c050showard contentSelect.handleHistoryArguments(arguments, HISTORY_CONTENT); 500c674d3ea684f75f3e05f5834b598050eb1c8856dshoward 5018c9b839c2f5073a755952a8a865a04db3b2d4547showard currentShowIncomplete = Boolean.valueOf(arguments.get(HISTORY_SHOW_INCOMPLETE)); 502194a59d6976a5dbd5b464fb2b14ceb089f91c050showard currentShowOnlyLatest = Boolean.valueOf(arguments.get(HISTORY_ONLY_LATEST)); 503c674d3ea684f75f3e05f5834b598050eb1c8856dshoward updateViewFromState(); 50435444864c7b6f49865a7e17aa0052987b72e4728showard } 50535444864c7b6f49865a7e17aa0052987b72e4728showard 50635444864c7b6f49865a7e17aa0052987b72e4728showard @Override 50735444864c7b6f49865a7e17aa0052987b72e4728showard protected void fillDefaultHistoryValues(Map<String, String> arguments) { 5088c9b839c2f5073a755952a8a865a04db3b2d4547showard Utils.setDefaultValue(arguments, HISTORY_ROW, DEFAULT_ROW); 5098c9b839c2f5073a755952a8a865a04db3b2d4547showard Utils.setDefaultValue(arguments, HISTORY_COLUMN, DEFAULT_COLUMN); 5108a7f36583afe076a7198d1b34fe109aa491dc277jamesren Utils.setDefaultValue(arguments, 5118b0ea2285c1327a686ff0b6ab245915e7fd20094showard HISTORY_ROW + SpreadsheetHeaderSelect.HISTORY_FIXED_VALUES, ""); 5128a7f36583afe076a7198d1b34fe109aa491dc277jamesren Utils.setDefaultValue(arguments, 5138b0ea2285c1327a686ff0b6ab245915e7fd20094showard HISTORY_COLUMN + SpreadsheetHeaderSelect.HISTORY_FIXED_VALUES, ""); 5148a6eb0cf5777dded2354408e8007d9223e813c92showard Utils.setDefaultValue(arguments, HISTORY_SHOW_INCOMPLETE, Boolean.toString(false)); 5158a6eb0cf5777dded2354408e8007d9223e813c92showard Utils.setDefaultValue(arguments, HISTORY_ONLY_LATEST, Boolean.toString(false)); 51635444864c7b6f49865a7e17aa0052987b72e4728showard } 51735444864c7b6f49865a7e17aa0052987b72e4728showard 51835444864c7b6f49865a7e17aa0052987b72e4728showard private void switchToTable(final TestSet tests, boolean isTriageView) { 51964aeecdec485192241e5377b3fa5ac7cf57a0c12showard commonPanel.refineCondition(tests); 520ce12f55f4530950f7fc6ddc73d1867ebb954d356showard TableViewConfig config; 521ce12f55f4530950f7fc6ddc73d1867ebb954d356showard if (isTriageView) { 522ce12f55f4530950f7fc6ddc73d1867ebb954d356showard config = TableViewConfig.TRIAGE; 523313ab769319f56b940a2784cc0cbdebd005c5799showard refineConditionForTriage(); 524ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } else { 525ce12f55f4530950f7fc6ddc73d1867ebb954d356showard config = TableViewConfig.DEFAULT; 526ce12f55f4530950f7fc6ddc73d1867ebb954d356showard } 527ce12f55f4530950f7fc6ddc73d1867ebb954d356showard listener.onSwitchToTable(config); 52835444864c7b6f49865a7e17aa0052987b72e4728showard } 52935444864c7b6f49865a7e17aa0052987b72e4728showard 530313ab769319f56b940a2784cc0cbdebd005c5799showard private void refineConditionForTriage() { 531313ab769319f56b940a2784cc0cbdebd005c5799showard commonPanel.refineCondition("status != 'GOOD'"); 532313ab769319f56b940a2784cc0cbdebd005c5799showard } 533313ab769319f56b940a2784cc0cbdebd005c5799showard 53435444864c7b6f49865a7e17aa0052987b72e4728showard public ContextMenu getActionMenu() { 53535444864c7b6f49865a7e17aa0052987b72e4728showard TestSet tests; 53635444864c7b6f49865a7e17aa0052987b72e4728showard if (selectionManager.isEmpty()) { 53735444864c7b6f49865a7e17aa0052987b72e4728showard tests = getWholeTableTestSet(); 53835444864c7b6f49865a7e17aa0052987b72e4728showard } else { 53935444864c7b6f49865a7e17aa0052987b72e4728showard tests = getTestSet(selectionManager.getSelectedCells()); 54035444864c7b6f49865a7e17aa0052987b72e4728showard } 54135444864c7b6f49865a7e17aa0052987b72e4728showard return getContextMenu(tests, DrilldownType.DRILLDOWN_BOTH); 54235444864c7b6f49865a7e17aa0052987b72e4728showard } 54335444864c7b6f49865a7e17aa0052987b72e4728showard 5443d6ae118f69717e68bc15b9aed7b6a6c7dd9bab0showard public void onExportCsv() { 545194a59d6976a5dbd5b464fb2b14ceb089f91c050showard JSONObject params = new JSONObject(); 546194a59d6976a5dbd5b464fb2b14ceb089f91c050showard contentSelect.addToCondition(params); 5478a7f36583afe076a7198d1b34fe109aa491dc277jamesren TkoUtils.doCsvRequest(spreadsheetProcessor.getDataSource(), 548b9c6617bdc063b3b4aa760a0a45190ee069139fdshoward spreadsheetProcessor.getCurrentQuery(), params); 5493d6ae118f69717e68bc15b9aed7b6a6c7dd9bab0showard } 5503d6ae118f69717e68bc15b9aed7b6a6c7dd9bab0showard 55135444864c7b6f49865a7e17aa0052987b72e4728showard public void onSelectAll(boolean ignored) { 55235444864c7b6f49865a7e17aa0052987b72e4728showard selectionManager.selectAll(); 55335444864c7b6f49865a7e17aa0052987b72e4728showard } 55435444864c7b6f49865a7e17aa0052987b72e4728showard 55535444864c7b6f49865a7e17aa0052987b72e4728showard public void onSelectNone() { 55635444864c7b6f49865a7e17aa0052987b72e4728showard selectionManager.clearSelection(); 55735444864c7b6f49865a7e17aa0052987b72e4728showard } 55835444864c7b6f49865a7e17aa0052987b72e4728showard 55935444864c7b6f49865a7e17aa0052987b72e4728showard @Override 56035444864c7b6f49865a7e17aa0052987b72e4728showard protected boolean hasFirstQueryOccurred() { 56135444864c7b6f49865a7e17aa0052987b72e4728showard return !notYetQueried; 56235444864c7b6f49865a7e17aa0052987b72e4728showard } 56335444864c7b6f49865a7e17aa0052987b72e4728showard 56435444864c7b6f49865a7e17aa0052987b72e4728showard private void setLoading(boolean loading) { 56535444864c7b6f49865a7e17aa0052987b72e4728showard queryButton.setEnabled(!loading); 56635444864c7b6f49865a7e17aa0052987b72e4728showard NotifyManager.getInstance().setLoading(loading); 56735444864c7b6f49865a7e17aa0052987b72e4728showard } 5680c31bc5ef2ecdf8edf19468e1a373520110f5bc6showard 5698b0ea2285c1327a686ff0b6ab245915e7fd20094showard @Override 5700c31bc5ef2ecdf8edf19468e1a373520110f5bc6showard public void onSetControlsVisible(boolean visible) { 5710c31bc5ef2ecdf8edf19468e1a373520110f5bc6showard TkoUtils.setElementVisible("ss_all_controls", visible); 5720c31bc5ef2ecdf8edf19468e1a373520110f5bc6showard if (isTabVisible()) { 5730c31bc5ef2ecdf8edf19468e1a373520110f5bc6showard spreadsheet.fillWindow(true); 5740c31bc5ef2ecdf8edf19468e1a373520110f5bc6showard } 5750c31bc5ef2ecdf8edf19468e1a373520110f5bc6showard } 5768b0ea2285c1327a686ff0b6ab245915e7fd20094showard 5778b0ea2285c1327a686ff0b6ab245915e7fd20094showard @Override 5788b0ea2285c1327a686ff0b6ab245915e7fd20094showard public void onFieldsChanged() { 5798b0ea2285c1327a686ff0b6ab245915e7fd20094showard rowSelect.refreshFields(); 5808b0ea2285c1327a686ff0b6ab245915e7fd20094showard columnSelect.refreshFields(); 5818b0ea2285c1327a686ff0b6ab245915e7fd20094showard contentSelect.refreshFields(); 5828b0ea2285c1327a686ff0b6ab245915e7fd20094showard } 58335444864c7b6f49865a7e17aa0052987b72e4728showard} 584