Index: golden/newui/res/imp/trybot-page-sk.html |
diff --git a/golden/newui/res/imp/trybot-page-sk.html b/golden/newui/res/imp/trybot-page-sk.html |
index dac69e44e72a1f94271ff54bfce1573f24877cc1..3d24a9ea48c6784a23ef7c35c2596b24dcd62c2b 100644 |
--- a/golden/newui/res/imp/trybot-page-sk.html |
+++ b/golden/newui/res/imp/trybot-page-sk.html |
@@ -1,20 +1,149 @@ |
<!-- |
- TODO(stephana): Place holder for old page to be ported over. |
+ Renders a list of Rietveld issues that have trybot runs associated with them. |
+ |
+ Attributes: None |
+ |
+ Events: None |
+ |
+ Methods: None |
--> |
+<link rel="import" href="bower_components/polymer/polymer.html"> |
+ |
+<link rel="import" href="../common/imp/9/paging.html"> |
+ |
<dom-module id="trybot-page-sk"> |
<template> |
- TODO Trybot |
+ <style type="text/css" media="screen"> |
+ .nameHeader, |
+ .issueHeader, |
+ .dateTimeHeader, |
+ .subjectHeader, |
+ .patchsetHeader { |
+ font-weight: bold; |
+ } |
+ |
+ .nameHeader, |
+ .nameValue { |
+ width: 8em; |
+ } |
+ |
+ .dateTimeHeader, |
+ .dateTimeValue { |
+ width: 12em; |
+ } |
+ |
+ .subjectHeader, |
+ .subjectValue { |
+ min-width: 15em; |
+ max-width: 35em; |
+ } |
+ |
+ .issueHeader, |
+ .issueValue { |
+ width: 6em; |
+ } |
+ |
+ .patchsetHeader, |
+ .patchsetValue { |
+ width: 7em; |
+ } |
+ |
+ .headerContainer { |
+ padding-top: 2em; |
+ } |
+ |
+ tr.rowEntry:hover td {background:#DDDDDD} |
+ </style> |
+ <paging-sk pagination="{{pagination}}" on-pagechange="pageChangedHandler"></paging-sk> |
+ <table class="headerContainer"> |
+ <thead> |
+ <tr> |
+ <td class="issueHeader">Issue</td> |
+ <td class="patchsetHeader">Results<br>Up To</td> |
+ <td class="nameHeader">Owner</td> |
+ <td class="dateTimeHeader">Updated</td> |
+ <td class="subjectHeader">Subject</td> |
+ </tr> |
+ <template is="dom-repeat" items="{{_trybotEntries}}"> |
+ <tr class="rowEntry"> |
+ <td class="issueValue"><a target="_blank" title="See codereview in a new window" href$="{{entry.url}}">{{entry.id}}</a></td> |
+ <td class="patchsetValue"> |
+ <a title$="{{Results up to Patchset {{entry.patchsets.length}}}}" |
+ href$="/search2?issue={{entry.id}}&unt=true&query={{_queryStr}}&master=false"> |
+ Patchset <span>{{entry.patchsets.length}}</span> |
+ </a> |
+ </td> |
+ <td class="nameValue">{{entry.owner}}</td> |
+ <td class="dateTimeValue">{{_toLocalDate(entry.updated)}}</td> |
+ <td class="subjectValue">{{entry.subject}}</td> |
+ </tr> |
+ </template> |
+ </thead> |
+ </table> |
</template> |
+ |
<script> |
- Polymer({ |
- is: "trybot-page-sk", |
+ (function() { |
+ var defaultPagination = { |
+ size: 20, |
+ offset: 0, |
+ total: 0 |
+ }; |
+ |
+ var defaultState = { |
+ size: defaultPagination.size, |
+ offset: defaultPagination.offset, |
+ details: false |
+ }; |
+ |
+ Polymer({ |
+ is: "trybot-page-sk", |
+ |
+ pageSelected: function(routeName) { |
+ this.pagination = { |
+ size: 100, |
+ offset: 0 |
+ }; |
+ this.page = { |
+ state: {}, |
+ query: { 'source_type': 'gm' } |
+ }; |
+ // Note: This forces and immediate trigger of reload. |
+ sk.stateReflector(this.page, this._reload.bind(this)); |
+ // Set up the paging change handler and load the data. |
+ this.pageChangedHandler = this._reload.bind(this); |
+ }, |
+ |
+ pageDeselected: function() { |
+ }, |
+ |
+ // Load or reload the listing. |
+ _reload: function () { |
+ var URL = '_/trybot?query=' + this.queryStr(this.page.query); |
+ if (this.pagination !== null) { |
+ URL += '&' + sk.query.fromObject({ |
+ offset: this.pagination.offset, |
+ size: this.pagination.size |
+ }); |
+ } |
+ this._handleServerResponse(sk.get(URL)); |
+ }, |
+ |
+ _handleServerResponse: function (promise) { |
+ promise.then(JSON.parse).then(function (json) { |
+ this.trybotEntries = json.data; |
+ this.pagination = json.pagination; |
+ }.bind(this)).catch(sk.errorMessage); |
+ }, |
+ |
+ _toLocalDate: function (timeStampSec) { |
+ return new Date(timeStampSec * 1000).toLocaleString(); |
+ } |
+ |
+ }); |
- pageSelected: function(routeName) { |
- }, |
+ })(); |
- pageDeselected: function() { |
- } |
- }); |
</script> |
</dom-module> |