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

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

Issue 2372553003: Show bootstrap and server bot_code version (Closed) Base URL: git@github.com:luci/luci-py@bootstrap
Patch Set: rebase 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 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 <swarming-index> 9 <swarming-index>
10 10
(...skipping 29 matching lines...) Expand all
40 margin-top: 10px; 40 margin-top: 10px;
41 white-space: pre-wrap; 41 white-space: pre-wrap;
42 background-color: #f5f5f5; 42 background-color: #f5f5f5;
43 border: 1px solid #ccc; 43 border: 1px solid #ccc;
44 border-radius: 4px; 44 border-radius: 4px;
45 } 45 }
46 </style> 46 </style>
47 47
48 <swarming-app 48 <swarming-app
49 client_id="[[client_id]]" 49 client_id="[[client_id]]"
50 auth_headers="{{auth_headers}}" 50 auth_headers="{{_auth_headers}}"
51 permissions="{{_permissions}}" 51 permissions="{{_permissions}}"
52 server_version="{{_server_version}}" 52 server_version="{{_server_version}}"
53 name="Swarming Server" 53 name="Swarming Server"
54 busy="[[_busy]]"> 54 busy="[[_busy]]">
55 55
56 <h2>Service Status</h2> 56 <h2>Service Status</h2>
57 <div>Server Version: [[_server_version.server_version]]</div> 57 <div>Server Version: [[_server_version.server_version]]</div>
58 <div>Bot Version: [[_server_version.bot_version]]</div>
58 <ul> 59 <ul>
59 <li> 60 <li>
60 <!-- TODO(kjlubick) convert these linked pages to Polymer--> 61 <!-- TODO(kjlubick) convert these linked pages to Polymer-->
61 <a href="/stats">Usage statistics</a> 62 <a href="/stats">Usage statistics</a>
62 </li> 63 </li>
63 <li> 64 <li>
64 <a href="/restricted/mapreduce/status">Map Reduce Jobs</a> 65 <a href="/restricted/mapreduce/status">Map Reduce Jobs</a>
65 </li> 66 </li>
66 <li> 67 <li>
67 <a href$="[[_makeInstancesUrl(_server_version,_project_id)]]">View ver sion's instances on Cloud Console</a> 68 <a href$="[[_makeInstancesUrl(_server_version,_project_id)]]">View ver sion's instances on Cloud Console</a>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 126
126 behaviors: [ 127 behaviors: [
127 SwarmingBehaviors.CommonBehavior, 128 SwarmingBehaviors.CommonBehavior,
128 ], 129 ],
129 130
130 properties: { 131 properties: {
131 client_id: { 132 client_id: {
132 type: String, 133 type: String,
133 }, 134 },
134 135
136
137 _auth_headers: {
138 type: String,
139 },
135 _bootstrap_token: { 140 _bootstrap_token: {
136 type: String, 141 type: String,
137 // TODO(kjlubick): fetch this from an API 142 value: "...",
138 value: "abc123",
139 }, 143 },
140 _busy: { 144 _busy: {
141 type: Boolean, 145 type: Boolean,
142 value: false, 146 value: false,
143 }, 147 },
144 _host_url: { 148 _host_url: {
145 type: String, 149 type: String,
146 value: function() { 150 value: function() {
147 return location.origin; 151 return location.origin;
148 }, 152 },
149 }, 153 },
150 _permissions: { 154 _permissions: {
151 type: Object, 155 type: Object,
152 }, 156 },
153 _project_id: { 157 _project_id: {
154 type: String, 158 type: String,
155 value: function() { 159 value: function() {
156 var idx = location.hostname.indexOf(".appspot.com"); 160 var idx = location.hostname.indexOf(".appspot.com");
157 return location.hostname.substring(0, idx); 161 return location.hostname.substring(0, idx);
158 }, 162 },
159 }, 163 },
160 _server_version: { 164 _server_version: {
161 type: Object, 165 type: Object,
162 }, 166 },
163 }, 167 },
164 168
169 observers: ["_fetchBootstrap(_permissions,_auth_headers)"],
170
165 171
166 _cannotBootstrap: function(permissions) { 172 _cannotBootstrap: function(permissions) {
167 return !(permissions && permissions.get_bootstrap_token); 173 return !(permissions && permissions.get_bootstrap_token);
168 }, 174 },
169 175
176 _fetchBootstrap: function(permissions, auth_headers) {
177 if (!auth_headers || !permissions || this._cannotBootstrap(permissions)) {
178 return;
179 }
180 this.set("_busy", true);
181
182 sk.request("POST", "/_ah/api/swarming/v1/server/token", undefined, auth_ headers).then(JSON.parse).then(function(t) {
183 this.set("_bootstrap_token", t.bootstrap_token);
184 this.set("_busy", false);
185 }.bind(this)).catch(function(reason) {
186 console.log("Could not get token", reason);
187 this.set("_busy", false);
188 }.bind(this));
189 },
190
170 _makeInstancesUrl: function(details, project_id) { 191 _makeInstancesUrl: function(details, project_id) {
171 return "https://console.cloud.google.com/appengine/instances?project="+ 192 return "https://console.cloud.google.com/appengine/instances?project="+
172 project_id+"&versionId="+details.server_version; 193 project_id+"&versionId="+details.server_version;
173 }, 194 },
174 195
175 _makeErrorUrl: function(project_id) { 196 _makeErrorUrl: function(project_id) {
176 return "https://console.cloud.google.com/errors?project="+ 197 return "https://console.cloud.google.com/errors?project="+
177 project_id; 198 project_id;
178 }, 199 },
179 200
180 _makeLogUrl: function(project_id) { 201 _makeLogUrl: function(project_id) {
181 return "https://pantheon.corp.google.com/logs/viewer?filters=text:status :500..599&project="+ 202 return "https://pantheon.corp.google.com/logs/viewer?filters=text:status :500..599&project="+
182 project_id; 203 project_id;
183 }, 204 },
184 205
185 }); 206 });
186 </script> 207 </script>
187 </dom-module> 208 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698