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

Unified Diff: dashboard/dashboard/group_report.py

Issue 2537053003: Changing group reports to use an id for multiple keys. (Closed)
Patch Set: added test Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dashboard/dashboard/elements/group-report-page.html ('k') | dashboard/dashboard/group_report_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/group_report.py
diff --git a/dashboard/dashboard/group_report.py b/dashboard/dashboard/group_report.py
index a9f8bd32b38536307ace3be27bf4bff9df2938ad..9e96e1ff44957bc79e5b97745c25cf481b384f79 100644
--- a/dashboard/dashboard/group_report.py
+++ b/dashboard/dashboard/group_report.py
@@ -15,6 +15,7 @@ from dashboard import update_test_suites
from dashboard.common import request_handler
from dashboard.common import utils
from dashboard.models import anomaly
+from dashboard.models import page_state
from dashboard.models import stoppage_alert
# This is the max number of alerts to query at once. This is used in cases
@@ -35,19 +36,29 @@ class GroupReportHandler(chart_handler.ChartHandler):
def post(self):
"""Returns dynamic data for /group_report with some set of alerts.
- The set of alerts is determined by the keys, bug ID or revision given.
+ The set of alerts is determined by the sid, keys, bug ID, or revision given.
Request parameters:
keys: A comma-separated list of urlsafe Anomaly keys (optional).
bug_id: A bug number on the Chromium issue tracker (optional).
rev: A revision number (optional).
+ sid: A hash of a group of keys from /short_uri (optional).
Outputs:
JSON for the /group_report page XHR request.
"""
- keys = self.request.get('keys')
bug_id = self.request.get('bug_id')
rev = self.request.get('rev')
+ keys = self.request.get('keys')
+ hash_code = self.request.get('sid')
+
+ # sid takes precedence.
+ if hash_code:
+ state = ndb.Key(page_state.PageState, hash_code).get()
+ if state:
+ keys = json.loads(state.value)
+ elif keys:
+ keys = keys.split(',')
try:
if bug_id:
@@ -79,7 +90,7 @@ class GroupReportHandler(chart_handler.ChartHandler):
stoppage_alert_query = stoppage_alert.StoppageAlert.query(
stoppage_alert.StoppageAlert.bug_id == bug_id)
stoppage_alerts = stoppage_alert_query.fetch(limit=_DISPLAY_LIMIT)
- self._ShowAlerts(anomalies + stoppage_alerts, bug_id)
+ self._ShowAlerts(anomalies + stoppage_alerts, None, bug_id)
def _ShowAlertsAroundRevision(self, rev):
"""Shows a alerts whose revision range includes the given revision.
@@ -113,7 +124,8 @@ class GroupReportHandler(chart_handler.ChartHandler):
Args:
keys: Comma-separated list of urlsafe strings for Anomaly keys.
"""
- urlsafe_keys = keys.split(',')
+ urlsafe_keys = keys
+
try:
keys = [ndb.Key(urlsafe=k) for k in urlsafe_keys]
# Errors that can be thrown here include ProtocolBufferDecodeError
@@ -153,9 +165,9 @@ class GroupReportHandler(chart_handler.ChartHandler):
anomalies.append(anomaly_entity)
else:
anomalies = requested_anomalies
- self._ShowAlerts(anomalies)
+ self._ShowAlerts(anomalies, urlsafe_keys)
- def _ShowAlerts(self, alert_list, bug_id=None):
+ def _ShowAlerts(self, alert_list, selected_keys=None, bug_id=None):
"""Responds to an XHR from /group_report page with a JSON list of alerts.
Args:
@@ -177,6 +189,7 @@ class GroupReportHandler(chart_handler.ChartHandler):
#'subtests': _GetSubTestsForAlerts(alert_dicts),
'bug_id': bug_id,
'test_suites': update_test_suites.FetchCachedTestSuites(),
+ 'selected_keys': selected_keys,
}
self.GetDynamicVariables(values)
« no previous file with comments | « dashboard/dashboard/elements/group-report-page.html ('k') | dashboard/dashboard/group_report_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698