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

Side by Side Diff: appengine/swarming/elements/res/imp/common/common-behavior.html

Issue 2350853004: Make the buttons on task-page work (Closed) Base URL: git@github.com:luci/luci-py@task-page2
Patch Set: Rebuild Created 4 years, 3 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 It contains the definition of the following Behaviors: 6 It contains the definition of the following Behaviors:
7 7
8 SwarmingBehaviors.CommonBehavior 8 SwarmingBehaviors.CommonBehavior
9 9
10 To use it, include 10 To use it, include
(...skipping 11 matching lines...) Expand all
22 // This behavior wraps up all the shared swarming functionality. 22 // This behavior wraps up all the shared swarming functionality.
23 SwarmingBehaviors.CommonBehavior = { 23 SwarmingBehaviors.CommonBehavior = {
24 24
25 _botLink: function(bot_id) { 25 _botLink: function(bot_id) {
26 if (!bot_id) { 26 if (!bot_id) {
27 return undefined; 27 return undefined;
28 } 28 }
29 return "/newui/bot?id=" + bot_id; 29 return "/newui/bot?id=" + bot_id;
30 }, 30 },
31 31
32 // Create a link to a bot list with the preloaded filters and columns.
33 // filters should be an array of {key:String, value:String} and
34 // columns should be an array of Strings.
35 _botListLink: function(filters, columns) {
36 filters = filters || [];
37 columns = columns || [];
38 var fArr = [];
39 filters.forEach(function(f){
40 fArr.push(f.key + ":" + f.value);
41 });
42 var obj = {
43 filters: fArr,
44 columns: columns,
45 }
46 return "/newui/botlist?" + sk.query.fromParamSet(obj);
47 },
48
32 // _getJsonAsync makes an XHR to a url, parses the response as JSON 49 // _getJsonAsync makes an XHR to a url, parses the response as JSON
33 // and sticks the resulting object into the property with the name given 50 // and sticks the resulting object into the property with the name given
34 // by "bindTo". If busy is defined, the property with that name will be 51 // by "bindTo". If busy is defined, the property with that name will be
35 // set to true while the request is in flight and false afterwards. 52 // set to true while the request is in flight and false afterwards.
36 // request headers (e.g. authentication) and query params will be used if 53 // request headers (e.g. authentication) and query params will be used if
37 // provided. Query params is an object like {String:Array<String>}. On 54 // provided. Query params is an object like {String:Array<String>}. On
38 // error, bindTo will be set to false. It is not set to undefined 55 // error, bindTo will be set to false. It is not set to undefined
39 // because computed values in Polymer don't fire if a property is 56 // because computed values in Polymer don't fire if a property is
40 // undefined. Clients should check that bindTo is not falsey. 57 // undefined. Clients should check that bindTo is not falsey.
41 // To avoid multiple requests clobering one another, an object _jsonAsync 58 // To avoid multiple requests clobering one another, an object _jsonAsync
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return result; 108 return result;
92 }, 109 },
93 110
94 _taskLink: function(task_id) { 111 _taskLink: function(task_id) {
95 if (!task_id) { 112 if (!task_id) {
96 return undefined; 113 return undefined;
97 } 114 }
98 return "/newui/task?id=" + task_id; 115 return "/newui/task?id=" + task_id;
99 }, 116 },
100 117
101 // )timeDiffApprox returns the approximate difference between now and 118 // )timeDiffApprox returns the approximate difference between now and
jcgregorio 2016/09/21 14:22:03 _timeDiffApprox
kjlubick 2016/09/21 14:51:38 Typing is hard. Done.
102 // the specified date. 119 // the specified date.
103 _timeDiffApprox: function(date){ 120 _timeDiffApprox: function(date){
104 if (!date) { 121 if (!date) {
105 return "eons"; 122 return "eons";
106 } 123 }
107 return sk.human.diffDate(date.getTime()); 124 return sk.human.diffDate(date.getTime());
108 }, 125 },
109 126
110 // timeDiffExact returns the exact difference between the two specified 127 // timeDiffExact returns the exact difference between the two specified
111 // dates. E.g. 2d 22h 22m 28s ago If a second date is not provided, 128 // dates. E.g. 2d 22h 22m 28s ago If a second date is not provided,
112 // now is used. 129 // now is used.
113 _timeDiffExact: function(first, second){ 130 _timeDiffExact: function(first, second){
114 if (!first) { 131 if (!first) {
115 return "eons"; 132 return "eons";
116 } 133 }
117 if (!second) { 134 if (!second) {
118 second = new Date(); 135 second = new Date();
119 } 136 }
120 return this._humanDuration((second.getTime() - first.getTime())/1000); 137 return this._humanDuration((second.getTime() - first.getTime())/1000);
121 }, 138 },
122 }; 139 };
123 })(); 140 })();
124 </script> 141 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698