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

Unified Diff: appengine/swarming/elements/build/elements.html

Issue 2276373002: Remove the rest of iron-ajax from bot-list-data (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@make-tasklist
Patch Set: 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
« no previous file with comments | « no previous file | appengine/swarming/elements/res/imp/botlist/bot-filters.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/elements/build/elements.html
diff --git a/appengine/swarming/elements/build/elements.html b/appengine/swarming/elements/build/elements.html
index fbdfde142ff0085c0d0243d6d7b83653e2b655e9..04f7bc5bddc0e84069d4e12aee5ea588594014dc 100644
--- a/appengine/swarming/elements/build/elements.html
+++ b/appengine/swarming/elements/build/elements.html
@@ -23594,12 +23594,12 @@ the fleet.">
} else if (col === "status") {
var rest = f.substring(col.length + this.FILTER_SEP.length);
if (rest === "alive") {
- params["is_dead"] = "FALSE";
- params["quarantined"] = "FALSE";
+ params["is_dead"] = ["FALSE"];
+ params["quarantined"] = ["FALSE"];
} else if (rest === "quarantined") {
- params["quarantined"] = "TRUE";
+ params["quarantined"] = ["TRUE"];
} else if (rest === "dead") {
- params["is_dead"] = "TRUE";
+ params["is_dead"] = ["TRUE"];
}
}
}.bind(this));
@@ -23609,7 +23609,7 @@ the fleet.">
// Clamp the limit
lim = Math.max(lim, 1);
lim = Math.min(1000, lim);
- params["limit"] = lim;
+ params["limit"] = [lim];
// not !== because limit could be a string, e.g. "900"
if (this.limit != lim) {
this.set("limit", lim);
@@ -23622,16 +23622,7 @@ the fleet.">
})();
</script>
</dom-module><dom-module id="bot-list-data" assetpath="/res/imp/botlist/">
- <template>
- <iron-ajax id="botlist" url="/_ah/api/swarming/v1/bots/list" headers="[[auth_headers]]" params="[[query_params]]" handle-as="json" last-response="{{_list}}" loading="{{_busy1}}">
- </iron-ajax>
- <iron-ajax id="dimensions" url="/_ah/api/swarming/v1/bots/dimensions" headers="[[auth_headers]]" handle-as="json" last-response="{{_dimensions}}" loading="{{_busy2}}">
- </iron-ajax>
-
- <iron-ajax id="fleet" url="/_ah/api/swarming/v1/bots/count" headers="[[auth_headers]]" handle-as="json" last-response="{{_count}}" loading="{{_busy3}}">
- </iron-ajax>
- </template>
<script>
(function(){
var BLACKLIST_DIMENSIONS = ["quarantined", "error"];
@@ -23651,6 +23642,7 @@ the fleet.">
},
query_params: {
type: Object,
+ observer: "_request",
},
//outputs
@@ -23687,6 +23679,18 @@ the fleet.">
},
// private
+ _busy1: {
+ type: Boolean,
+ value: false
+ },
+ _busy2: {
+ type: Boolean,
+ value: false
+ },
+ _busy3: {
+ type: Boolean,
+ value: false
+ },
_count: {
type: Object,
},
@@ -23699,13 +23703,12 @@ the fleet.">
},
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;
+ this._getJsonAsync("_count", "/_ah/api/swarming/v1/bots/count",
+ "_busy2", this.auth_headers);
+ this._getJsonAsync("_dimensions","/_ah/api/swarming/v1/bots/dimensions",
+ "_busy3", this.auth_headers);
+
+ this._request();
},
_bots: function(){
@@ -23826,6 +23829,15 @@ the fleet.">
return pMap;
},
+ _request: function() {
+ // wait until the user has logged in and the filters have loaded before requesting this to avoid double or even triple requests.
+ if (!this.auth_headers || !this.query_params) {
+ return;
+ }
+ this._getJsonAsync("_list", "/_ah/api/swarming/v1/bots/list",
+ "_busy1", this.auth_headers, this.query_params);
+ },
+
});
})();
</script>
@@ -25001,8 +25013,8 @@ the fleet.">
},
_request: function() {
- // wait until the user has logged in before requesting this.
- if (!this.auth_headers) {
+ // wait until the user has logged in and the filters have loaded before requesting this to avoid double or even triple requests.
+ if (!this.auth_headers || !this.query_params) {
return;
}
this._getJsonAsync("_list", "/_ah/api/swarming/v1/tasks/list",
@@ -25057,7 +25069,7 @@ the fleet.">
}
</style>
- <url-param name="sort" value="{{_sortstr}}" default_value="id:asc">
+ <url-param name="sort" value="{{_sortstr}}" default_value="created_ts:desc">
</url-param>
<swarming-app client_id="[[client_id]]" auth_headers="{{_auth_headers}}" permissions="{{_permissions}}" signed_in="{{_signed_in}}" busy="[[_busy]]" name="Swarming Task List">
« no previous file with comments | « no previous file | appengine/swarming/elements/res/imp/botlist/bot-filters.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698