From d9bf7dbf0931a626d3f685163fb12913c58f48b8 Mon Sep 17 00:00:00 2001 From: stephana Date: Fri, 8 Aug 2014 07:21:00 -0700 Subject: [PATCH] Rebaseline-server: sorting of columns in asc/desc order in frontend. NOTRY=true BUG=skia:1907 R=epoger@google.com Author: stephana@google.com Review URL: https://codereview.chromium.org/449843002 --- gm/rebaseline_server/static/constants.js | 4 + gm/rebaseline_server/static/live-loader.js | 15 ++- gm/rebaseline_server/static/live-view.html | 73 +++++++-------- gm/rebaseline_server/static/loader.js | 101 +++++++++++++-------- gm/rebaseline_server/static/view.css | 14 +++ gm/rebaseline_server/static/view.html | 77 ++++++++-------- 6 files changed, 163 insertions(+), 121 deletions(-) diff --git a/gm/rebaseline_server/static/constants.js b/gm/rebaseline_server/static/constants.js index 150c8959f..c39745224 100644 --- a/gm/rebaseline_server/static/constants.js +++ b/gm/rebaseline_server/static/constants.js @@ -80,5 +80,9 @@ module.constant('constants', (function() { KEY__IMAGEPAIRS__ROWSPAN: 'rowspan', URL_KEY__SCHEMA_VERSION: 'urlSchemaVersion', URL_VALUE__SCHEMA_VERSION__CURRENT: 1, + + // Utility constants only used on the client side. + ASC: 'asc', + DESC: 'desc', } })()) diff --git a/gm/rebaseline_server/static/live-loader.js b/gm/rebaseline_server/static/live-loader.js index 00800682f..16a19aab7 100644 --- a/gm/rebaseline_server/static/live-loader.js +++ b/gm/rebaseline_server/static/live-loader.js @@ -133,6 +133,9 @@ Loader.controller( $scope.setBSection = $location.search().setBSection; $scope.loadingMessage = "please wait..."; + var currSortAsc = true; + + /** * On initial page load, load a full dictionary of results. * Once the dictionary is loaded, unhide the page elements so they can @@ -175,8 +178,11 @@ Loader.controller( $scope.orderedColumnNames = data[constants.KEY__ROOT__EXTRACOLUMNORDER]; $scope.imagePairs = data[constants.KEY__ROOT__IMAGEPAIRS]; $scope.imageSets = data[constants.KEY__ROOT__IMAGESETS]; + + // set the default sort column and make it ascending. $scope.sortColumnSubdict = constants.KEY__IMAGEPAIRS__DIFFERENCES; $scope.sortColumnKey = constants.KEY__DIFFERENCES__PERCEPTUAL_DIFF; + currSortAsc = true; $scope.showSubmitAdvancedSettings = false; $scope.submitAdvancedSettings = {}; @@ -610,14 +616,7 @@ Loader.controller( // array copies? (For better performance.) if ($scope.viewingTab == $scope.defaultTab) { - - // TODO(epoger): Until we allow the user to reverse sort order, - // there are certain columns we want to sort in a different order. - var doReverse = ( - ($scope.sortColumnKey == - constants.KEY__DIFFERENCES__PERCENT_DIFF_PIXELS) || - ($scope.sortColumnKey == - constants.KEY__DIFFERENCES__PERCEPTUAL_DIFF)); + var doReverse = !currSortAsc; $scope.filteredImagePairs = $filter("orderBy")( diff --git a/gm/rebaseline_server/static/live-view.html b/gm/rebaseline_server/static/live-view.html index 5292f3b96..2f8241e04 100644 --- a/gm/rebaseline_server/static/live-view.html +++ b/gm/rebaseline_server/static/live-view.html @@ -5,7 +5,7 @@ - + @@ -246,53 +246,54 @@ - - {{extraColumnHeaders[columnName][constants.KEY__EXTRACOLUMNHEADERS__HEADER_TEXT]}} + + {{extraColumnHeaders[columnName][constants.KEY__EXTRACOLUMNHEADERS__HEADER_TEXT]}} + - + + bugs + bugs - - {{imageSets[constants.KEY__IMAGESETS__SET__IMAGE_A][constants.KEY__IMAGESETS__FIELD__DESCRIPTION]}} + + {{imageSets[constants.KEY__IMAGESETS__SET__IMAGE_A][constants.KEY__IMAGESETS__FIELD__DESCRIPTION]}} + - - {{imageSets[constants.KEY__IMAGESETS__SET__IMAGE_B][constants.KEY__IMAGESETS__FIELD__DESCRIPTION]}} + + {{imageSets[constants.KEY__IMAGESETS__SET__IMAGE_B][constants.KEY__IMAGESETS__FIELD__DESCRIPTION]}} + - - differing pixels in white + + differing pixels in white + - - perceptual difference + + perceptual difference +
- + @@ -235,57 +235,58 @@
- +
+
- - {{extraColumnHeaders[columnName][constants.KEY__EXTRACOLUMNHEADERS__HEADER_TEXT]}} + + {{extraColumnHeaders[columnName][constants.KEY__EXTRACOLUMNHEADERS__HEADER_TEXT]}} + - - bugs + + bugs + - - {{imageSets[constants.KEY__IMAGESETS__SET__IMAGE_A][constants.KEY__IMAGESETS__FIELD__DESCRIPTION]}} + + {{imageSets[constants.KEY__IMAGESETS__SET__IMAGE_A][constants.KEY__IMAGESETS__FIELD__DESCRIPTION]}} + - - {{imageSets[constants.KEY__IMAGESETS__SET__IMAGE_B][constants.KEY__IMAGESETS__FIELD__DESCRIPTION]}} + + {{imageSets[constants.KEY__IMAGESETS__SET__IMAGE_B][constants.KEY__IMAGESETS__FIELD__DESCRIPTION]}} + - - differing pixels in white + + differing pixels in white + - - perceptual difference + + perceptual difference +