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

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

Issue 2279903002: Make the new index page more useful (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@whoami3
Patch Set: Fix names 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 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
11 Swarming Index is the landing page for the Swarming UI. 11 Swarming Index is the landing page for the Swarming UI.
12 It will have links to all other pages and a high-level overview of the fleet . 12 It will have links to all other pages and a high-level overview of the fleet .
13 13
14 Usage: 14 Usage:
15 15
16 <swarming-index></swarming-index> 16 <swarming-index></swarming-index>
17 17
18 This is a top-level element. 18 This is a top-level element.
19 19
20 Properties: 20 Properties:
21 client_id: String, will be set by server-side template evaluation. 21 client_id: String, Oauth 2.0 client id. It will be set by server-side
22 template evaluation.
22 23
23 Methods: 24 Methods:
24 None. 25 None.
25 26
26 Events: 27 Events:
27 None. 28 None.
28 --> 29 -->
29 30
30 <link rel="import" href="/res/imp/bower_components/iron-ajax/iron-ajax.html"> 31 <link rel="import" href="/res/imp/common/common-behavior.html">
31
32 <link rel="import" href="/res/imp/common/swarming-app.html"> 32 <link rel="import" href="/res/imp/common/swarming-app.html">
33 33
34 <dom-module id="swarming-index"> 34 <dom-module id="swarming-index">
35 <template> 35 <template>
36 <style include="swarming-app-style"> 36 <style include="swarming-app-style">
37 37 .command {
38 font-family: monospace;
39 margin-bottom: 10px;
40 margin-top: 10px;
41 white-space: pre-wrap;
42 background-color: #f5f5f5;
43 border: 1px solid #ccc;
44 border-radius: 4px;
45 }
38 </style> 46 </style>
39 47
40 <swarming-app 48 <swarming-app
41 client_id="[[client_id]]" 49 client_id="[[client_id]]"
42 auth_headers="{{auth_headers}}" 50 auth_headers="{{auth_headers}}"
43 name="Swarming" 51 permissions="{{_permissions}}"
44 busy="[[busy]]"> 52 name="Swarming Server"
53 busy="[[_busy]]">
45 54
46 <iron-ajax id="request" 55 <h2>Service Status</h2>
47 url="/_ah/api/swarming/v1/server/details" 56 <div>Server Version: [[serverDetails.server_version]]</div>
48 headers="[[auth_headers]]" 57 <ul>
49 handle-as="json" 58 <li>
50 last-response="{{serverDetails}}" 59 <!-- TODO(kjlubick) convert these linked pages to Polymer-->
51 loading="{{busy}}"> 60 <a href="/stats">Usage statistics</a>
52 </iron-ajax> 61 </li>
62 <li>
63 <a href="/restricted/mapreduce/status">Map Reduce Jobs</a>
64 </li>
65 <li>
66 <a href$="[[_makeInstancesUrl(serverDetails,_project_id)]]">View versi on's instances on Cloud Console</a>
67 </li>
68 <li>
69 <a><a href$="[[_makeErrorUrl(_project_id)]]">View server errors on Clo ud Console</a></a>
70 </li>
71 <li>
72 <a><a href$="[[_makeLogUrl(_project_id)]]">View logs for HTTP 5xx on C loud Console</a></a>
73 </li>
74 </ul>
53 75
54 <h1>HELLO WORLD</h1> 76 <h2>Configuration</h2>
77 <ul>
78 <!-- TODO(kjlubick) convert these linked pages to Polymer-->
79 <li>
80 <a href="/restricted/config">View server config</a>
81 </li>
82 <li>
83 <a href="/restricted/upload/bootstrap">View/upload bootstrap.py</a>
84 </li>
85 <li>
86 <a href="/restricted/upload/bot_config">View/upload bot_config.py</a>
87 </li>
88 <li>
89 <a href="/auth/groups">View/edit user groups</a>
90 </li>
91 </ul>
55 92
56 <div>Server Version: [[serverDetails.server_version]]</div> 93 <div hidden$="[[_cannotBootstrap(_permissions)]]">
94 <h2>Bootstrapping a bot</h2>
95 To bootstrap a bot, run one of these (all links are valid for 1 hour):
96 <ol>
97 <li>
98 <strong> TL;DR; </strong>
99 <pre class="command">python -c "import urllib; exec urllib.urlopen('[[_host_ur l]]/bootstrap?tok=[[_bootstrap_token]]').read()"</pre>
100 </li>
101 <li>
102 Escaped version to pass as a ssh argument:
103 <pre class="command">'python -c "import urllib; exec urllib.urlopen('"'[[_host _url]]/bootstrap?tok=[[_bootstrap_token]]'"').read()"'</pre>
104 </li>
105 <li>
106 Manually:
107 <pre class="command" style="margin-bottom:0">mkdir bot; cd bot
108 rm -f swarming_bot.zip; curl -sSLOJ [[_host_url]]/bot_code?tok=[[_bootstrap_to ken]]
109 python swarming_bot.zip</pre>
110 </li>
111 </ol>
112 </div>
113
114 <h2>Stats</h2>
115 <div>TODO(kjlubick) add these in</div>
116
57 117
58 </swarming-app> 118 </swarming-app>
59 119
60 </template> 120 </template>
61 <script> 121 <script>
62 Polymer({ 122 Polymer({
63 is: 'swarming-index', 123 is: 'swarming-index',
64 124
125 behaviors: [
126 SwarmingBehaviors.CommonBehavior,
127 ],
128
65 properties: { 129 properties: {
66 client_id: { 130 client_id: {
67 type: String, 131 type: String,
68 }, 132 },
69 133
70 auth_headers: { 134 auth_headers: {
71 type: Object, 135 type: Object,
72 observer: "signIn", 136 observer: "signIn",
73 }, 137 },
74 138
75 serverDetails: { 139 serverDetails: {
140 type: Object,
141 },
142
143 _bootstrap_token: {
76 type: String, 144 type: String,
145 // TODO(kjlubick): fetch this from an API
146 value: "abc123",
147 },
148 _busy: {
149 type: Boolean,
150 value: false,
151 },
152 _host_url: {
153 type: String,
154 value: function() {
155 return location.origin;
156 },
157 },
158 _permissions: {
159 type: Object,
160 },
161 _project_id: {
162 type: String,
163 value: function() {
164 var idx = location.hostname.indexOf(".appspot.com");
165 return location.hostname.substring(0, idx);
166 },
77 } 167 }
78 }, 168 },
79 169
80 signIn: function(){ 170 signIn: function(){
81 this.$.request.generateRequest(); 171 this._getJsonAsync("serverDetails", "/_ah/api/swarming/v1/server/details ",
172 "_busy", this.auth_headers);
173 },
174
175 _cannotBootstrap: function(permissions) {
176 return !(permissions && permissions.get_bootstrap_token);
177 },
178
179 _makeInstancesUrl: function(details, project_id) {
180 return "https://console.cloud.google.com/appengine/instances?project="+
181 project_id+"&versionId="+details.server_version;
182 },
183
184 _makeErrorUrl: function(project_id) {
185 return "https://console.cloud.google.com/errors?project="+
186 project_id;
187 },
188
189 _makeLogUrl: function(project_id) {
190 return "https://pantheon.corp.google.com/logs/viewer?filters=text:status :500..599&project="+
191 project_id;
82 }, 192 },
83 193
84 }); 194 });
85 </script> 195 </script>
86 </dom-module> 196 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698