OLD | NEW |
1 <!-- | 1 <!-- |
2 TODO(stephana): Place holder for old page to be ported over. | 2 Renders a list of Rietveld issues that have trybot runs associated with them
. |
| 3 |
| 4 Attributes: None |
| 5 |
| 6 Events: None |
| 7 |
| 8 Methods: None |
3 --> | 9 --> |
4 | 10 |
| 11 <link rel="import" href="bower_components/polymer/polymer.html"> |
| 12 |
| 13 <link rel="import" href="../common/imp/9/paging.html"> |
| 14 |
5 <dom-module id="trybot-page-sk"> | 15 <dom-module id="trybot-page-sk"> |
6 <template> | 16 <template> |
7 TODO Trybot | 17 <style type="text/css" media="screen"> |
| 18 .nameHeader, |
| 19 .issueHeader, |
| 20 .dateTimeHeader, |
| 21 .subjectHeader, |
| 22 .patchsetHeader { |
| 23 font-weight: bold; |
| 24 } |
| 25 |
| 26 .nameHeader, |
| 27 .nameValue { |
| 28 width: 8em; |
| 29 } |
| 30 |
| 31 .dateTimeHeader, |
| 32 .dateTimeValue { |
| 33 width: 12em; |
| 34 } |
| 35 |
| 36 .subjectHeader, |
| 37 .subjectValue { |
| 38 min-width: 15em; |
| 39 max-width: 35em; |
| 40 } |
| 41 |
| 42 .issueHeader, |
| 43 .issueValue { |
| 44 width: 6em; |
| 45 } |
| 46 |
| 47 .patchsetHeader, |
| 48 .patchsetValue { |
| 49 width: 7em; |
| 50 } |
| 51 |
| 52 .headerContainer { |
| 53 padding-top: 2em; |
| 54 } |
| 55 |
| 56 tr.rowEntry:hover td {background:#DDDDDD} |
| 57 </style> |
| 58 <paging-sk pagination="{{pagination}}" on-pagechange="pageChangedHandler"></
paging-sk> |
| 59 <table class="headerContainer"> |
| 60 <thead> |
| 61 <tr> |
| 62 <td class="issueHeader">Issue</td> |
| 63 <td class="patchsetHeader">Results<br>Up To</td> |
| 64 <td class="nameHeader">Owner</td> |
| 65 <td class="dateTimeHeader">Updated</td> |
| 66 <td class="subjectHeader">Subject</td> |
| 67 </tr> |
| 68 <template is="dom-repeat" items="{{_trybotEntries}}"> |
| 69 <tr class="rowEntry"> |
| 70 <td class="issueValue"><a target="_blank" title="See codereview in a
new window" href$="{{entry.url}}">{{entry.id}}</a></td> |
| 71 <td class="patchsetValue"> |
| 72 <a title$="{{Results up to Patchset {{entry.patchsets.length}}}}" |
| 73 href$="/search2?issue={{entry.id}}&unt=true&query={{_queryStr}}
&master=false"> |
| 74 Patchset <span>{{entry.patchsets.length}}</span> |
| 75 </a> |
| 76 </td> |
| 77 <td class="nameValue">{{entry.owner}}</td> |
| 78 <td class="dateTimeValue">{{_toLocalDate(entry.updated)}}</td> |
| 79 <td class="subjectValue">{{entry.subject}}</td> |
| 80 </tr> |
| 81 </template> |
| 82 </thead> |
| 83 </table> |
8 </template> | 84 </template> |
| 85 |
9 <script> | 86 <script> |
10 Polymer({ | 87 (function() { |
11 is: "trybot-page-sk", | 88 var defaultPagination = { |
| 89 size: 20, |
| 90 offset: 0, |
| 91 total: 0 |
| 92 }; |
12 | 93 |
13 pageSelected: function(routeName) { | 94 var defaultState = { |
14 }, | 95 size: defaultPagination.size, |
| 96 offset: defaultPagination.offset, |
| 97 details: false |
| 98 }; |
15 | 99 |
16 pageDeselected: function() { | 100 Polymer({ |
17 } | 101 is: "trybot-page-sk", |
18 }); | 102 |
| 103 pageSelected: function(routeName) { |
| 104 this.pagination = { |
| 105 size: 100, |
| 106 offset: 0 |
| 107 }; |
| 108 this.page = { |
| 109 state: {}, |
| 110 query: { 'source_type': 'gm' } |
| 111 }; |
| 112 // Note: This forces and immediate trigger of reload. |
| 113 sk.stateReflector(this.page, this._reload.bind(this)); |
| 114 // Set up the paging change handler and load the data. |
| 115 this.pageChangedHandler = this._reload.bind(this); |
| 116 }, |
| 117 |
| 118 pageDeselected: function() { |
| 119 }, |
| 120 |
| 121 // Load or reload the listing. |
| 122 _reload: function () { |
| 123 var URL = '_/trybot?query=' + this.queryStr(this.page.query); |
| 124 if (this.pagination !== null) { |
| 125 URL += '&' + sk.query.fromObject({ |
| 126 offset: this.pagination.offset, |
| 127 size: this.pagination.size |
| 128 }); |
| 129 } |
| 130 this._handleServerResponse(sk.get(URL)); |
| 131 }, |
| 132 |
| 133 _handleServerResponse: function (promise) { |
| 134 promise.then(JSON.parse).then(function (json) { |
| 135 this.trybotEntries = json.data; |
| 136 this.pagination = json.pagination; |
| 137 }.bind(this)).catch(sk.errorMessage); |
| 138 }, |
| 139 |
| 140 _toLocalDate: function (timeStampSec) { |
| 141 return new Date(timeStampSec * 1000).toLocaleString(); |
| 142 } |
| 143 |
| 144 }); |
| 145 |
| 146 })(); |
| 147 |
19 </script> | 148 </script> |
20 </dom-module> | 149 </dom-module> |
OLD | NEW |