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

Unified Diff: appengine/sheriff_o_matic/ui/ct-time-series.html

Issue 1315693002: SoM: upgrade Polymer from 0.5 to 1.0 Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: get bower_components from polymer_1.0.4 Created 5 years, 4 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
Index: appengine/sheriff_o_matic/ui/ct-time-series.html
diff --git a/appengine/sheriff_o_matic/ui/ct-time-series.html b/appengine/sheriff_o_matic/ui/ct-time-series.html
index 9f6d8bde27ba223229accd66403e2cef40f6134b..867313288e20ad8341a8be8db532cf7bbeece504 100644
--- a/appengine/sheriff_o_matic/ui/ct-time-series.html
+++ b/appengine/sheriff_o_matic/ui/ct-time-series.html
@@ -2,15 +2,12 @@
Copyright 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
--->
-
-<link rel="import" href="ct-party-time.html">
+--><html><head><link rel="import" href="ct-party-time.html">
<link rel="import" href="ct-time-series-failure-card-buttons.html">
<link rel="import" href="../appengine_module/components/net.html">
-<polymer-element name="ct-time-series" attributes="bug">
- <template>
- <style>
+<dom-module id="ct-time-series">
+ <style>
:host {
background-color: #fffc6c;
}
@@ -33,98 +30,110 @@ found in the LICENSE file.
}
</style>
- <template if="{{ alerts.length == 0 }}">
+ <template>
+ <template is="dom-if" if="{{computeIf(alerts)}}">
<ct-party-time></ct-party-time>
</template>
- <template repeat="{{ alert in alerts }}">
+ <template is="dom-repeat" items="{{alerts}}" as="alert">
<div class="card">
<div class="message">
- <a href="{{ alert.playbook }}" target="_blank">Playbook</a><br>
- <a href="{{ alert.silence }}" target="_blank">Silence</a><br>
- <a href="/ts-alerts/{{alert.hash_key}}"> Details </a>
+ <a target="_blank" href$="{{ alert.playbook }}">Playbook</a><br>
+ <a target="_blank" href$="{{ alert.silence }}">Silence</a><br>
+ <a href$="{{computeHref(alert)}}"> Details </a>
</div>
<ct-time-series-failure-card-buttons key="{{alert.hash_key}}" alerts="{{alerts}}" bug="{{ alert.bug_id }}">
</ct-time-series-failure-card-buttons>
- <div class="message"><b>Error:</b> {{ alert.class_name }}<br>
- <b>Trigger Value:</b> {{ alert.trigger_value }}</div>
- <div class="message"><b>Active Since:</b> {{ alert.active_since }}<br>
- <b>Active Time:</b> {{ alert.active_time }}<br>
- <b>Alert Sent:</b> {{ alert.alert_sent }}</div>
+ <div class="message"><b>Error:</b> <span>{{ alert.class_name }}</span><br>
+ <b>Trigger Value:</b> <span>{{ alert.trigger_value }}</span></div>
+ <div class="message"><b>Active Since:</b> <span>{{ alert.active_since }}</span><br>
+ <b>Active Time:</b> <span>{{ alert.active_time }}</span><br>
+ <b>Alert Sent:</b> <span>{{ alert.alert_sent }}</span></div>
<div class="message">
<b>Targeted fields:</b><br>
- <template repeat="{{ field in _toArray(alert.target_fields)}}">
- {{ field.k }}: {{ field.v }}<br>
+ <template is="dom-repeat" items="{{_toArray(alert.target_fields)}}" as="field">
+ <span>{{ field.k }}</span>: <span>{{ field.v }}</span><br>
</template>
- <template repeat="{{ field in _toArray(alert.metric_fields)}}">
- {{ field.k }}: {{ field.v }}<br>
+ <template is="dom-repeat" items="{{_toArray(alert.metric_fields)}}" as="field">
+ <span>{{ field.k }}</span>: <span>{{ field.v }}</span><br>
</template>
</div>
- <template if="{{ alert.bug_id }}">
+ <template is="dom-if" if="{{ alert.bug_id }}">
<div class="message"><b>Bug:</b>
- <a href="https://crbug.com/{{alert.bug_id}}">{{ alert.bug_id }}</a><br>
+ <a href$="{{computeHref2(alert)}}">{{ alert.bug_id }}</a><br>
</div>
</template>
</div>
</template>
- <template if="{{ alerts.length != 0 && updated }}" alerts="alerts">
- <ct-button on-click="{{ toggleDelDialog }}" id="clearAlerts" label="Clear All Alerts">
+ <template is="dom-if" if="{{computeIf(alerts, updated)}}" alerts="{{computeIf2(alerts, updated)}}">
+ <ct-button on-click=" toggleDelDialog " id="clearAlerts" label="Clear All Alerts">
</ct-button>
<paper-action-dialog heading="Dismiss all alerts?" transition="paper-transition-center" id="delBugDialog">
- <ct-button role="button" dismissive label="Cancel"></ct-button>
- <ct-button on-tap="{{ clearAlerts }}" role="button" affirmative label="Dismiss"></ct-button>
+ <ct-button role="button" dismissive="" label="Cancel"></ct-button>
+ <ct-button on-tap=" clearAlerts " role="button" affirmative="" label="Dismiss"></ct-button>
</paper-action-dialog>
</template>
</template>
<script>
-
- (function() {
-
- Polymer('ct-time-series', {
-
- ready: function() {
- this.update();
- },
-
- update: function() {
- var alerts_url = '/ts-alerts';
- return net.json(alerts_url).then(function(data) {
- if (data['redirect-url']) {
- url = data['redirect-url']
- url = url.replace('ts-alerts', 'time-series-alerts');
- window.location.replace(url);
+ (function () {
+ Polymer({
+ is: 'ct-time-series',
+ properties: { bug: { notify: true } },
+ ready: function () {
+ this.update();
+ },
+ update: function () {
+ var alerts_url = '/ts-alerts';
+ return net.json(alerts_url).then(function (data) {
+ if (data['redirect-url']) {
+ url = data['redirect-url'];
+ url = url.replace('ts-alerts', 'time-series-alerts');
+ window.location.replace(url);
+ } else {
+ this.alerts = data.alerts;
+ this.updated = true;
+ }
+ }.bind(this));
+ },
+ _toArray: function (obj) {
+ if (obj) {
+ return Object.keys(obj).map(function (key) {
+ return {
+ k: key.remove('metric:'),
+ v: obj[key]
+ };
+ });
} else {
- this.alerts = data.alerts;
- this.updated = true;
+ return [];
}
- }.bind(this));
- },
-
- _toArray: function(obj) {
- if (obj) {
- return Object.keys(obj).map(function(key) {
- return {k: key.remove('metric:'), v: obj[key]}
+ },
+ toggleDelDialog: function (e, d, target) {
+ this.$.delBugDialog.toggle();
+ },
+ clearAlerts: function (e, d, target) {
+ var opt = {
+ url: '/ts-alerts/all',
+ type: 'DELETE'
+ };
+ return net.ajax(opt).then(function (response) {
+ console.log(response);
+ this.alerts = [];
+ }.bind(this), function (err) {
+ console.log('Failed to delete: ' + err);
});
- } else { return []; }
- },
-
- toggleDelDialog: function(e, d, target) {
- this.$.delBugDialog.toggle();
- },
-
- clearAlerts: function(e, d, target) {
- var opt = {
- url: '/ts-alerts/all',
- type: 'DELETE'
- };
- return net.ajax(opt).then(function(response) {
- console.log(response);
- this.alerts = [];
- }.bind(this), function(err) {
- console.log('Failed to delete: ' + err);
- });
- }
-
- });
- })();
+ },
+ computeIf: function (alerts) {
+ return alerts.length == 0;
+ },
+ computeIf2: function (alerts, updated) {
+ return alerts.length != 0 && updated;
+ },
+ computeHref: function (alert) {
+ return '/ts-alerts/' + alert.hash_key;
+ },
+ computeHref2: function (alert) {
+ return 'https://crbug.com/' + alert.bug_id;
+ }
+ });
+ }());
</script>
-</polymer-element>
+</dom-module>

Powered by Google App Engine
This is Rietveld 408576698