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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
Index: appengine/swarming/elements/res/imp/index/swarming-index.html
diff --git a/appengine/swarming/elements/res/imp/index/swarming-index.html b/appengine/swarming/elements/res/imp/index/swarming-index.html
index 16c41569e0399a66a90af82cab0cf6be76bf0f77..8ea6cc03d8d0d80e28cf58289c032e9abce0684a 100644
--- a/appengine/swarming/elements/res/imp/index/swarming-index.html
+++ b/appengine/swarming/elements/res/imp/index/swarming-index.html
@@ -18,7 +18,8 @@
This is a top-level element.
Properties:
- client_id: String, will be set by server-side template evaluation.
+ client_id: String, Oauth 2.0 client id. It will be set by server-side
+ template evaluation.
Methods:
None.
@@ -27,33 +28,92 @@
None.
-->
-<link rel="import" href="/res/imp/bower_components/iron-ajax/iron-ajax.html">
-
+<link rel="import" href="/res/imp/common/common-behavior.html">
<link rel="import" href="/res/imp/common/swarming-app.html">
<dom-module id="swarming-index">
<template>
<style include="swarming-app-style">
-
+ .command {
+ font-family: monospace;
+ margin-bottom: 10px;
+ margin-top: 10px;
+ white-space: pre-wrap;
+ background-color: #f5f5f5;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ }
</style>
<swarming-app
client_id="[[client_id]]"
auth_headers="{{auth_headers}}"
- name="Swarming"
- busy="[[busy]]">
-
- <iron-ajax id="request"
- url="/_ah/api/swarming/v1/server/details"
- headers="[[auth_headers]]"
- handle-as="json"
- last-response="{{serverDetails}}"
- loading="{{busy}}">
- </iron-ajax>
-
- <h1>HELLO WORLD</h1>
+ permissions="{{_permissions}}"
+ name="Swarming Server"
+ busy="[[_busy]]">
+ <h2>Service Status</h2>
<div>Server Version: [[serverDetails.server_version]]</div>
+ <ul>
+ <li>
+ <!-- TODO(kjlubick) convert these linked pages to Polymer-->
+ <a href="/stats">Usage statistics</a>
+ </li>
+ <li>
+ <a href="/restricted/mapreduce/status">Map Reduce Jobs</a>
+ </li>
+ <li>
+ <a href$="[[_makeInstancesUrl(serverDetails,_project_id)]]">View version's instances on Cloud Console</a>
+ </li>
+ <li>
+ <a><a href$="[[_makeErrorUrl(_project_id)]]">View server errors on Cloud Console</a></a>
+ </li>
+ <li>
+ <a><a href$="[[_makeLogUrl(_project_id)]]">View logs for HTTP 5xx on Cloud Console</a></a>
+ </li>
+ </ul>
+
+ <h2>Configuration</h2>
+ <ul>
+ <!-- TODO(kjlubick) convert these linked pages to Polymer-->
+ <li>
+ <a href="/restricted/config">View server config</a>
+ </li>
+ <li>
+ <a href="/restricted/upload/bootstrap">View/upload bootstrap.py</a>
+ </li>
+ <li>
+ <a href="/restricted/upload/bot_config">View/upload bot_config.py</a>
+ </li>
+ <li>
+ <a href="/auth/groups">View/edit user groups</a>
+ </li>
+ </ul>
+
+ <div hidden$="[[_cannotBootstrap(_permissions)]]">
+ <h2>Bootstrapping a bot</h2>
+ To bootstrap a bot, run one of these (all links are valid for 1 hour):
+ <ol>
+ <li>
+ <strong> TL;DR; </strong>
+ <pre class="command">python -c "import urllib; exec urllib.urlopen('[[_host_url]]/bootstrap?tok=[[_bootstrap_token]]').read()"</pre>
+ </li>
+ <li>
+ Escaped version to pass as a ssh argument:
+ <pre class="command">'python -c "import urllib; exec urllib.urlopen('"'[[_host_url]]/bootstrap?tok=[[_bootstrap_token]]'"').read()"'</pre>
+ </li>
+ <li>
+ Manually:
+ <pre class="command" style="margin-bottom:0">mkdir bot; cd bot
+ rm -f swarming_bot.zip; curl -sSLOJ [[_host_url]]/bot_code?tok=[[_bootstrap_token]]
+ python swarming_bot.zip</pre>
+ </li>
+ </ol>
+ </div>
+
+ <h2>Stats</h2>
+ <div>TODO(kjlubick) add these in</div>
+
</swarming-app>
@@ -62,6 +122,10 @@
Polymer({
is: 'swarming-index',
+ behaviors: [
+ SwarmingBehaviors.CommonBehavior,
+ ],
+
properties: {
client_id: {
type: String,
@@ -73,12 +137,58 @@
},
serverDetails: {
+ type: Object,
+ },
+
+ _bootstrap_token: {
type: String,
+ // TODO(kjlubick): fetch this from an API
+ value: "abc123",
+ },
+ _busy: {
+ type: Boolean,
+ value: false,
+ },
+ _host_url: {
+ type: String,
+ value: function() {
+ return location.origin;
+ },
+ },
+ _permissions: {
+ type: Object,
+ },
+ _project_id: {
+ type: String,
+ value: function() {
+ var idx = location.hostname.indexOf(".appspot.com");
+ return location.hostname.substring(0, idx);
+ },
}
},
signIn: function(){
- this.$.request.generateRequest();
+ this._getJsonAsync("serverDetails", "/_ah/api/swarming/v1/server/details",
+ "_busy", this.auth_headers);
+ },
+
+ _cannotBootstrap: function(permissions) {
+ return !(permissions && permissions.get_bootstrap_token);
+ },
+
+ _makeInstancesUrl: function(details, project_id) {
+ return "https://console.cloud.google.com/appengine/instances?project="+
+ project_id+"&versionId="+details.server_version;
+ },
+
+ _makeErrorUrl: function(project_id) {
+ return "https://console.cloud.google.com/errors?project="+
+ project_id;
+ },
+
+ _makeLogUrl: function(project_id) {
+ return "https://pantheon.corp.google.com/logs/viewer?filters=text:status:500..599&project="+
+ project_id;
},
});

Powered by Google App Engine
This is Rietveld 408576698