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

Unified Diff: appengine/swarming/elements/res/imp/botlist/bot-list-data.html

Issue 2204483002: Add UI to new botlist to show summary (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@bot-summary-api
Patch Set: add docs Created 4 years, 5 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/botlist/bot-list-data.html
diff --git a/appengine/swarming/elements/res/imp/botlist/bot-list-data.html b/appengine/swarming/elements/res/imp/botlist/bot-list-data.html
index c8c4920b956f37a7ebc807fae7c2c36208805e8e..bdd399714a1d49522c4102f69e5e3d9b206e2190 100644
--- a/appengine/swarming/elements/res/imp/botlist/bot-list-data.html
+++ b/appengine/swarming/elements/res/imp/botlist/bot-list-data.html
@@ -21,7 +21,9 @@
should come from swarming-app.
// outputs
bots: Array<Object>, all bots returned by the botlist.
- busy: Boolean, if the ajax request is in flight.
+ busy: Boolean, if any ajax requests are in flight.
+ fleet: Object, counts of all bots in the fleet. Contains "alive", "busy",
+ "idle", "dead", and "quarantined".
primary_map: Object, a mapping of primary keys to secondary items.
The primary keys are things that can be columns or sorted by. The
primary values (aka the secondary items) are things that can be filtered
@@ -44,12 +46,20 @@
<dom-module id="bot-list-data">
<template>
- <iron-ajax id="request"
+ <iron-ajax id="botlist"
url="/_ah/api/swarming/v1/bots/list"
headers="[[auth_headers]]"
handle-as="json"
- last-response="{{_data}}"
- loading="{{busy}}">
+ last-response="{{_list}}"
+ loading="{{_busy1}}">
+ </iron-ajax>
+
+ <iron-ajax id="fleet"
+ url="/_ah/api/swarming/v1/bots/count"
+ headers="[[auth_headers]]"
+ handle-as="json"
+ last-response="{{_count}}"
+ loading="{{_busy2}}">
</iron-ajax>
</template>
<script>
@@ -62,6 +72,9 @@
var BOT_PROPERTIES = ["gpu", "devices", "task", "status"];
Polymer({
is: 'bot-list-data',
+
+ behaviors: [SwarmingBehaviors.BotListBehavior],
+
properties: {
// inputs
auth_headers: {
@@ -72,11 +85,17 @@
//outputs
bots: {
type: Array,
- computed: "_bots(_data)",
+ computed: "_bots(_list)",
notify: true,
},
busy: {
type: Boolean,
+ computed: "_or(_busy1,_busy2)",
+ notify: true,
+ },
+ fleet: {
+ type: Object,
+ computed: "_fleet(_count)",
notify: true,
},
primary_map: {
@@ -93,24 +112,41 @@
},
// private
- _data: {
+ _count: {
+ type: Object,
+ },
+ _list: {
type: Object,
},
},
- behaviors: [SwarmingBehaviors.BotListBehavior],
signIn: function(){
- this.$.request.generateRequest();
+ this.$.botlist.generateRequest();
+ this.$.fleet.generateRequest();
},
_bots: function(){
- if (!this._data || !this._data.items) {
+ if (!this._list || !this._list.items) {
return [];
}
- this._data.items.forEach(function(o){
+ this._list.items.forEach(function(o){
o.state = JSON.parse(o.state);
});
- return this._data.items;
+ return this._list.items;
+ },
+
+ _fleet: function() {
+ if (!this._count) {
+ return {};
+ }
+ return {
+ alive: this._count.count || -1,
+ busy: this._count.busy || -1,
+ idle: this._count.count && this._count.busy &&
+ this._count.count - this._count.busy,
+ dead: this._count.dead || -1,
+ quarantined: this._count.quarantined || -1,
+ }
},
_primaryMap: function(bots){

Powered by Google App Engine
This is Rietveld 408576698