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

Side by Side Diff: appengine/swarming/elements/res/imp/tasklist/task-list-data.html

Issue 2249143002: Make TaskList use Dynamic List (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Document that filters is a stub 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!--
2 Copyright 2016 The LUCI Authors. All rights reserved.
3 Use of this source code is governed under the Apache License, Version 2.0
4 that can be found in the LICENSE file.
5
6 This in an HTML Import-able file that contains the definition
7 of the following elements:
8
9 <bot-list-data>
10
11 This makes calls authenticated with Oauth 2 to the swarming apis. It parses
12 that data into usable data structures.
13
14 Usage:
15
16 <bot-list-data></bot-list-data>
17
18 Properties:
19 // inputs
20 auth_headers: Object, the OAuth2 header to include in the request. This
21 should come from swarming-app.
22 query_params: Object, The query params that will filter the query
23 server-side. This can have dimensions:Array<String>, quarantined:String
24 and is_dead: String. For example:
25 {
26 "dimensions": ["pool:Skia", "device_type:sprout"],
27 "quarantined": "FALSE", // optional
28 "is_dead": "TRUE", // optional
29 }
30 For a full list of dimensions in the fleet, see the API call:
31 https://[swarming_url]/_ah/api/swarming/v1/bots/dimensions
32 // outputs
33 tasks: Array<Object>, all tasks returned by the server.
34
35 Methods:
36 signIn(): Force a signin of the user using OAuth. This happens
37 automatically when auth_headers is set.
38
39 Events:
40 None.
41 -->
42
43 <link rel="import" href="/res/imp/bower_components/iron-ajax/iron-ajax.html">
44
45 <dom-module id="task-list-data">
46 <template>
47 <iron-ajax id="tasklist"
48 url="/_ah/api/swarming/v1/tasks/list"
49 headers="[[auth_headers]]"
50 params="[[query_params]]"
51 handle-as="json"
52 last-response="{{_list}}"
53 loading="{{_busy1}}">
54 </iron-ajax>
55
56 </template>
57 <script>
58 (function(){
59 Polymer({
60 is: 'task-list-data',
61
62 properties: {
63 // inputs
64 auth_headers: {
65 type: Object,
66 observer: "signIn",
67 },
68 query_params: {
69 type: Object,
70 },
71
72 //outputs
73 tasks: {
74 type: Array,
75 computed: "_tasks(_list)",
76 notify: true,
77 }
78 },
79 signIn: function(){
80 // Auto on iron-ajax means to automatically re-make the request if
81 // the url or the query params change. Auto does not trigger if the
82 // [auth] headers change, so we wait until the user is signed in
83 // before making any requests.
84 this.$.tasklist.auto = true;
85 },
86
87 _tasks: function() {
88 if (!this._list || !this._list.items) {
89 return [];
90 }
91 // Do any preprocessing here
92 return this._list.items;
93 }
94 });
95 })();
96 </script>
97 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698