OLD | NEW |
1 <!-- | 1 <!-- |
2 The common.js file must be included before this file. | 2 The common.js file must be included before this file. |
3 | 3 |
4 This in an HTML Import-able file that contains the definition | 4 This in an HTML Import-able file that contains the definition |
5 of the following elements: | 5 of the following elements: |
6 | 6 |
7 <tree-status-sk> | 7 <tree-status-sk> |
8 | 8 |
9 To use this file import it: | 9 To use this file import it: |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 reflect: true, | 41 reflect: true, |
42 }, | 42 }, |
43 sheriff: { | 43 sheriff: { |
44 value: "", | 44 value: "", |
45 reflect: false, | 45 reflect: false, |
46 }, | 46 }, |
47 gpuSheriff: { | 47 gpuSheriff: { |
48 value: "", | 48 value: "", |
49 reflect: false, | 49 reflect: false, |
50 }, | 50 }, |
| 51 trooper: { |
| 52 value: "", |
| 53 reflect: false, |
| 54 }, |
51 author: { | 55 author: { |
52 value: "", | 56 value: "", |
53 reflect: false, | 57 reflect: false, |
54 }, | 58 }, |
55 timeSince: { | 59 timeSince: { |
56 value: "", | 60 value: "", |
57 reflect: false, | 61 reflect: false, |
58 }, | 62 }, |
59 reload: { | 63 reload: { |
60 value: 60, | 64 value: 60, |
61 reflect: true, | 65 reflect: true, |
62 }, | 66 }, |
63 timeout: { | 67 timeout: { |
64 value: null, | 68 value: null, |
65 reflect: false, | 69 reflect: false, |
66 }, | 70 }, |
67 sheriffTimeout: { | 71 sheriffTimeout: { |
68 value: null, | 72 value: null, |
69 reflect: false, | 73 reflect: false, |
70 }, | 74 }, |
71 gpuSheriffTimeout: { | 75 gpuSheriffTimeout: { |
72 value: null, | 76 value: null, |
73 reflect: false, | 77 reflect: false, |
74 }, | 78 }, |
| 79 trooperTimeout: { |
| 80 value: null, |
| 81 reflect: false, |
| 82 }, |
75 }, | 83 }, |
76 | 84 |
77 ready: function() { | 85 ready: function() { |
78 this.reloadStatus(); | 86 this.reloadStatus(); |
79 this.reloadSheriffStatus(); | 87 this.reloadSheriffStatus(); |
80 this.reloadGpuSheriffStatus(); | 88 this.reloadGpuSheriffStatus(); |
| 89 this.reloadTrooperStatus(); |
81 }, | 90 }, |
82 | 91 |
83 reloadChanged: function() { | 92 reloadChanged: function() { |
84 this.resetTimeout(); | 93 this.resetTimeout(); |
85 this.resetSheriffTimeout(); | 94 this.resetSheriffTimeout(); |
86 this.resetGpuSheriffTimeout(); | 95 this.resetGpuSheriffTimeout(); |
| 96 this.resetTrooperTimeout(); |
87 }, | 97 }, |
88 | 98 |
89 resetTimeout: function() { | 99 resetTimeout: function() { |
90 if (this.timeout) { | 100 if (this.timeout) { |
91 window.clearTimeout(this.timeout); | 101 window.clearTimeout(this.timeout); |
92 } | 102 } |
93 if (this.reload > 0) { | 103 if (this.reload > 0) { |
94 var that = this; | 104 var that = this; |
95 this.timeout = window.setTimeout(function() { that.reloadStatus(); },
this.reload * 1000); | 105 this.timeout = window.setTimeout(function() { that.reloadStatus(); },
this.reload * 1000); |
96 } | 106 } |
(...skipping 12 matching lines...) Expand all Loading... |
109 resetGpuSheriffTimeout: function() { | 119 resetGpuSheriffTimeout: function() { |
110 if (this.gpuSheriffTimeout) { | 120 if (this.gpuSheriffTimeout) { |
111 window.clearTimeout(this.gpuSheriffTimeout); | 121 window.clearTimeout(this.gpuSheriffTimeout); |
112 } | 122 } |
113 if (this.reload > 0) { | 123 if (this.reload > 0) { |
114 var that = this; | 124 var that = this; |
115 this.gpuSheriffTimeout = window.setTimeout(function() { that.reloadGpu
SheriffStatus(); }, this.reload * 1000); | 125 this.gpuSheriffTimeout = window.setTimeout(function() { that.reloadGpu
SheriffStatus(); }, this.reload * 1000); |
116 } | 126 } |
117 }, | 127 }, |
118 | 128 |
119 updateStatus: function(newSheriff, newGpuSheriff, newMessage, newBinarySta
tus, newAuthor, newTimeSince) { | 129 resetTrooperTimeout: function() { |
| 130 if (this.trooperTimeout) { |
| 131 window.clearTimeout(this.trooperTimeout); |
| 132 } |
| 133 if (this.reload > 0) { |
| 134 var that = this; |
| 135 this.trooperTimeout = window.setTimeout(function() { that.reloadTroope
rStatus(); }, this.reload * 1000); |
| 136 } |
| 137 }, |
| 138 |
| 139 updateStatus: function(newSheriff, newGpuSheriff, newTrooper, newMessage,
newBinaryStatus, newAuthor, newTimeSince) { |
120 if ((this.sheriff != newSheriff) || | 140 if ((this.sheriff != newSheriff) || |
121 (this.gpuSheriff != newGpuSheriff) || | 141 (this.gpuSheriff != newGpuSheriff) || |
| 142 (this.trooper != newTrooper) || |
122 (this.message != newMessage) || | 143 (this.message != newMessage) || |
123 (this.binaryStatus != newBinaryStatus) || | 144 (this.binaryStatus != newBinaryStatus) || |
124 (this.author != newAuthor) || | 145 (this.author != newAuthor) || |
125 (this.timeSince != newTimeSince)) { | 146 (this.timeSince != newTimeSince)) { |
126 this.sheriff = newSheriff; | 147 this.sheriff = newSheriff; |
127 this.gpuSheriff = newGpuSheriff; | 148 this.gpuSheriff = newGpuSheriff; |
| 149 this.trooper = newTrooper; |
128 this.message = newMessage; | 150 this.message = newMessage; |
129 this.binaryStatus = newBinaryStatus; | 151 this.binaryStatus = newBinaryStatus; |
130 this.author = newAuthor; | 152 this.author = newAuthor; |
131 this.timeSince = newTimeSince; | 153 this.timeSince = newTimeSince; |
132 this.dispatchEvent(new CustomEvent("change", { | 154 this.dispatchEvent(new CustomEvent("change", { |
133 detail: { | 155 detail: { |
134 sheriff: this.sheriff, | 156 sheriff: this.sheriff, |
135 gpuSheriff: this.gpuSheriff, | 157 gpuSheriff: this.gpuSheriff, |
| 158 trooper: this.trooper, |
136 message: this.message, | 159 message: this.message, |
137 open: this.binaryStatus, | 160 open: this.binaryStatus, |
138 author: this.author, | 161 author: this.author, |
139 timeSince: this.timeSince, | 162 timeSince: this.timeSince, |
140 } | 163 } |
141 })) | 164 })) |
142 } | 165 } |
143 }, | 166 }, |
144 | 167 |
145 reloadStatus: function() { | 168 reloadStatus: function() { |
146 var that = this; | 169 var that = this; |
147 sk.get("https://skia-tree-status.appspot.com/banner-status?format=json")
.then(JSON.parse).then(function(json) { | 170 sk.get("https://skia-tree-status.appspot.com/banner-status?format=json")
.then(JSON.parse).then(function(json) { |
148 that.updateStatus(that.sheriff, that.gpuSheriff, json.message, json.ge
neral_state == "open", json.username.split("@")[0], sk.human.diffDate(json.date
+ " UTC")); | 171 that.updateStatus(that.sheriff, that.gpuSheriff, that.trooper, json.me
ssage, json.general_state == "open", json.username.split("@")[0], sk.human.diffD
ate(json.date + " UTC")); |
149 that.resetTimeout(); | 172 that.resetTimeout(); |
150 }).catch(function() { | 173 }).catch(function() { |
151 that.resetTimeout(); | 174 that.resetTimeout(); |
152 }); | 175 }); |
153 }, | 176 }, |
154 | 177 |
155 reloadSheriffStatus: function() { | 178 reloadSheriffStatus: function() { |
156 var that = this; | 179 var that = this; |
157 sk.get("https://skia-tree-status.appspot.com/current-sheriff?format=json
").then(JSON.parse).then(function(json) { | 180 sk.get("https://skia-tree-status.appspot.com/current-sheriff?format=json
").then(JSON.parse).then(function(json) { |
158 that.updateStatus(json.username.split("@")[0], that.gpuSheriff, that.m
essage, that.binaryStatus, that.author, that.timeSince); | 181 that.updateStatus(json.username.split("@")[0], that.gpuSheriff, that.t
rooper, that.message, that.binaryStatus, that.author, that.timeSince); |
159 that.resetSheriffTimeout(); | 182 that.resetSheriffTimeout(); |
160 }).catch(function() { | 183 }).catch(function() { |
161 that.resetSheriffTimeout(); | 184 that.resetSheriffTimeout(); |
162 }); | 185 }); |
163 }, | 186 }, |
164 | 187 |
165 reloadGpuSheriffStatus: function() { | 188 reloadGpuSheriffStatus: function() { |
166 var that = this; | 189 var that = this; |
167 sk.get("https://skia-tree-status.appspot.com/current-gpu-sheriff?format=
json").then(JSON.parse).then(function(json) { | 190 sk.get("https://skia-tree-status.appspot.com/current-gpu-sheriff?format=
json").then(JSON.parse).then(function(json) { |
168 that.updateStatus(that.sheriff, json.username.split("@")[0], that.mess
age, that.binaryStatus, that.author, that.timeSince); | 191 that.updateStatus(that.sheriff, json.username.split("@")[0], that.troo
per, that.message, that.binaryStatus, that.author, that.timeSince); |
169 that.resetGpuSheriffTimeout(); | 192 that.resetGpuSheriffTimeout(); |
170 }).catch(function() { | 193 }).catch(function() { |
171 that.resetGpuSheriffTimeout(); | 194 that.resetGpuSheriffTimeout(); |
172 }); | 195 }); |
173 }, | 196 }, |
| 197 |
| 198 reloadTrooperStatus: function() { |
| 199 var that = this; |
| 200 sk.get("https://skia-tree-status.appspot.com/current-trooper?format=json
").then(JSON.parse).then(function(json) { |
| 201 that.updateStatus(that.sheriff, that.trooper, json.username.split("@")
[0], that.message, that.binaryStatus, that.author, that.timeSince); |
| 202 that.resetTrooperTimeout(); |
| 203 }).catch(function() { |
| 204 that.resetTrooperTimeout(); |
| 205 }); |
| 206 }, |
174 }); | 207 }); |
175 </script> | 208 </script> |
176 </polymer-element> | 209 </polymer-element> |
OLD | NEW |