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

Side by Side Diff: appengine/sheriff_o_matic/ui/ct-time-series-failure-card-buttons.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 unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 Copyright 2015 The Chromium Authors. All rights reserved. 2 Copyright 2015 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be 3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file. 4 found in the LICENSE file.
5 --> 5 --><html><head><link rel="import" href="ct-button.html">
6
7 <link rel="import" href="ct-button.html">
8 <link rel="import" href="../bower_components/paper-dialog/paper-action-dialog.ht ml"> 6 <link rel="import" href="../bower_components/paper-dialog/paper-action-dialog.ht ml">
9 <link rel="import" href="../bower_components/paper-input/paper-input.html"> 7 <link rel="import" href="../bower_components/paper-input/paper-input.html">
10 8
11 <polymer-element name="ct-time-series-failure-card-buttons" attributes="alerts k ey bug"> 9 <dom-module id="ct-time-series-failure-card-buttons">
12 <template> 10 <style>
13 <style>
14 :host { 11 :host {
15 display: flex; 12 display: flex;
16 } 13 }
17 :host > * { 14 :host > * {
18 margin-right: 5px; 15 margin-right: 5px;
19 } 16 }
20 ct-button { 17 ct-button {
21 float: right; 18 float: right;
22 white-space: nowrap; 19 white-space: nowrap;
23 } 20 }
24 </style> 21 </style>
25 <ct-button on-tap="{{ showBugDialog }}" label="Link Bug"> 22 <template>
23 <ct-button on-tap=" showBugDialog " label="Link Bug">
26 </ct-button> 24 </ct-button>
27 <paper-action-dialog heading="Enter bug number" transition="paper-transiti on-center" id="bugDialog"> 25 <paper-action-dialog heading="Enter bug number" transition="paper-transiti on-center" id="bugDialog">
28 <paper-input label="Bug# or URL" floatingLabel value="{{ bug }}" autofoc us id="bug"> 26 <paper-input label="Bug# or URL" always-float-label="" value="{{ bug }}" autofocus="" id="bug">
29 </paper-input> 27 </paper-input>
30 <ct-button on-tap="{{ removeBug }}" role="button" id="dialogRemoveBug" d ismissive label="Remove bug link"> 28 <ct-button on-tap=" removeBug " role="button" id="dialogRemoveBug" dismi ssive="" label="Remove bug link">
31 </ct-button> 29 </ct-button>
32 <ct-button on-tap="{{ saveBug }}" role="button" id="dialogOk" affirmativ e label="OK"> 30 <ct-button on-tap=" saveBug " role="button" id="dialogOk" affirmative="" label="OK">
33 </ct-button> 31 </ct-button>
34 </paper-action-dialog> 32 </paper-action-dialog>
35 <ct-button on-click="{{ toggleDelDialog }}" id="delAlert" label="Dismiss"> 33 <ct-button on-click=" toggleDelDialog " id="delAlert" label="Dismiss">
36 </ct-button> 34 </ct-button>
37 <paper-action-dialog heading="Dismiss alert?" transition="paper-transition -center" id="delBugDialog"> 35 <paper-action-dialog heading="Dismiss alert?" transition="paper-transition -center" id="delBugDialog">
38 <ct-button role="button" dismissive label="Cancel"></ct-button> 36 <ct-button role="button" dismissive="" label="Cancel"></ct-button>
39 <ct-button on-tap="{{ delAlert }}" role="button" affirmative label="Dism iss"></ct-button> 37 <ct-button on-tap=" delAlert " role="button" affirmative="" label="Dismi ss"></ct-button>
40 </paper-action-dialog> 38 </paper-action-dialog>
41 </template> 39 </template>
42 <script> 40 <script>
43 Polymer({ 41 Polymer({
44 42 is: 'ct-time-series-failure-card-buttons',
45 toggleDelDialog: function() { 43 properties: {
44 alerts: { notify: true },
45 bug: { notify: true },
46 key: { notify: true }
47 },
48 toggleDelDialog: function () {
46 this.$.delBugDialog.toggle(); 49 this.$.delBugDialog.toggle();
47 }, 50 },
48 51 delAlert: function () {
49 delAlert: function() {
50 var opt = { 52 var opt = {
51 url: '/ts-alerts/' + this.key, 53 url: '/ts-alerts/' + this.key,
52 type: 'DELETE' 54 type: 'DELETE'
53 }; 55 };
54 return net.ajax(opt).then(function(response) { 56 return net.ajax(opt).then(function (response) {
55 console.log(response); 57 console.log(response);
56 this.alerts = this.alerts.filter(function(a) { 58 this.alerts = this.alerts.filter(function (a) {
57 return a.hash_key !== this.key; 59 return a.hash_key !== this.key;
58 }) 60 });
59 }.bind(this), function(err) { 61 }.bind(this), function (err) {
60 console.log('Failed to delete: ' + err); 62 console.log('Failed to delete: ' + err);
61 }); 63 });
62 }, 64 },
63 65 showBugDialog: function () {
64 showBugDialog: function() {
65 this.$.bugDialog.toggle(); 66 this.$.bugDialog.toggle();
66 }, 67 },
67 68 updateBug: function (key, bug_id) {
68 updateBug: function(key, bug_id) {
69 opt = { 69 opt = {
70 url: '/ts-alerts/' + key, 70 url: '/ts-alerts/' + key,
71 type: 'PUT', 71 type: 'PUT',
72 data: JSON.stringify({'bug_id': bug_id}) 72 data: JSON.stringify({ 'bug_id': bug_id })
73 }; 73 };
74 this.$.bugDialog.toggle(); 74 this.$.bugDialog.toggle();
75 return net.ajax(opt).then(function(response) { 75 return net.ajax(opt).then(function (response) {
76 console.log(response); 76 console.log(response);
77 }.bind(this), function(err) { 77 }.bind(this), function (err) {
78 console.log('Failed to update bug: ' + err); 78 console.log('Failed to update bug: ' + err);
79 }); 79 });
80 }, 80 },
81 81 saveBug: function () {
82 saveBug: function() { 82 bug_id = /([0-9]{3,})/.exec(this.$.bug.value)[0];
83 bug_id = /([0-9]{3,})/.exec(this.$.bug.value)[0]
84
85 if (bug_id != null) { 83 if (bug_id != null) {
86 this.updateBug(this.key, bug_id); 84 this.updateBug(this.key, bug_id);
87 } 85 }
88 }, 86 },
89 87 removeBug: function () {
90 removeBug: function() {
91 this.bug = ''; 88 this.bug = '';
92 this.updateBug(this.key, '') 89 this.updateBug(this.key, '');
93 } 90 }
94 }); 91 });
95 </script> 92 </script>
96 </polymer-element> 93 </dom-module>
OLDNEW
« no previous file with comments | « appengine/sheriff_o_matic/ui/ct-time-series.html ('k') | appengine/sheriff_o_matic/ui/ct-tree-select.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698