| 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 <autoroll-widget-sk> | 7 <autoroll-widget-sk> |
| 8 | 8 |
| 9 To use this file import it: | 9 To use this file import it: |
| 10 | 10 |
| 11 <link href="/res/imp/autoroll-widget-sk.html" rel="import" /> | 11 <link href="/res/imp/autoroll-widget-sk.html" rel="import" /> |
| 12 | 12 |
| 13 Usage: | 13 Usage: |
| 14 | 14 |
| 15 <autoroll-widget-sk></autoroll-widget-sk> | 15 <autoroll-widget-sk></autoroll-widget-sk> |
| 16 | 16 |
| 17 Properties: | 17 Properties: |
| 18 reload: How often (in seconds) to reload autoroll data. | 18 reload: How often (in seconds) to reload autoroll data. |
| 19 --> | 19 --> |
| 20 <polymer-element name="autoroll-widget-sk"> | 20 <polymer-element name="autoroll-widget-sk"> |
| 21 <template> | 21 <template> |
| 22 <style> | 22 <style> |
| 23 :host { | 23 :host { |
| 24 width: 180px; | 24 width: 180px; |
| 25 } | 25 } |
| 26 a { |
| 27 color: inherit; |
| 28 text-decoration: none; |
| 29 } |
| 30 a:hover { |
| 31 text-decoration: underline; |
| 32 } |
| 26 #statusIndicator /deep/ core-icon{ | 33 #statusIndicator /deep/ core-icon{ |
| 27 color: #E6AB02; | 34 color: #E6AB02; |
| 28 } | 35 } |
| 29 paper-dropdown { | 36 paper-dropdown { |
| 30 top: 50px; | 37 top: 50px; |
| 31 } | 38 } |
| 32 #rolldetails { | 39 #rolldetails { |
| 33 color: #000000; | 40 color: #000000; |
| 34 text-align: left; | 41 text-align: left; |
| 35 padding: 10px; | 42 padding: 10px; |
| 36 } | 43 } |
| 44 table.rollHistory { |
| 45 border-collapse: collapse; |
| 46 } |
| 47 table.rollHistory /deep/ td { |
| 48 padding: 5px; |
| 49 } |
| 50 table.rollHistory /deep/ th { |
| 51 background-color: #EEEEEE; |
| 52 font-weight: normal; |
| 53 font-size: 1.1em; |
| 54 padding: 8px; |
| 55 text-align:center; |
| 56 } |
| 57 tr.success { |
| 58 background-color: #D1E4BC; |
| 59 } |
| 60 tr.failure { |
| 61 background-color: #D95F02; |
| 62 } |
| 63 tr.inprogress { |
| 64 background-color: #FFFF00; |
| 65 } |
| 37 </style> | 66 </style> |
| 38 <core-icon-button | 67 <core-icon-button |
| 39 id="statusIndicator" | 68 id="statusIndicator" |
| 40 on-tap="{{toggle}}" | 69 on-tap="{{toggle}}" |
| 41 class="{{status.status}}" | 70 class="{{status.status}}" |
| 42 icon="{{status.status == 'In progress' ? 'autorenew' : (status.status ==
'Stopped' ? 'error' : 'check-circle')}}"> | 71 icon="{{status.status == 'In progress' ? 'autorenew' : (status.status ==
'Stopped' ? 'error' : 'check-circle')}}"> |
| 43 Roll: {{status.status}} | 72 Roll: {{status.status}} |
| 44 </core-icon-button> | 73 </core-icon-button> |
| 45 <paper-dropdown> | 74 <paper-dropdown> |
| 46 <paper-shadow z="2"> | 75 <paper-shadow z="2"> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 75 target="_blank"> | 104 target="_blank"> |
| 76 <core-icon-button | 105 <core-icon-button |
| 77 icon="av:play-arrow" | 106 icon="av:play-arrow" |
| 78 disabled?="{{status.status != 'Stopped'}}" | 107 disabled?="{{status.status != 'Stopped'}}" |
| 79 on-tap="{{startRoller}}"> | 108 on-tap="{{startRoller}}"> |
| 80 </core-icon-button> | 109 </core-icon-button> |
| 81 </a> | 110 </a> |
| 82 </td> | 111 </td> |
| 83 </tr> | 112 </tr> |
| 84 <tr> | 113 <tr> |
| 114 <td>Recent:</td> |
| 115 <td> |
| 116 <table class="rollHistory"> |
| 117 <tr> |
| 118 <th>Roll</th> |
| 119 <th>Status</th> |
| 120 <th>Last Modified</th> |
| 121 </tr> |
| 122 <template repeat="{{roll in recent}}"> |
| 123 <tr class="{{roll.Closed ? (roll.Committed ? 'success' : 'fail
ure') : 'inprogress'}}"> |
| 124 <td><a href="https://codereview.chromium.org/{{roll.Issue}}"
target="_blank">{{roll.Issue}}</a></td> |
| 125 <td>{{roll.Closed ? (roll.Committed ? 'Succeeded' : 'Failed'
) : 'In progress'}}</td> |
| 126 <td>{{roll.Modified|readableDate}}</td> |
| 127 </tr> |
| 128 </template> |
| 129 </table> |
| 130 </td> |
| 131 </tr> |
| 132 <tr> |
| 133 <td>Full History:</td> |
| 85 <td> | 134 <td> |
| 86 <a href="https://codereview.chromium.org/user/skia-deps-roller" ta
rget="_blank"> | 135 <a href="https://codereview.chromium.org/user/skia-deps-roller" ta
rget="_blank"> |
| 87 Uploaded Roll CLs on Rietveld | 136 https://codereview.chromium.org/user/skia-deps-roller |
| 88 </a> | 137 </a> |
| 89 </td> | 138 </td> |
| 90 <tr> | 139 </tr> |
| 91 </table> | 140 </table> |
| 92 </paper-shadow> | 141 </paper-shadow> |
| 93 </paper-dropdown> | 142 </paper-dropdown> |
| 94 </template> | 143 </template> |
| 95 <script> | 144 <script> |
| 96 Polymer({ | 145 Polymer({ |
| 97 publish: { | 146 publish: { |
| 98 reload: { | 147 reload: { |
| 99 value: 60, | 148 value: 60, |
| 100 reflect: true, | 149 reflect: true, |
| 101 }, | 150 }, |
| 102 }, | 151 }, |
| 103 | 152 |
| 104 created: function() { | 153 created: function() { |
| 154 this.recent = null; |
| 155 this.recentTimeout = null; |
| 105 this.status = null; | 156 this.status = null; |
| 106 this.timeout = null; | 157 this.statusTimeout = null; |
| 107 }, | 158 }, |
| 108 | 159 |
| 109 ready: function() { | 160 ready: function() { |
| 110 this.reloadStatus(); | 161 this.reloadStatus(); |
| 162 this.reloadRecent(); |
| 111 }, | 163 }, |
| 112 | 164 |
| 113 toggle: function() { | 165 toggle: function() { |
| 114 var dropdown = this.shadowRoot.querySelector("paper-dropdown"); | 166 var dropdown = this.shadowRoot.querySelector("paper-dropdown"); |
| 115 if (dropdown) { | 167 if (dropdown) { |
| 116 dropdown.toggle(); | 168 dropdown.toggle(); |
| 117 } | 169 } |
| 118 }, | 170 }, |
| 119 | 171 |
| 120 reloadChanged: function() { | 172 reloadChanged: function() { |
| 121 this.resetTimeout(); | 173 this.resetRecentTimeout(); |
| 174 this.resetStatusTimeout(); |
| 122 }, | 175 }, |
| 123 | 176 |
| 124 resetTimeout: function() { | 177 resetRecentTimeout: function() { |
| 125 if (this.timeout) { | 178 if (this.recentTimeout) { |
| 126 window.clearTimeout(this.timeout); | 179 window.clearTimeout(this.recentTimeout); |
| 127 } | 180 } |
| 128 if (this.reload > 0) { | 181 if (this.reload > 0) { |
| 129 var that = this; | 182 var that = this; |
| 130 this.timeout = window.setTimeout(function() { that.reloadStatus(); },
this.reload * 1000); | 183 this.recentTimeout = window.setTimeout(function() { that.reloadRecent(
); }, this.reload * 1000); |
| 131 } | 184 } |
| 132 }, | 185 }, |
| 133 | 186 |
| 187 resetStatusTimeout: function() { |
| 188 if (this.statusTimeout) { |
| 189 window.clearTimeout(this.statusTimeout); |
| 190 } |
| 191 if (this.reload > 0) { |
| 192 var that = this; |
| 193 this.statusTimeout = window.setTimeout(function() { that.reloadStatus(
); }, this.reload * 1000); |
| 194 } |
| 195 }, |
| 196 |
| 197 updateRecent: function(recent) { |
| 198 this.recent = recent; |
| 199 this.dispatchEvent(new CustomEvent("change", { |
| 200 detail: { |
| 201 recent: this.recent, |
| 202 } |
| 203 })); |
| 204 }, |
| 205 |
| 134 updateStatus: function(status) { | 206 updateStatus: function(status) { |
| 135 this.status = status; | 207 this.status = status; |
| 136 this.dispatchEvent(new CustomEvent("change", { | 208 this.dispatchEvent(new CustomEvent("change", { |
| 137 detail: { | 209 detail: { |
| 138 status: this.status, | 210 status: this.status, |
| 139 } | 211 } |
| 140 })) | 212 })); |
| 213 }, |
| 214 |
| 215 reloadRecent: function() { |
| 216 var that = this; |
| 217 sk.get("/json/autoRoll").then(JSON.parse).then(function(json) { |
| 218 that.updateRecent(json.reverse()); |
| 219 that.resetRecentTimeout(); |
| 220 }).catch(function() { |
| 221 that.resetRecentTimeout(); |
| 222 }); |
| 141 }, | 223 }, |
| 142 | 224 |
| 143 reloadStatus: function() { | 225 reloadStatus: function() { |
| 144 var that = this; | 226 var that = this; |
| 145 sk.get("https://skia-tree-status.appspot.com/get_arb_status").then(JSON.
parse).then(function(json) { | 227 sk.get("https://skia-tree-status.appspot.com/get_arb_status").then(JSON.
parse).then(function(json) { |
| 146 that.updateStatus(json); | 228 that.updateStatus(json); |
| 147 that.resetTimeout(); | 229 that.resetStatusTimeout(); |
| 148 }).catch(function() { | 230 }).catch(function() { |
| 149 that.resetTimeout(); | 231 that.resetStatusTimeout(); |
| 150 }); | 232 }); |
| 151 }, | 233 }, |
| 152 | 234 |
| 153 shortCommit: function(commit) { | 235 shortCommit: function(commit) { |
| 154 if (commit) { | 236 if (commit) { |
| 155 return commit.substring(0, 7); | 237 return commit.substring(0, 7); |
| 156 } | 238 } |
| 157 return commit; | 239 return commit; |
| 158 }, | 240 }, |
| 241 |
| 242 readableDate: function(d) { |
| 243 var rv = new Date(d); |
| 244 return rv.toLocaleDateString() + ", " + rv.toLocaleTimeString(); |
| 245 }, |
| 159 }); | 246 }); |
| 160 </script> | 247 </script> |
| 161 </polymer-element> | 248 </polymer-element> |
| OLD | NEW |