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

Unified Diff: dashboard/dashboard/elements/group-report-page.html

Issue 2621643002: Properly set extraColumns on group-report table for anomaly vs stoppage. (Closed)
Patch Set: addressed review comments 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/alerts.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/elements/group-report-page.html
diff --git a/dashboard/dashboard/elements/group-report-page.html b/dashboard/dashboard/elements/group-report-page.html
index b40ff87f1ce2565b05a24d61578777821b1112b0..71d8997af3a7ba4e018e82e9eb911287f8fbf562 100644
--- a/dashboard/dashboard/elements/group-report-page.html
+++ b/dashboard/dashboard/elements/group-report-page.html
@@ -142,20 +142,7 @@ found in the LICENSE file.
properties: {
extraColumns: {
type: Array,
- value: () => ([
- {
- 'key': 'percent_changed',
- 'label': 'Delta %'
- },
- {
- 'key': 'absolute_delta',
- 'label': 'Abs Delta'
- },
- {
- 'key': 'units',
- 'label': 'Units'
- }
- ])
+ value: () => []
},
loading: {
type: Boolean,
@@ -416,6 +403,47 @@ found in the LICENSE file.
},
/**
+ * Sets the extra columns on the alerts table based on the type of alerts
+ * in the list for the table.
+ */
+ setExtraColumns: function(alertList) {
+ // Make a set of types in the table.
+ var types = new Set(alertList.map(item => item.type));
+
+ // Check if there is only one type.
+ if (types.size === 1) {
+ if (types.has('anomaly')) {
+ // Only anomalies in the table. Use anomaly extraColumns.
+ this.set('extraColumns', [
+ {
+ 'key': 'percent_changed',
+ 'label': 'Delta %'
+ },
+ {
+ 'key': 'absolute_delta',
+ 'label': 'Abs Delta'
+ },
+ {
+ 'key': 'units',
+ 'label': 'Units'
+ }
+ ]);
+ } else {
+ // Only stoppage alerts in the table. Use stoppage extraColumns.
+ this.set('extraColumns', [
+ {
+ 'key': 'last_row_date',
+ 'label': 'Date'
+ }
+ ]);
+ }
+ } else {
+ // Either multiple or no types. Can't set extraColumns.
+ this.set('extraColumns', []);
+ }
+ },
+
+ /**
* The url params determine what data to request from
* /group_report. sid is a hash of a group of keys.
*/
@@ -448,6 +476,7 @@ found in the LICENSE file.
this.xsrfToken = response['xsrf_token'];
this.warningBug = response['warning_bug'];
this.warningMessage = response['warning_message'];
+ this.setExtraColumns(response['alert_list']);
this.alertList = response['alert_list'];
this.selectedKeys = response['selected_keys'];
if (this.warningMessage) {
« no previous file with comments | « dashboard/dashboard/alerts.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698