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

Side by Side Diff: Tools/GardeningServer/model/ct-failure-group.html

Issue 476903003: Add a "Link Bug" button to associate a bug with a failure (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 2014 The Chromium Authors. All rights reserved. 2 Copyright 2014 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 -->
6 6
7 <script> 7 <script>
8 function CTFailureGroup(key, failures, annotation) { 8 function CTFailureGroup(key, failures, annotation) {
9 this.key = key; 9 this.key = key;
10 this.failures = failures; 10 this.failures = failures;
11 this.annotation = annotation || {}; 11 this.annotation = annotation || {};
12 this._computeProperties(); 12 this._computeProperties();
13 } 13 }
14 14
15 CTFailureGroup.prototype.snoozeUntil = function(time) { 15 CTFailureGroup.prototype.snoozeUntil = function(time) {
16 return this._annotate({ 16 return this._annotate({
17 snoozeTime: time, 17 snoozeTime: time,
18 }); 18 });
19 }; 19 };
20 20
21 CTFailureGroup.prototype.unsnooze = function() { 21 CTFailureGroup.prototype.unsnooze = function() {
22 return this._annotate({ 22 return this._annotate({
23 snoozeTime: undefined, 23 snoozeTime: undefined,
24 }); 24 });
25 }; 25 };
26 26
27 CTFailureGroup.prototype.setBug = function(bug) {
28 return this._annotate({
29 bugNumber: bug,
ojan 2014/08/15 04:53:39 Can we s/bugNumber/bug and have the value actually
cbiesinger 2014/08/16 00:46:15 Done.
30 });
31 };
32
27 CTFailureGroup.prototype._computeProperties = function() { 33 CTFailureGroup.prototype._computeProperties = function() {
28 this.isSnoozed = Date.now() < this.annotation.snoozeTime; 34 this.isSnoozed = Date.now() < this.annotation.snoozeTime;
35 this.hasBug = this.annotation.bugNumber !== undefined;
ojan 2014/08/15 04:53:39 Lets just set this.bug. Also, we should make ann
cbiesinger 2014/08/16 00:46:15 Done.
29 }; 36 };
30 37
31 CTFailureGroup.prototype._annotate = function(newAnnotation) { 38 CTFailureGroup.prototype._annotate = function(newAnnotation) {
32 // FIXME: Post the new annotation to frontend rather than storing locally. 39 // FIXME: Post the new annotation to frontend rather than storing locally.
33 return CTFailureGroup.fetchAnnotations().then(function(annotations) { 40 return CTFailureGroup.fetchAnnotations().then(function(annotations) {
34 var annotation = annotations[this.key] || {}; 41 var annotation = annotations[this.key] || {};
35 42
36 Object.keys(newAnnotation, function(key, value) { 43 Object.keys(newAnnotation, function(key, value) {
37 if (value === 'undefined') { 44 if (value === 'undefined') {
38 delete annotation[key]; 45 delete annotation[key];
(...skipping 15 matching lines...) Expand all
54 }.bind(this)); 61 }.bind(this));
55 }; 62 };
56 63
57 CTFailureGroup.fetchAnnotations = function() { 64 CTFailureGroup.fetchAnnotations = function() {
58 // FIXME: Fetch annotations from frontend. 65 // FIXME: Fetch annotations from frontend.
59 var stored = localStorage.CTFailureGroupAnnotations; 66 var stored = localStorage.CTFailureGroupAnnotations;
60 var annotations = stored ? JSON.parse(stored) : {}; 67 var annotations = stored ? JSON.parse(stored) : {};
61 return Promise.resolve(annotations); 68 return Promise.resolve(annotations);
62 }; 69 };
63 </script> 70 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698