Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(790)

Side by Side Diff: appengine/config_service/ui/src/config-ui/front-page.html

Issue 2935763003: config_service: improve landing page (Closed)
Patch Set: Fixed empty vs. loading to reflect current search instead of all configs Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!--
2 Copyright 2017 The LUCI Authors. All rights reserved.
3 Use of this source code is governed under the Apache License, Version 2.0
4 that can be found in the LICENSE file.
5 -->
6
7 <link rel="import" href="../../bower_components/polymer/polymer.html">
8 <link rel="import" href="../../bower_components/app-layout/app-layout.html">
9 <link rel="import" href="../../bower_components/paper-search/paper-search-bar.ht ml">
10 <link rel="import" href="../../bower_components/paper-button/paper-button.html">
11 <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
12 <link rel="import" href="config-card.html">
13
14 <dom-module id="front-page">
15 <template>
16 <style>
17 app-toolbar {
18 background-color: #efefef;
19 color: #232323;
20 }
21
22 app-header {
23 @apply --layout-fixed-top;
24 }
25
26 .logo {
27 height: 100%;
28 }
29
30 .title {
31 padding-left: 1%;
32 font-size: 150%;
33 font-family: sans-serif;
34 }
35
36 .search-bar {
37 padding-top: 7%;
38 padding-bottom: 2%;
39 }
40
41 paper-search-bar {
42 border-style: solid;
43 border-width: 2px;
44 width: 40%;
45 height: 100%;
46 margin: auto;
47 }
48 </style>
49
50 <app-header reveals>
51 <app-toolbar>
52 <image class="logo" src="../../images/chromium.png"/>
53 <div class="title" main-title>Configuration Service (not fully implement ed)</div>
54 </app-toolbar>
55 </app-header>
56
57 <iron-ajax
58 auto
59 id="requestConfigs"
60 url="{{url}}"
61 handle-as="json"
62 on-response="_getConfigs">
63 </iron-ajax>
64
65 <div class="search-bar">
66 <paper-search-bar query="{{search}}"></paper-search-bar>
67 </div>
68
69 <div class="config-list">
70 <template is="dom-if" if="{{_not(isLoading)}}">
71 <template is="dom-if" if="{{_not(isEmpty)}}">
72 <template is="dom-repeat" items="[[searchList]]" as="config">
73 <config-card name="[[config.config_set]]"></config-card>
74 </template>
75 </template>
76 <template is="dom-if" if="{{isEmpty}}">
77 <config-card name="No config sets found."></config-card>
78 </template>
79 </template>
80 <template is="dom-if" if="{{isLoading}}">
81 <config-card name="Fetching configs sets..."></config-card>
82 </template>
83 </div>
84 </template>
85
86 <script>
87 Polymer({
88 is: 'front-page',
89
90 properties: {
91 configList: {
92 type: Array,
93 value: []
94 },
95
96 isEmpty: {
97 type: Boolean,
98 value: true
99 },
100
101 isLoading: {
102 type: Boolean,
103 value: true
104 },
105
106 search: {
107 type: String,
108 observer: '_searched'
109 },
110
111 searchList: {
112 type: Array,
113 value: []
114 },
115
116 url: {
117 type: String,
118 // TODO(cwpayton): Fix URL to reflect specific instances of the luci
119 // config service (i.e., just "/_ah/api/..." instead of "https://luci. ..").
120 // Currently, this link is being left in on purpose in order to grab d ata
121 // for local instances, but this should change when deploying final pr oduct.
122 value: "https://luci-config.appspot.com/_ah/api/config/v1/config-sets"
Sergey Berezin (google) 2017/06/12 22:19:49 I'd say, let's remove the domain part of the URL f
cwpayton 2017/06/12 23:40:05 Done.
123 }
124 },
125
126 _getConfigs: function(event) {
127 this.configList = event.detail.response.config_sets;
128 this.searchList = this._searched();
Sergey Berezin (google) 2017/06/12 22:19:49 No need to assign to this.searchList; _searched()
cwpayton 2017/06/12 23:40:05 This needs to stay in because searchList has no in
129 this.isLoading = false;
130 this.isEmpty = this.searchList.length === 0;
131 },
132
133 _not: function(bool) {
134 return (!(bool));
135 },
136
137 _searched: function() {
138 this.searchList = [];
139 this.configList.forEach((elem) => {
140 if (elem.config_set.includes(this.search)) {
141 this.searchList.push(elem);
142 }
143 });
144 this.isEmpty = this.searchList.length === 0;
145 return this.searchList;
Sergey Berezin (google) 2017/06/12 22:19:49 No need to return the result, since it modifies th
cwpayton 2017/06/12 23:40:05 The return statement is in so that searchList will
146 }
147 });
148 </script>
149 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698