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

Side by Side Diff: appengine/swarming/ui/res/imp/taskpage/task-page-data.html

Issue 2832423003: Fix Swarming UI timezone bug (Closed)
Patch Set: Fix copy-pasta and use sk.human Created 3 years, 8 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 2016 The LUCI Authors. All rights reserved. 2 Copyright 2016 The LUCI Authors. All rights reserved.
3 Use of this source code is governed under the Apache License, Version 2.0 3 Use of this source code is governed under the Apache License, Version 2.0
4 that can be found in the LICENSE file. 4 that can be found in the LICENSE file.
5 5
6 This in an HTML Import-able file that contains the definition 6 This in an HTML Import-able file that contains the definition
7 of the following elements: 7 of the following elements:
8 8
9 <task-page-data> 9 <task-page-data>
10 10
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 request.tagMap = {}; 162 request.tagMap = {};
163 request.tags = request.tags || []; 163 request.tags = request.tags || [];
164 request.tags.forEach(function(tag) { 164 request.tags.forEach(function(tag) {
165 var split = tag.split(":", 1) 165 var split = tag.split(":", 1)
166 var key = split[0]; 166 var key = split[0];
167 var rest = tag.substring(key.length + 1); 167 var rest = tag.substring(key.length + 1);
168 request.tagMap[key] = rest; 168 request.tagMap[key] = rest;
169 }); 169 });
170 170
171 TIMES.forEach(function(time) { 171 TIMES.forEach(function(time) {
172 if (request[time]) { 172 swarming.sanitizeAndHumanizeTime(request, time);
173 request[time] = new Date(request[time]);
174 request["human_"+time] = sk.human.localeTime(request[time]);
175 }
176 }); 173 });
177 return request; 174 return request;
178 }, 175 },
179 176
180 _parseResult: function(result) { 177 _parseResult: function(result) {
181 if (!result) { 178 if (!result) {
182 return {}; 179 return {};
183 } 180 }
184 var now = new Date(); 181 var now = new Date();
185 TIMES.forEach(function(time) { 182 TIMES.forEach(function(time) {
186 if (result[time]) { 183 swarming.sanitizeAndHumanizeTime(result, time);
187 result[time] = new Date(result[time]);
188 result["human_"+time] = sk.human.localeTime(result[time]);
189 }
190 }); 184 });
191 // Running tasks have no duration set, so we can figure it out. 185 // Running tasks have no duration set, so we can figure it out.
192 if (!result.duration && result.state === this.RUNNING && result.started_ ts){ 186 if (!result.duration && result.state === this.RUNNING && result.started_ ts){
193 result.duration = (now - result.started_ts) / 1000; 187 result.duration = (now - result.started_ts) / 1000;
194 } 188 }
195 // Make the duration human readable 189 // Make the duration human readable
196 if (result.duration){ 190 if (result.duration){
197 result.human_duration = this._humanDuration(result.duration); 191 result.human_duration = this._humanDuration(result.duration);
198 } 192 }
199 return result; 193 return result;
200 }, 194 },
201 195
202 _parseStdout: function(stdout) { 196 _parseStdout: function(stdout) {
203 if (!stdout || !stdout.output) { 197 if (!stdout || !stdout.output) {
204 return ""; 198 return "";
205 } 199 }
206 return stdout.output; 200 return stdout.output;
207 }, 201 },
208 202
209 reloadStdout: function() { 203 reloadStdout: function() {
210 this._getJsonAsync("_stdout", "/api/swarming/v1/task/" + 204 this._getJsonAsync("_stdout", "/api/swarming/v1/task/" +
211 this.task_id + "/stdout", "_busy3", this.auth_headers); 205 this.task_id + "/stdout", "_busy3", this.auth_headers);
212 }, 206 },
213 207
214 }); 208 });
215 })(); 209 })();
216 </script> 210 </script>
217 </dom-module> 211 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698