Index: Tools/GardeningServer/model/ct-failures.html |
diff --git a/Tools/GardeningServer/model/ct-failures.html b/Tools/GardeningServer/model/ct-failures.html |
index bccc35b83127308123be4e05bca40575e2488c1f..de2e4a4ab28c38f2dcb701d521165a7be662ebb3 100644 |
--- a/Tools/GardeningServer/model/ct-failures.html |
+++ b/Tools/GardeningServer/model/ct-failures.html |
@@ -8,13 +8,15 @@ found in the LICENSE file. |
<link rel="import" href="ct-builder-revisions.html"> |
<link rel="import" href="ct-failure.html"> |
<link rel="import" href="ct-failure-group.html"> |
+<link rel="import" href="ct-sheriff-failure-group-data.html"> |
+<link rel="import" href="ct-trooper-failure-group-data.html"> |
<link rel="import" href="ct-commit-list.html"> |
<script> |
function CTFailures(commitLog) { |
this.commitLog = commitLog; |
this.builderLatestRevisions = null; |
- this.failures = null; |
+ this.failures = {} |
this.lastUpdateDate = null; |
// FIXME: Get this from |
@@ -36,13 +38,15 @@ function CTFailures(commitLog) { |
}; |
} |
+// FIXME: This could potentially move onto CTSheriffFailureGroupData as it isn't relevant to |
+// trooper failures. |
// Reverse sorting order, if a > b, return a negative number. |
CTFailures.prototype._failureByTreeListComparator = function(tree, a, b) { |
if (tree === undefined) |
tree = 'chromium'; |
- var rev_a = a.commitList.revisions; |
- var rev_b = b.commitList.revisions; |
+ var rev_a = a.data.commitList.revisions; |
+ var rev_b = b.data.commitList.revisions; |
if (!rev_a || !Object.keys(rev_a).length) { |
if (!rev_b || !Object.keys(rev_b).length) |
@@ -77,23 +81,26 @@ CTFailures.prototype._failureByTreeListComparator = function(tree, a, b) { |
CTFailures.prototype.update = function() { |
var annotationPromise = CTFailureGroup.fetchAnnotations(); |
- net.json('http://sheriff-o-matic.appspot.com/alerts').then(function(data) { |
- annotationPromise.then(function(annotations) { |
- // FIXME: Don't special-case the blink master. |
- this.builderLatestRevisions = new CTBuilderRevisions(data.latest_builder_info['chromium.webkit']); |
- this.failures = {}; |
- this.lastUpdateDate = new Date(data.date * 1000); |
- // Update |failures| with the appropriate CTFailureGroup's for each |
- // tree. |
- data.range_groups.forEach(function(rangeGroup) { |
- this._processFailuresForRangeGroup(rangeGroup, data.alerts, annotations); |
- }.bind(this)); |
- // Sort failure groups so that newer failures are shown at the top |
- // of the UI. |
- Object.keys(this.failures, function (tree, failuresByTree) { |
- this.failures[tree].sort(this._failureByTreeListComparator.bind(this, tree)); |
- }.bind(this)); |
+ Promise.all([annotationPromise, net.json('http://sheriff-o-matic.appspot.com/alerts'), |
+ net.json('http://trooper-o-matic.appspot.com/alerts')]).then(function(data_array) { |
+ var annotations = data_array[0]; |
+ var sheriff_data = data_array[1]; |
+ var trooper_data = data_array[2]; |
+ |
+ // FIXME: Don't special-case the blink master. |
+ this.builderLatestRevisions = new CTBuilderRevisions(sheriff_data.latest_builder_info['chromium.webkit']); |
+ this.lastUpdateDate = new Date(sheriff_data.date * 1000); |
+ // Update |failures| with the appropriate CTFailureGroup's for each |
+ // tree. |
+ sheriff_data.range_groups.forEach(function(rangeGroup) { |
+ this._processFailuresForRangeGroup(rangeGroup, sheriff_data.alerts, annotations); |
}.bind(this)); |
+ // Sort failure groups so that newer failures are shown at the top |
+ // of the UI. |
+ Object.keys(this.failures, function (tree, failuresByTree) { |
+ this.failures[tree].sort(this._failureByTreeListComparator.bind(this, tree)); |
+ }.bind(this)); |
+ this._processTrooperFailures(trooper_data); |
}.bind(this)); |
}; |
@@ -109,6 +116,19 @@ CTFailures.prototype._failureComparator = function(a, b) { |
return 0; |
}; |
+ |
+CTFailures.prototype._processTrooperFailures = function(data) { |
+ var trooper_failures = []; |
+ Object.keys(data, function(failureType, failuresByTree) { |
+ Object.keys(failuresByTree, function(tree, failure) { |
+ if (failure.should_alert) |
ojan
2014/09/04 02:58:43
Put curlies.
shans
2014/09/05 00:08:19
Done.
|
+ trooper_failures.push(new CTFailureGroup( |
+ new CTTrooperFailureGroupData(failure.details, failure.url, failure, failureType, tree))); |
+ }); |
+ }); |
+ this.failures['trooper'] = trooper_failures; |
+}; |
+ |
CTFailures.prototype._processFailuresForRangeGroup = function(rangeGroup, alerts, annotations) { |
var masterToTree = {}; |
Object.keys(this._trees, function(tree, masters) { |
@@ -183,7 +203,7 @@ CTFailures.prototype._processFailuresForRangeGroup = function(rangeGroup, alerts |
if (!this.failures[tree]) |
this.failures[tree] = []; |
var commitList = new CTCommitList(this.commitLog, rangeGroup.likely_revisions); |
- this.failures[tree].push(new CTFailureGroup(failures, commitList)); |
+ this.failures[tree].push(new CTFailureGroup(new CTSheriffFailureGroupData(failures, commitList))); |
}.bind(this)); |
}; |