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

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

Issue 2410573002: Make new UI be the default UI (Closed)
Patch Set: simplify regex Created 4 years, 2 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
11 behaviors: [SwarmingBehaviors.CommonBehavior] 11 behaviors: [SwarmingBehaviors.CommonBehavior]
12 in the creation of any Polymer element. 12 in the creation of any Polymer element.
13 13
14 SwarmingBehaviors.CommonBehavior contains shared methods to ease 14 SwarmingBehaviors.CommonBehavior contains shared methods to ease
15 templating, such as _or() and _not() as well as general utility methods 15 templating, such as _or() and _not() as well as general utility methods
16 such as _getJsonAsync. 16 such as _getJsonAsync.
17 --> 17 -->
18 18
19 <script> 19 <script>
20 window.SwarmingBehaviors = window.SwarmingBehaviors || {}; 20 window.SwarmingBehaviors = window.SwarmingBehaviors || {};
21 (function(){ 21 (function(){
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 "/bot?id=" + bot_id;
30 }, 30 },
31 31
32 // Create a link to a bot list with the preloaded filters and columns. 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 33 // filters should be an array of {key:String, value:String} and
34 // columns should be an array of Strings. 34 // columns should be an array of Strings.
35 _botListLink: function(filters, columns) { 35 _botListLink: function(filters, columns) {
36 filters = filters || []; 36 filters = filters || [];
37 columns = columns || []; 37 columns = columns || [];
38 var fArr = []; 38 var fArr = [];
39 filters.forEach(function(f){ 39 filters.forEach(function(f){
40 fArr.push(f.key + ":" + f.value); 40 fArr.push(f.key + ":" + f.value);
41 }); 41 });
42 var obj = { 42 var obj = {
43 f: fArr, 43 f: fArr,
44 c: columns, 44 c: columns,
45 } 45 }
46 return "/newui/botlist?" + sk.query.fromParamSet(obj); 46 return "/botlist?" + sk.query.fromParamSet(obj);
47 }, 47 },
48 48
49 // Create a link to a bot in Google Cloud Console. Cloud console will try 49 // Create a link to a bot in Google Cloud Console. Cloud console will try
50 // to find the bot in the last project the user was logged in as, which 50 // to find the bot in the last project the user was logged in as, which
51 // is the best we can do atm. 51 // is the best we can do atm.
52 _cloudConsoleLink: function(zone, bot_id) { 52 _cloudConsoleLink: function(zone, bot_id) {
53 return `http://console.cloud.google.com/compute/instancesDetail/zones/${ zone}/instances/${bot_id}` 53 return `http://console.cloud.google.com/compute/instancesDetail/zones/${ zone}/instances/${bot_id}`
54 }, 54 },
55 55
56 // _getJsonAsync makes an XHR to a url, parses the response as JSON 56 // _getJsonAsync makes an XHR to a url, parses the response as JSON
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return undefined; 120 return undefined;
121 } 121 }
122 if (!disableCanonicalID) { 122 if (!disableCanonicalID) {
123 // task abcefgh0 is the "canonical" task id. The first try has the id 123 // task abcefgh0 is the "canonical" task id. The first try has the id
124 // abcefgh1. If there is a second (transparent retry), it will be 124 // abcefgh1. If there is a second (transparent retry), it will be
125 // abcefgh2. We almost always want to link to the canonical one, 125 // abcefgh2. We almost always want to link to the canonical one,
126 // because the milo output (if any) will only be generated for 126 // because the milo output (if any) will only be generated for
127 // abcefgh0, not abcefgh1 or abcefgh2. 127 // abcefgh0, not abcefgh1 or abcefgh2.
128 taskId = taskId.substring(0, taskId.length - 1) + "0"; 128 taskId = taskId.substring(0, taskId.length - 1) + "0";
129 } 129 }
130 return "/newui/task?id=" + taskId; 130 return "/task?id=" + taskId;
131 }, 131 },
132 132
133 // _timeDiffApprox returns the approximate difference between now and 133 // _timeDiffApprox returns the approximate difference between now and
134 // the specified date. 134 // the specified date.
135 _timeDiffApprox: function(date){ 135 _timeDiffApprox: function(date){
136 if (!date) { 136 if (!date) {
137 return "eons"; 137 return "eons";
138 } 138 }
139 return sk.human.diffDate(date.getTime()); 139 return sk.human.diffDate(date.getTime());
140 }, 140 },
(...skipping 10 matching lines...) Expand all
151 } 151 }
152 return this._humanDuration((second.getTime() - first.getTime())/1000); 152 return this._humanDuration((second.getTime() - first.getTime())/1000);
153 }, 153 },
154 154
155 _truthy: function(a){ 155 _truthy: function(a){
156 return !!a; 156 return !!a;
157 } 157 }
158 }; 158 };
159 })(); 159 })();
160 </script> 160 </script>
OLDNEW
« no previous file with comments | « appengine/swarming/ui/build/elements.html ('k') | appengine/swarming/ui/res/imp/common/swarming-app.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698