blob: 06ff7a4791e110e1c541531f020f698c91d2a336 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import {LitElement, html, css} from 'lit-element';
6import {connectStore} from 'reducers/base.js';
7import * as projectV0 from 'reducers/projectV0.js';
8import * as sitewide from 'reducers/sitewide.js';
9import '../mr-mode-selector/mr-mode-selector.js';
10import '../mr-chart/mr-chart.js';
11
12/**
13 * <mr-chart-page>
14 *
15 * Chart page view containing mr-mode-selector and mr-chart.
16 * @extends {LitElement}
17 */
18export class MrChartPage extends connectStore(LitElement) {
19 /** @override */
20 static get styles() {
21 return css`
22 :host {
23 display: block;
24 box-sizing: border-box;
25 width: 100%;
26 padding: 0.5em 8px;
27 }
28 h2 {
29 font-size: 1.2em;
30 margin: 0 0 0.5em;
31 }
32 .list-controls {
33 display: flex;
34 align-items: center;
35 justify-content: flex-end;
36 width: 100%;
37 padding: 0.5em 0;
38 height: 32px;
39 }
40 .help {
41 padding: 1em;
42 background-color: rgb(227, 242, 253);
43 width: 44em;
44 font-size: 92%;
45 margin: 5px;
46 padding: 6px;
47 border-radius: 6px;
48 }
49 .monospace {
50 font-family: monospace;
51 }
52 `;
53 }
54
55 /** @override */
56 render() {
57 return html`
58 <div class="list-controls">
59 <mr-mode-selector
60 .projectName=${this._projectName}
61 .queryParams=${this._queryParams}
62 .value=${'chart'}
63 ></mr-mode-selector>
64 </div>
65 <mr-chart
66 .projectName=${this._projectName}
67 .queryParams=${this._queryParams}
68 ></mr-chart>
69
70 <div>
71 <div class="help">
72 <h2>Supported query parameters:</h2>
73 <span class="monospace">
74 cc, component, hotlist, label, owner, reporter, status
75 </span>
76 <br /><br />
77 <a href="https://bugs.chromium.org/p/monorail/issues/entry?labels=Feature-Charts">
78 Please file feedback here.
79 </a>
80 </div>
81 </div>
82 `;
83 }
84
85 /** @override */
86 static get properties() {
87 return {
88 _projectName: {type: String},
89 /** @private {Object} */
90 _queryParams: {type: Object},
91 };
92 }
93
94 /** @override */
95 stateChanged(state) {
96 this._projectName = projectV0.viewedProjectName(state);
97 this._queryParams = sitewide.queryParams(state);
98 }
99};
100customElements.define('mr-chart-page', MrChartPage);