blob: d18773533944f773756735163907ee9de2eed33c [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">
Andrew Bonventre89499442016-02-01 13:42:02 -080018<link rel="import" href="../behaviors/rest-client-behavior.html">
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050019
20<dom-module id="gr-dashboard-view">
21 <template>
Andrew Bonventre7aa52d32015-12-03 17:16:05 -050022 <style>
23 :host {
24 background-color: var(--view-background-color);
25 display: block;
26 margin: 0 1.25rem;
27 }
Urs Wolfere9e684a2016-01-17 17:13:16 +010028 .loading {
29 margin-top: 1em;
30 color: #666;
31 background-color: #f1f2f3;
32 }
Andrew Bonventre7aa52d32015-12-03 17:16:05 -050033 gr-change-list {
34 margin-top: 1em;
35 width: 100%;
36 }
37 </style>
Andrew Bonventre5f7e6df2015-12-09 13:02:48 -050038 <gr-ajax
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050039 auto
40 url="/changes/"
41 params="[[_computeQueryParams()]]"
Urs Wolfere9e684a2016-01-17 17:13:16 +010042 last-response="{{_results}}"
43 loading="{{_loading}}"></gr-ajax>
44 <div class="loading" hidden$="[[!_loading]]">Loading...</div>
45 <div hidden$="[[_loading]]" hidden>
Andrew Bonventre12d62122016-01-26 14:31:14 -050046 <gr-change-list
47 show-star
48 selected-index="{{viewState.selectedChangeIndex}}"
49 groups="{{_results}}"
Urs Wolfere9e684a2016-01-17 17:13:16 +010050 group-titles="[[_groupTitles]]"></gr-change-list>
51 </div>
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050052 </template>
53 <script>
54 (function() {
55 'use strict';
56
57 Polymer({
58 is: 'gr-dashboard-view',
59
Andrew Bonventre9de8b682016-01-14 17:43:03 -050060 /**
61 * Fired when the title of the page should change.
62 *
63 * @event title-change
64 */
65
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050066 properties: {
Andrew Bonventre12d62122016-01-26 14:31:14 -050067 viewState: Object,
68
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050069 _results: Array,
Andrew Bonventre7aa52d32015-12-03 17:16:05 -050070 _groupTitles: {
71 type: Array,
72 value: [
73 'Outgoing reviews',
74 'Incoming reviews',
75 'Recently closed',
76 ],
77 },
Urs Wolfere9e684a2016-01-17 17:13:16 +010078
79 /**
80 * For showing a "loading..." string during ajax requests.
81 */
82 _loading: {
83 type: Boolean,
84 value: true,
85 },
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050086 },
87
Andrew Bonventre89499442016-02-01 13:42:02 -080088 behaviors: [ Gerrit.RESTClientBehavior ],
89
90 attached: function() {
91 this.fire('title-change', {title: 'My Reviews'});
92 },
93
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050094 _computeQueryParams: function() {
Andrew Bonventre89499442016-02-01 13:42:02 -080095 var options = this.listChangesOptionsToHex(
96 this.ListChangesOption.LABELS,
97 this.ListChangesOption.DETAILED_ACCOUNTS,
98 this.ListChangesOption.REVIEWED
Andrew Bonventrea5fff8e2015-11-25 17:04:33 -050099 );
100 return {
101 O: options,
102 q: [
103 'is:open owner:self',
104 'is:open reviewer:self -owner:self',
105 'is:closed (owner:self OR reviewer:self) -age:4w limit:10',
106 ],
107 };
108 },
109
110 });
111 })();
112 </script>
113</dom-module>