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

Side by Side Diff: gm/rebaseline_server/static/loader.js

Issue 270413002: rebaseline_server JSON: pass category values as values, not keys (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 7 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
« no previous file with comments | « gm/rebaseline_server/static/constants.js ('k') | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.extraColumnHeaders and $scope.imagePairs . 4 * them into $scope.extraColumnHeaders and $scope.imagePairs .
5 */ 5 */
6 var Loader = angular.module( 6 var Loader = angular.module(
7 'Loader', 7 'Loader',
8 ['ConstantsModule'] 8 ['ConstantsModule']
9 ); 9 );
10 10
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 $scope.selectedImagePairs = []; 141 $scope.selectedImagePairs = [];
142 142
143 // Sets within which the user can toggle individual elements. 143 // Sets within which the user can toggle individual elements.
144 $scope.hiddenResultTypes = {}; 144 $scope.hiddenResultTypes = {};
145 $scope.hiddenResultTypes[ 145 $scope.hiddenResultTypes[
146 constants.KEY__RESULT_TYPE__FAILUREIGNORED] = true; 146 constants.KEY__RESULT_TYPE__FAILUREIGNORED] = true;
147 $scope.hiddenResultTypes[ 147 $scope.hiddenResultTypes[
148 constants.KEY__RESULT_TYPE__NOCOMPARISON] = true; 148 constants.KEY__RESULT_TYPE__NOCOMPARISON] = true;
149 $scope.hiddenResultTypes[ 149 $scope.hiddenResultTypes[
150 constants.KEY__RESULT_TYPE__SUCCEEDED] = true; 150 constants.KEY__RESULT_TYPE__SUCCEEDED] = true;
151 $scope.allResultTypes = Object.keys( 151 $scope.allResultTypes = $scope.columnSliceOf2DArray(
152 $scope.extraColumnHeaders[constants.KEY__EXTRACOLUMN__RESULT_TYPE] 152 $scope.extraColumnHeaders[constants.KEY__EXTRACOLUMN__RESULT_TYPE]
153 [constants.KEY__VALUES_AND_COUNTS]); 153 [constants.KEY__EXTRACOLUMNHEADERS__VALUE S_AND_COUNTS],
154 0);
154 $scope.hiddenConfigs = {}; 155 $scope.hiddenConfigs = {};
155 $scope.allConfigs = Object.keys( 156 $scope.allConfigs = $scope.columnSliceOf2DArray(
156 $scope.extraColumnHeaders[constants.KEY__EXTRACOLUMN__CONFIG] 157 $scope.extraColumnHeaders[constants.KEY__EXTRACOLUMN__CONFIG]
157 [constants.KEY__VALUES_AND_COUNTS]); 158 [constants.KEY__EXTRACOLUMNHEADERS__VALUE S_AND_COUNTS],
159 0);
158 160
159 // Associative array of partial string matches per category. 161 // Associative array of partial string matches per category.
160 $scope.categoryValueMatch = {}; 162 $scope.categoryValueMatch = {};
161 $scope.categoryValueMatch.builder = ""; 163 $scope.categoryValueMatch.builder = "";
162 $scope.categoryValueMatch.test = ""; 164 $scope.categoryValueMatch.test = "";
163 165
164 // If any defaults were overridden in the URL, get them now. 166 // If any defaults were overridden in the URL, get them now.
165 $scope.queryParameters.load(); 167 $scope.queryParameters.load();
166 168
167 // Any image URLs which are relative should be relative to the JSON 169 // Any image URLs which are relative should be relative to the JSON
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } 739 }
738 } 740 }
739 741
740 742
741 // 743 //
742 // Miscellaneous utility functions. 744 // Miscellaneous utility functions.
743 // TODO(epoger): move into a separate .js file? 745 // TODO(epoger): move into a separate .js file?
744 // 746 //
745 747
746 /** 748 /**
749 * Returns a single "column slice" of a 2D array.
750 *
751 * For example, if array is:
752 * [[A0, A1],
753 * [B0, B1],
754 * [C0, C1]]
755 * and index is 0, this this will return:
756 * [A0, B0, C0]
757 *
758 * @param array a Javascript Array
759 * @param column (numeric): index within each row array
760 */
761 $scope.columnSliceOf2DArray = function(array, column) {
762 var slice = [];
763 var numRows = array.length;
764 for (var row = 0; row < numRows; row++) {
765 slice.push(array[row][column]);
766 }
767 return slice;
768 }
769
770 /**
747 * Returns a human-readable (in local time zone) time string for a 771 * Returns a human-readable (in local time zone) time string for a
748 * particular moment in time. 772 * particular moment in time.
749 * 773 *
750 * @param secondsPastEpoch (numeric): seconds past epoch in UTC 774 * @param secondsPastEpoch (numeric): seconds past epoch in UTC
751 */ 775 */
752 $scope.localTimeString = function(secondsPastEpoch) { 776 $scope.localTimeString = function(secondsPastEpoch) {
753 var d = new Date(secondsPastEpoch * 1000); 777 var d = new Date(secondsPastEpoch * 1000);
754 return d.toString(); 778 return d.toString();
755 } 779 }
756 780
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 */ 827 */
804 $scope.getImageDiffRelativeUrl = function(imagePair) { 828 $scope.getImageDiffRelativeUrl = function(imagePair) {
805 var before = 829 var before =
806 imagePair[constants.KEY__IMAGE_A_URL] + "-vs-" + 830 imagePair[constants.KEY__IMAGE_A_URL] + "-vs-" +
807 imagePair[constants.KEY__IMAGE_B_URL]; 831 imagePair[constants.KEY__IMAGE_B_URL];
808 return before.replace(/[^\w\-]/g, "_") + ".png"; 832 return before.replace(/[^\w\-]/g, "_") + ".png";
809 } 833 }
810 834
811 } 835 }
812 ); 836 );
OLDNEW
« no previous file with comments | « gm/rebaseline_server/static/constants.js ('k') | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698