Andrew Bonventre | a5fff8e | 2015-11-25 17:04:33 -0500 | [diff] [blame] | 1 | <!-- |
| 2 | Copyright (C) 2015 The Android Open Source Project |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | --> |
| 16 | |
| 17 | <link rel="import" href="../bower_components/polymer/polymer.html"> |
| 18 | |
| 19 | <dom-module id="gr-dashboard-view"> |
| 20 | <template> |
Andrew Bonventre | 7aa52d3 | 2015-12-03 17:16:05 -0500 | [diff] [blame] | 21 | <style> |
| 22 | :host { |
| 23 | background-color: var(--view-background-color); |
| 24 | display: block; |
| 25 | margin: 0 1.25rem; |
| 26 | } |
Urs Wolfer | e9e684a | 2016-01-17 17:13:16 +0100 | [diff] [blame] | 27 | .loading { |
| 28 | margin-top: 1em; |
| 29 | color: #666; |
| 30 | background-color: #f1f2f3; |
| 31 | } |
Andrew Bonventre | 7aa52d3 | 2015-12-03 17:16:05 -0500 | [diff] [blame] | 32 | gr-change-list { |
| 33 | margin-top: 1em; |
| 34 | width: 100%; |
| 35 | } |
| 36 | </style> |
Andrew Bonventre | 5f7e6df | 2015-12-09 13:02:48 -0500 | [diff] [blame] | 37 | <gr-ajax |
Andrew Bonventre | a5fff8e | 2015-11-25 17:04:33 -0500 | [diff] [blame] | 38 | auto |
| 39 | url="/changes/" |
| 40 | params="[[_computeQueryParams()]]" |
Urs Wolfer | e9e684a | 2016-01-17 17:13:16 +0100 | [diff] [blame] | 41 | last-response="{{_results}}" |
| 42 | loading="{{_loading}}"></gr-ajax> |
| 43 | <div class="loading" hidden$="[[!_loading]]">Loading...</div> |
| 44 | <div hidden$="[[_loading]]" hidden> |
Andrew Bonventre | 12d6212 | 2016-01-26 14:31:14 -0500 | [diff] [blame^] | 45 | <gr-change-list |
| 46 | show-star |
| 47 | selected-index="{{viewState.selectedChangeIndex}}" |
| 48 | groups="{{_results}}" |
Urs Wolfer | e9e684a | 2016-01-17 17:13:16 +0100 | [diff] [blame] | 49 | group-titles="[[_groupTitles]]"></gr-change-list> |
| 50 | </div> |
Andrew Bonventre | a5fff8e | 2015-11-25 17:04:33 -0500 | [diff] [blame] | 51 | </template> |
| 52 | <script> |
| 53 | (function() { |
| 54 | 'use strict'; |
| 55 | |
| 56 | Polymer({ |
| 57 | is: 'gr-dashboard-view', |
| 58 | |
Andrew Bonventre | 9de8b68 | 2016-01-14 17:43:03 -0500 | [diff] [blame] | 59 | /** |
| 60 | * Fired when the title of the page should change. |
| 61 | * |
| 62 | * @event title-change |
| 63 | */ |
| 64 | |
| 65 | attached: function() { |
| 66 | this.fire('title-change', {title: 'My Reviews'}); |
| 67 | }, |
| 68 | |
Andrew Bonventre | a5fff8e | 2015-11-25 17:04:33 -0500 | [diff] [blame] | 69 | properties: { |
Andrew Bonventre | 12d6212 | 2016-01-26 14:31:14 -0500 | [diff] [blame^] | 70 | viewState: Object, |
| 71 | |
Andrew Bonventre | a5fff8e | 2015-11-25 17:04:33 -0500 | [diff] [blame] | 72 | _results: Array, |
Andrew Bonventre | 7aa52d3 | 2015-12-03 17:16:05 -0500 | [diff] [blame] | 73 | _groupTitles: { |
| 74 | type: Array, |
| 75 | value: [ |
| 76 | 'Outgoing reviews', |
| 77 | 'Incoming reviews', |
| 78 | 'Recently closed', |
| 79 | ], |
| 80 | }, |
Urs Wolfer | e9e684a | 2016-01-17 17:13:16 +0100 | [diff] [blame] | 81 | |
| 82 | /** |
| 83 | * For showing a "loading..." string during ajax requests. |
| 84 | */ |
| 85 | _loading: { |
| 86 | type: Boolean, |
| 87 | value: true, |
| 88 | }, |
Andrew Bonventre | a5fff8e | 2015-11-25 17:04:33 -0500 | [diff] [blame] | 89 | }, |
| 90 | |
| 91 | _computeQueryParams: function() { |
| 92 | var options = Changes.listChangesOptionsToHex( |
| 93 | Changes.ListChangesOption.LABELS, |
| 94 | Changes.ListChangesOption.DETAILED_ACCOUNTS, |
| 95 | Changes.ListChangesOption.REVIEWED |
| 96 | ); |
| 97 | return { |
| 98 | O: options, |
| 99 | q: [ |
| 100 | 'is:open owner:self', |
| 101 | 'is:open reviewer:self -owner:self', |
| 102 | 'is:closed (owner:self OR reviewer:self) -age:4w limit:10', |
| 103 | ], |
| 104 | }; |
| 105 | }, |
| 106 | |
| 107 | }); |
| 108 | })(); |
| 109 | </script> |
| 110 | </dom-module> |