From 9f1ae465c89bb47f4cbf972bc946f661d6d50b4e Mon Sep 17 00:00:00 2001 From: epoger Date: Thu, 14 Aug 2014 09:55:36 -0700 Subject: [PATCH] rebaseline_server: show Pending Approval tab if viewing SKP expectations vs actuals BUG=skia:1918 NOTREECHECKS=true NOTRY=true R=stephana@google.com Author: epoger@google.com Review URL: https://codereview.chromium.org/473973002 --- gm/rebaseline_server/server.py | 30 +++++++++++++++++++++++++++--- gm/rebaseline_server/static/live-view.html | 11 ++++------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/gm/rebaseline_server/server.py b/gm/rebaseline_server/server.py index cd0b6eb..8277c46 100755 --- a/gm/rebaseline_server/server.py +++ b/gm/rebaseline_server/server.py @@ -349,7 +349,13 @@ class Server(object): @property def is_editable(self): - """ True iff HTTP clients are allowed to submit new GM baselines. """ + """ True iff HTTP clients are allowed to submit new GM baselines. + + TODO(epoger): This only pertains to GM baselines; SKP baselines are + editable whenever expectations vs actuals are shown. + Once we move the GM baselines to use the same code as the SKP baselines, + we can delete this property. + """ return self._editable @property @@ -597,6 +603,21 @@ class HTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): param_dict.get(LIVE_PARAM__SET_A_SECTION, [None])[0]) setB_section = self._validate_summary_section( param_dict.get(LIVE_PARAM__SET_B_SECTION, [None])[0]) + + # If the sets show expectations vs actuals, always show expectations on + # the left (setA). + if ((setA_section == gm_json.JSONKEY_ACTUALRESULTS) and + (setB_section == gm_json.JSONKEY_EXPECTEDRESULTS)): + setA_dirs, setB_dirs = setB_dirs, setA_dirs + setA_section, setB_section = setB_section, setA_section + + # Are we comparing some actuals against expectations stored in the repo? + # If so, we can allow the user to submit new baselines. + is_editable = ( + (setA_section == gm_json.JSONKEY_EXPECTEDRESULTS) and + (setA_dirs[0].startswith(compare_rendered_pictures.REPO_URL_PREFIX)) and + (setB_section == gm_json.JSONKEY_ACTUALRESULTS)) + results_obj = compare_rendered_pictures.RenderedPicturesComparisons( setA_dirs=setA_dirs, setB_dirs=setB_dirs, setA_section=setA_section, setB_section=setB_section, @@ -608,7 +629,8 @@ class HTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): self.send_response(200) else: self.send_json_dict(results_obj.get_packaged_results_of_type( - results_type=results_mod.KEY__HEADER__RESULTS_ALL)) + results_type=results_mod.KEY__HEADER__RESULTS_ALL, + is_editable=is_editable)) def do_GET_live_results(self, url_remainder): """ Handle a GET request for live-generated image diff data. @@ -822,7 +844,9 @@ def main(): 'differences between these config pairs: ' + str(CONFIG_PAIRS_TO_COMPARE))) parser.add_argument('--editable', action='store_true', - help=('Allow HTTP clients to submit new GM baselines.')) + help=('Allow HTTP clients to submit new GM baselines; ' + 'SKP baselines can be edited regardless of this ' + 'setting.')) parser.add_argument('--export', action='store_true', help=('Instead of only allowing access from HTTP clients ' 'on localhost, allow HTTP clients on other hosts ' diff --git a/gm/rebaseline_server/static/live-view.html b/gm/rebaseline_server/static/live-view.html index 721ca2e..0c94c2b 100644 --- a/gm/rebaseline_server/static/live-view.html +++ b/gm/rebaseline_server/static/live-view.html @@ -41,12 +41,6 @@ which records are displayed. -
- WARNING! These results are editable and exported, so any user - who can connect to this server over the network can modify them. -
-
setA: "{{header[constants.KEY__HEADER__SET_A_DESCRIPTIONS][constants.KEY__SET_DESCRIPTIONS__SECTION]}}" within {{header[constants.KEY__HEADER__SET_A_DESCRIPTIONS][constants.KEY__SET_DESCRIPTIONS__DIR]}} @@ -176,10 +170,13 @@
+
+ TODO(epoger): We don't yet support submitting new SKP expectations. +
-- 2.7.4