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

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

Issue 2227803002: Mirror filters and sort preferences to url-params (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@use-dimensions
Patch Set: Make limit a visible option 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/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 106fdb048d2fd4ab04869cb35588d7d9374bc24a..7385816cf8edb92c834809cb8f91763088a85336 100644
--- a/appengine/swarming/elements/res/imp/botlist/bot-list-data.html
+++ b/appengine/swarming/elements/res/imp/botlist/bot-list-data.html
@@ -19,6 +19,9 @@
// inputs
auth_headers: Object, the OAuth2 header to include in the request. This
should come from swarming-app.
+ query_params: Object, The query params that will filter the query
+ server-side. This can have dimensions:Array<String>, quarantined:String
+ and is_dead: String.
// outputs
bots: Array<Object>, all bots returned by the botlist. This is an Object
with at least the following structure:
@@ -58,7 +61,7 @@
<iron-ajax id="botlist"
url="/_ah/api/swarming/v1/bots/list"
headers="[[auth_headers]]"
- params="[[_botlistParams(dimensions.*)]]"
+ params="[[query_params]]"
handle-as="json"
last-response="{{_list}}"
loading="{{_busy1}}">
@@ -94,8 +97,8 @@
type: Object,
observer: "signIn",
},
- dimensions: {
- type: Array,
+ query_params: {
+ type: Object,
stephana 2016/08/11 17:09:53 Does this need a default value ?
kjlubick 2016/08/11 20:00:21 No. Polymer best practices say to use default valu
stephana 2016/08/12 14:45:59 Acknowledged.
},
//outputs
@@ -139,20 +142,15 @@
},
signIn: function(){
+ // Auto on iron-ajax means to automatically re-make the request if
+ // the url or the query params change. Auto does not trigger if the
+ // [auth] headers change, so we wait until the user is signed in
+ // before making any requests.
this.$.botlist.auto = true;
this.$.dimensions.auto = true;
this.$.fleet.auto = true;
},
- _botlistParams: function() {
- if (!this.dimensions) {
- return {};
- }
- return {
- dimensions: this.dimensions,
- };
- },
-
_bots: function(){
if (!this._list || !this._list.items) {
return [];
@@ -187,10 +185,10 @@
return {};
}
return {
- alive: this._count.count || -1,
+ all: this._count.count || -1,
+ alive: (this._count.count - this._count.dead) || -1,
busy: this._count.busy || -1,
- idle: this._count.count && this._count.busy &&
- this._count.count - this._count.busy,
+ idle: (this._count.count - this._count.busy) || -1,
dead: this._count.dead || -1,
quarantined: this._count.quarantined || -1,
}
@@ -201,9 +199,9 @@
},
_primaryMap: function(dimensions){
- // map will keep track of dimensions that we have seen at least once.
- // This will then basically get turned into an array to be used for
- // filtering.
+ // pMap will have a list of columns to available values (primary key
+ // to secondary values). This includes bot dimensions, but also
+ // includes state like disk_space, quarantined, busy, etc.
dimensions = dimensions.bots_dimensions;
var pMap = {};
@@ -248,7 +246,7 @@
// Create custom filter options
pMap["disk_space"] = [];
pMap["task"] = ["busy", "idle"];
- pMap["status"] = ["available", "dead", "quarantined"];
+ pMap["status"] = ["alive", "dead", "quarantined"];
// No need to sort any of this, bot-filters sorts secondary items
// automatically, especially when the user types a query.

Powered by Google App Engine
This is Rietveld 408576698