blob: cccf5b909435c2bafe6323491bdb5900a4091c81 [file] [log] [blame]
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -05001<!--
2Copyright (C) 2015 The Android Open Source Project
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations 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 Bonventre7aa52d32015-12-03 17:16:05 -050021 <style>
22 :host {
23 background-color: var(--view-background-color);
24 display: block;
25 margin: 0 1.25rem;
26 }
Urs Wolfere9e684a2016-01-17 17:13:16 +010027 .loading {
28 margin-top: 1em;
29 color: #666;
30 background-color: #f1f2f3;
31 }
Andrew Bonventre7aa52d32015-12-03 17:16:05 -050032 gr-change-list {
33 margin-top: 1em;
34 width: 100%;
35 }
36 </style>
Andrew Bonventre5f7e6df2015-12-09 13:02:48 -050037 <gr-ajax
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050038 auto
39 url="/changes/"
40 params="[[_computeQueryParams()]]"
Urs Wolfere9e684a2016-01-17 17:13:16 +010041 last-response="{{_results}}"
42 loading="{{_loading}}"></gr-ajax>
43 <div class="loading" hidden$="[[!_loading]]">Loading...</div>
44 <div hidden$="[[_loading]]" hidden>
Andrew Bonventre12d62122016-01-26 14:31:14 -050045 <gr-change-list
46 show-star
47 selected-index="{{viewState.selectedChangeIndex}}"
48 groups="{{_results}}"
Urs Wolfere9e684a2016-01-17 17:13:16 +010049 group-titles="[[_groupTitles]]"></gr-change-list>
50 </div>
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050051 </template>
52 <script>
53 (function() {
54 'use strict';
55
56 Polymer({
57 is: 'gr-dashboard-view',
58
Andrew Bonventre9de8b682016-01-14 17:43:03 -050059 /**
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 Bonventrea5fff8e2015-11-25 17:04:33 -050069 properties: {
Andrew Bonventre12d62122016-01-26 14:31:14 -050070 viewState: Object,
71
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050072 _results: Array,
Andrew Bonventre7aa52d32015-12-03 17:16:05 -050073 _groupTitles: {
74 type: Array,
75 value: [
76 'Outgoing reviews',
77 'Incoming reviews',
78 'Recently closed',
79 ],
80 },
Urs Wolfere9e684a2016-01-17 17:13:16 +010081
82 /**
83 * For showing a "loading..." string during ajax requests.
84 */
85 _loading: {
86 type: Boolean,
87 value: true,
88 },
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050089 },
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>