| OLD | NEW |
| 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 <link rel="import" href="ct-commit-list.html"> | 7 <link rel="import" href="ct-commit-list.html"> |
| 8 <link rel="import" href="ct-tree-list.html"> | 8 <link rel="import" href="ct-tree-list.html"> |
| 9 | 9 |
| 10 <script> | 10 <script> |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 fullChange[0][kind] = change; | 128 fullChange[0][kind] = change; |
| 129 | 129 |
| 130 return net.ajax({ | 130 return net.ajax({ |
| 131 type: 'POST', | 131 type: 'POST', |
| 132 data: JSON.stringify(fullChange), | 132 data: JSON.stringify(fullChange), |
| 133 url: '/api/v1/annotations/' + this.key, | 133 url: '/api/v1/annotations/' + this.key, |
| 134 }).then(function(data) { | 134 }).then(function(data) { |
| 135 var parsed = JSON.parse(data); | 135 var parsed = JSON.parse(data); |
| 136 CTFailureGroup._annotations[parsed.key] = parsed; | 136 CTFailureGroup._annotations[parsed.key] = parsed; |
| 137 this._computeProperties(); | 137 this._computeProperties(); |
| 138 }.bind(this), function(reject) { |
| 139 if (this.errorCallback) { |
| 140 this.errorCallback(reject); |
| 141 } |
| 138 }.bind(this)); | 142 }.bind(this)); |
| 139 }; | 143 }; |
| 140 | 144 |
| 141 | 145 |
| 142 CTFailureGroup.prototype.fetchAnnotations = function() { | 146 CTFailureGroup.prototype.fetchAnnotations = function() { |
| 143 return net.json('/api/v1/annotations/' + this.key).then(function(data) { | 147 return net.json('/api/v1/annotations/' + this.key).then(function(data) { |
| 144 CTFailureGroup._annotations[data.key] = data; | 148 CTFailureGroup._annotations[data.key] = data; |
| 145 this._computeProperties(); | 149 this._computeProperties(); |
| 146 }.bind(this)); | 150 }.bind(this)); |
| 147 }; | 151 }; |
| 148 | 152 |
| 149 CTFailureGroup.fetchAllAnnotations = function() { | 153 CTFailureGroup.fetchAllAnnotations = function() { |
| 150 return net.json('/api/v1/annotations').then(function(data) { | 154 return net.json('/api/v1/annotations').then(function(data) { |
| 151 if (CTFailureGroup._annotations == null) { | 155 if (CTFailureGroup._annotations == null) { |
| 152 CTFailureGroup._annotations = {}; | 156 CTFailureGroup._annotations = {}; |
| 153 } | 157 } |
| 154 | 158 |
| 155 data.forEach(function(annotation) { | 159 data.forEach(function(annotation) { |
| 156 CTFailureGroup._annotations[annotation.key] = annotation; | 160 CTFailureGroup._annotations[annotation.key] = annotation; |
| 157 }) | 161 }) |
| 158 return data; | 162 return data; |
| 159 }); | 163 }); |
| 160 }; | 164 }; |
| 161 | 165 |
| 162 </script> | 166 </script> |
| OLD | NEW |