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

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

Issue 728023004: Remove GardeningServer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | « Tools/GardeningServer/model/ct-commit-mock.html ('k') | Tools/GardeningServer/model/ct-failures.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/GardeningServer/model/ct-failure-group.html
diff --git a/Tools/GardeningServer/model/ct-failure-group.html b/Tools/GardeningServer/model/ct-failure-group.html
deleted file mode 100644
index eab5796a6e1475f159d920a3b484caa9b6e60d54..0000000000000000000000000000000000000000
--- a/Tools/GardeningServer/model/ct-failure-group.html
+++ /dev/null
@@ -1,129 +0,0 @@
-<!--
-Copyright 2014 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-commit-list.html">
-
-<script>
-function CTFailureGroup(tree, data, category) {
- this.key = data.key;
- this.tree = tree;
- this.examineUrl = this.tree + '/failure/' + encodeURIComponent(this.key);
- this.data = data;
-
- this._annotation = CTFailureGroup._mergeAnnotations(data.getAnnotations());
- this._originalCategory = category || 'default';
- this._computeProperties();
-}
-
-CTFailureGroup.prototype.snoozeUntil = function(time) {
- return this._annotate({
- snoozeTime: time,
- });
-};
-
-CTFailureGroup.prototype.unsnooze = function() {
- return this._annotate({
- snoozeTime: undefined,
- });
-};
-
-CTFailureGroup.prototype.setBug = function(bug) {
- if (/^[0-9]+$/.test(bug))
- bug = 'https://crbug.com/' + bug;
- return this._annotate({
- bug: bug,
- });
-};
-
-CTFailureGroup.prototype.clearBug = function(bug) {
- return this._annotate({
- bug: undefined,
- });
-};
-
-CTFailureGroup.prototype._isTreeCloser = function() {
- return this.data.isTreeCloser && this.data.isTreeCloser();
-}
-
-CTFailureGroup.prototype._failedOnce = function() {
- return this.data.failedOnce && this.data.failedOnce();
-}
-
-CTFailureGroup.prototype._computeProperties = function() {
- this.isSnoozed = Date.now() < this._annotation.snoozeTime;
- if (this.isSnoozed) {
- this.category = 'snoozed';
- } else if (this._isTreeCloser()) {
- this.category = 'treeCloser';
- } else if (this._failedOnce()) {
- this.category = 'failedOnce';
- } else {
- this.category = this._originalCategory;
- }
-
- this.bug = this._annotation.bug;
- // FIXME: Bug labels would be simpler to implement as a filter in the UI.
- if (this.bug != null)
- this.bugLabel = 'Bug ' + /([0-9]{3,})/.exec(this.bug)[0];
- else
- this.bugLabel = undefined;
-};
-
-CTFailureGroup._mergeAnnotations = function(failureAnnotations) {
- // FIXME: This should be a union of all bugs.
- var bug = failureAnnotations.map('bug').compact().first();
-
- // The group is only snoozed if all the failures specify a snooze-time, and only
- // until the first has elapsed.
- var snoozeTimes = failureAnnotations.map('snoozeTime').compact();
- var snoozeTime = snoozeTimes.length < failureAnnotations.length ? undefined : snoozeTimes.min();
-
- var annotation = {};
- if (bug != null) {
- annotation.bug = bug;
- }
- if (snoozeTime != null) {
- annotation.snoozeTime = snoozeTime;
- }
- return annotation;
-};
-
-CTFailureGroup.prototype._annotate = function(newAnnotation) {
- var failureAnnotations = [];
- // FIXME: Post the new annotation to frontend rather than storing locally.
- return CTFailureGroup.fetchAnnotations().then(function(annotations) {
- this.data.failureKeys().forEach(function(failureKey) {
- var annotation = annotations[failureKey] || {};
-
- Object.keys(newAnnotation, function(key, value) {
- if (value === undefined) {
- delete annotation[key];
- } else {
- annotation[key] = value;
- }
- });
-
- if (Object.size(annotation) == 0) {
- delete annotations[failureKey];
- } else {
- annotations[failureKey] = annotation;
- failureAnnotations.push(annotation);
- }
- });
-
- localStorage.CTFailureGroupAnnotations = JSON.stringify(annotations);
- this._annotation = CTFailureGroup._mergeAnnotations(failureAnnotations);
- this._computeProperties();
- }.bind(this));
-};
-
-CTFailureGroup.fetchAnnotations = function() {
- // FIXME: Fetch annotations from frontend.
- var stored = localStorage.CTFailureGroupAnnotations;
- var annotations = stored ? JSON.parse(stored) : {};
- return Promise.resolve(annotations);
-};
-</script>
« no previous file with comments | « Tools/GardeningServer/model/ct-commit-mock.html ('k') | Tools/GardeningServer/model/ct-failures.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698