Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Loader: | 2 * Loader: |
| 3 * Reads GM result reports written out by results.py, and imports | 3 * Reads GM result reports written out by results.py, and imports |
| 4 * them into $scope.categories and $scope.testData . | 4 * them into $scope.categories and $scope.testData . |
| 5 */ | 5 */ |
| 6 var Loader = angular.module( | 6 var Loader = angular.module( |
| 7 'Loader', | 7 'Loader', |
| 8 [] | 8 [] |
| 9 ); | 9 ); |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 return filteredItems; | 35 return filteredItems; |
| 36 }; | 36 }; |
| 37 } | 37 } |
| 38 ); | 38 ); |
| 39 | 39 |
| 40 | 40 |
| 41 Loader.controller( | 41 Loader.controller( |
| 42 'Loader.Controller', | 42 'Loader.Controller', |
| 43 function($scope, $http, $filter, $location) { | 43 function($scope, $http, $filter, $location, $timeout) { |
| 44 $scope.windowTitle = "Loading GM Results..."; | 44 $scope.windowTitle = "Loading GM Results..."; |
| 45 var resultsToLoad = $location.search().resultsToLoad; | 45 var resultsToLoad = $location.search().resultsToLoad; |
| 46 $scope.loadingMessage = "Loading results of type '" + resultsToLoad + | 46 $scope.loadingMessage = "Loading results of type '" + resultsToLoad + |
| 47 "', please wait..."; | 47 "', please wait..."; |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * On initial page load, load a full dictionary of results. | 50 * On initial page load, load a full dictionary of results. |
| 51 * Once the dictionary is loaded, unhide the page elements so they can | 51 * Once the dictionary is loaded, unhide the page elements so they can |
| 52 * render the data. | 52 * render the data. |
| 53 */ | 53 */ |
| 54 $http.get("/results/" + resultsToLoad).success( | 54 $http.get("/results/" + resultsToLoad).success( |
| 55 function(data, status, header, config) { | 55 function(data, status, header, config) { |
| 56 $scope.loadingMessage = "Processing data, please wait..."; | 56 if (data.header.resultsStillLoading) { |
| 57 $scope.loadingMessage = | |
| 58 "Server is still loading initial results; will retry at " + | |
| 59 $scope.localTimeString(data.header.timeNextUpdateAvailable); | |
| 60 $timeout( | |
| 61 function(){location.reload();}, | |
| 62 (data.header.timeNextUpdateAvailable * 1000) - new Date().getTime( )); | |
| 63 } else { | |
| 64 $scope.loadingMessage = "Processing data, please wait..."; | |
| 57 | 65 |
| 58 $scope.header = data.header; | 66 $scope.header = data.header; |
| 59 $scope.categories = data.categories; | 67 $scope.categories = data.categories; |
| 60 $scope.testData = data.testData; | 68 $scope.testData = data.testData; |
| 61 $scope.sortColumn = 'weightedDiffMeasure'; | 69 $scope.sortColumn = 'weightedDiffMeasure'; |
| 62 $scope.showTodos = false; | 70 $scope.showTodos = false; |
| 63 | 71 |
| 64 $scope.showSubmitAdvancedSettings = false; | 72 $scope.showSubmitAdvancedSettings = false; |
| 65 $scope.submitAdvancedSettings = {}; | 73 $scope.submitAdvancedSettings = {}; |
| 66 $scope.submitAdvancedSettings['reviewed-by-human'] = true; | 74 $scope.submitAdvancedSettings['reviewed-by-human'] = true; |
| 67 $scope.submitAdvancedSettings['ignore-failure'] = false; | 75 $scope.submitAdvancedSettings['ignore-failure'] = false; |
| 68 $scope.submitAdvancedSettings['bug'] = ''; | 76 $scope.submitAdvancedSettings['bug'] = ''; |
| 69 | 77 |
| 70 // Create the list of tabs (lists into which the user can file each | 78 // Create the list of tabs (lists into which the user can file each |
| 71 // test). This may vary, depending on isEditable. | 79 // test). This may vary, depending on isEditable. |
| 72 $scope.tabs = [ | 80 $scope.tabs = [ |
|
epoger
2013/12/05 11:51:22
This section is modified only by indentation. I d
| |
| 73 'Unfiled', 'Hidden' | 81 'Unfiled', 'Hidden' |
| 74 ]; | 82 ]; |
| 75 if (data.header.isEditable) { | 83 if (data.header.isEditable) { |
| 76 $scope.tabs = $scope.tabs.concat( | 84 $scope.tabs = $scope.tabs.concat( |
| 77 ['Pending Approval']); | 85 ['Pending Approval']); |
| 86 } | |
| 87 $scope.defaultTab = $scope.tabs[0]; | |
| 88 $scope.viewingTab = $scope.defaultTab; | |
| 89 | |
| 90 // Track the number of results on each tab. | |
| 91 $scope.numResultsPerTab = {}; | |
| 92 for (var i = 0; i < $scope.tabs.length; i++) { | |
| 93 $scope.numResultsPerTab[$scope.tabs[i]] = 0; | |
| 94 } | |
| 95 $scope.numResultsPerTab[$scope.defaultTab] = $scope.testData.length; | |
| 96 | |
| 97 // Add index and tab fields to all records. | |
| 98 for (var i = 0; i < $scope.testData.length; i++) { | |
| 99 $scope.testData[i].index = i; | |
| 100 $scope.testData[i].tab = $scope.defaultTab; | |
| 101 } | |
| 102 | |
| 103 // Arrays within which the user can toggle individual elements. | |
| 104 $scope.selectedItems = []; | |
| 105 | |
| 106 // Sets within which the user can toggle individual elements. | |
| 107 $scope.hiddenResultTypes = { | |
| 108 'failure-ignored': true, | |
| 109 'no-comparison': true, | |
| 110 'succeeded': true, | |
| 111 }; | |
| 112 $scope.allResultTypes = Object.keys(data.categories['resultType']); | |
| 113 $scope.hiddenConfigs = {}; | |
| 114 $scope.allConfigs = Object.keys(data.categories['config']); | |
| 115 | |
| 116 // Associative array of partial string matches per category. | |
| 117 $scope.categoryValueMatch = {}; | |
| 118 $scope.categoryValueMatch.builder = ""; | |
| 119 $scope.categoryValueMatch.test = ""; | |
| 120 | |
| 121 $scope.updateResults(); | |
| 122 $scope.loadingMessage = ""; | |
| 123 $scope.windowTitle = "Current GM Results"; | |
| 78 } | 124 } |
| 79 $scope.defaultTab = $scope.tabs[0]; | |
| 80 $scope.viewingTab = $scope.defaultTab; | |
| 81 | |
| 82 // Track the number of results on each tab. | |
| 83 $scope.numResultsPerTab = {}; | |
| 84 for (var i = 0; i < $scope.tabs.length; i++) { | |
| 85 $scope.numResultsPerTab[$scope.tabs[i]] = 0; | |
| 86 } | |
| 87 $scope.numResultsPerTab[$scope.defaultTab] = $scope.testData.length; | |
| 88 | |
| 89 // Add index and tab fields to all records. | |
| 90 for (var i = 0; i < $scope.testData.length; i++) { | |
| 91 $scope.testData[i].index = i; | |
| 92 $scope.testData[i].tab = $scope.defaultTab; | |
| 93 } | |
| 94 | |
| 95 // Arrays within which the user can toggle individual elements. | |
| 96 $scope.selectedItems = []; | |
| 97 | |
| 98 // Sets within which the user can toggle individual elements. | |
| 99 $scope.hiddenResultTypes = { | |
| 100 'failure-ignored': true, | |
| 101 'no-comparison': true, | |
| 102 'succeeded': true, | |
| 103 }; | |
| 104 $scope.allResultTypes = Object.keys(data.categories['resultType']); | |
| 105 $scope.hiddenConfigs = {}; | |
| 106 $scope.allConfigs = Object.keys(data.categories['config']); | |
| 107 | |
| 108 // Associative array of partial string matches per category. | |
| 109 $scope.categoryValueMatch = {}; | |
| 110 $scope.categoryValueMatch.builder = ""; | |
| 111 $scope.categoryValueMatch.test = ""; | |
| 112 | |
| 113 $scope.updateResults(); | |
| 114 $scope.loadingMessage = ""; | |
| 115 $scope.windowTitle = "Current GM Results"; | |
| 116 } | 125 } |
| 117 ).error( | 126 ).error( |
| 118 function(data, status, header, config) { | 127 function(data, status, header, config) { |
| 119 $scope.loadingMessage = "Failed to load results of type '" | 128 $scope.loadingMessage = "Failed to load results of type '" |
| 120 + resultsToLoad + "'"; | 129 + resultsToLoad + "'"; |
| 121 $scope.windowTitle = "Failed to Load GM Results"; | 130 $scope.windowTitle = "Failed to Load GM Results"; |
| 122 } | 131 } |
| 123 ); | 132 ); |
| 124 | 133 |
| 125 | 134 |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 * | 517 * |
| 509 * @param secondsPastEpoch (numeric): seconds past epoch in UTC | 518 * @param secondsPastEpoch (numeric): seconds past epoch in UTC |
| 510 */ | 519 */ |
| 511 $scope.localTimeString = function(secondsPastEpoch) { | 520 $scope.localTimeString = function(secondsPastEpoch) { |
| 512 var d = new Date(secondsPastEpoch * 1000); | 521 var d = new Date(secondsPastEpoch * 1000); |
| 513 return d.toString(); | 522 return d.toString(); |
| 514 } | 523 } |
| 515 | 524 |
| 516 } | 525 } |
| 517 ); | 526 ); |
| OLD | NEW |