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

Unified Diff: appengine/swarming/elements/res/imp/botlist/bot-list-data.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
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 de94f857f9d5c823a2cd94e2dbceeffb9ca4baea..523e6f766616f7808517c8ccffa420c4d1511c5c 100644
--- a/appengine/swarming/elements/res/imp/botlist/bot-list-data.html
+++ b/appengine/swarming/elements/res/imp/botlist/bot-list-data.html
@@ -60,37 +60,10 @@
None.
-->
-<link rel="import" href="/res/imp/bower_components/iron-ajax/iron-ajax.html">
-
<link rel="import" href="bot-list-shared-behavior.html">
<dom-module id="bot-list-data">
- <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"];
@@ -110,6 +83,7 @@
},
query_params: {
type: Object,
+ observer: "_request",
},
//outputs
@@ -146,6 +120,18 @@
},
// private
+ _busy1: {
+ type: Boolean,
+ value: false
+ },
+ _busy2: {
+ type: Boolean,
+ value: false
+ },
+ _busy3: {
+ type: Boolean,
+ value: false
+ },
_count: {
type: Object,
},
@@ -158,13 +144,12 @@
},
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(){
@@ -285,6 +270,15 @@
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>

Powered by Google App Engine
This is Rietveld 408576698