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

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

Issue 2935763003: config_service: improve landing page (Closed)
Patch Set: Fixed app.yaml bug 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 side-by-side diff with in-line comments
Download patch
Index: appengine/config_service/ui/src/config-ui/front-page.html
diff --git a/appengine/config_service/ui/src/config-ui/front-page.html b/appengine/config_service/ui/src/config-ui/front-page.html
new file mode 100644
index 0000000000000000000000000000000000000000..6e806a07af116ec10d7406318a843c1e63bf3955
--- /dev/null
+++ b/appengine/config_service/ui/src/config-ui/front-page.html
@@ -0,0 +1,145 @@
+<!--
+ Copyright 2017 The LUCI Authors. All rights reserved.
+ Use of this source code is governed under the Apache License, Version 2.0
+ that can be found in the LICENSE file.
+-->
+
+<link rel="import" href="../../bower_components/polymer/polymer.html">
+<link rel="import" href="../../bower_components/app-layout/app-layout.html">
+<link rel="import" href="../../bower_components/paper-search/paper-search-bar.html">
+<link rel="import" href="../../bower_components/paper-button/paper-button.html">
+<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
+<link rel="import" href="config-card.html">
+
+<dom-module id="front-page">
+ <template>
+ <style>
+ app-toolbar {
+ background-color: #efefef;
+ color: #232323;
+ }
+
+ app-header {
+ @apply --layout-fixed-top;
+ }
+
+ .logo {
+ height: 100%;
+ }
+
+ .title {
+ padding-left: 1%;
+ font-size: 150%;
+ font-family: sans-serif;
+ }
+
+ .search-bar {
+ padding-top: 7%;
+ padding-bottom: 2%;
+ }
+
+ paper-search-bar {
+ border-style: solid;
+ border-width: 2px;
+ width: 40%;
+ height: 100%;
+ margin: auto;
+ }
+ </style>
+
+ <app-header reveals>
+ <app-toolbar>
+ <image class="logo" src="/static/images/chromium.png"/>
+ <div class="title" main-title>Configuration Service (not fully implemented)</div>
+ </app-toolbar>
+ </app-header>
+
+ <iron-ajax
+ auto
+ id="requestConfigs"
+ url="{{url}}"
nodir 2017/06/13 02:10:15 why this is a property binding as opposed to a con
cwpayton 2017/06/13 16:22:15 Done.
+ handle-as="json"
+ on-response="_getConfigs">
+ </iron-ajax>
+
+ <div class="search-bar">
+ <paper-search-bar query="{{search}}"></paper-search-bar>
+ </div>
+
+ <div class="config-list">
+ <template is="dom-if" if="{{isLoading}}">
+ <config-card name="Fetching configs sets..."></config-card>
nodir 2017/06/13 02:10:15 s/configs sets/config sets/
nodir 2017/06/13 02:10:15 why is it a config card? It does not look right. I
cwpayton 2017/06/13 16:22:14 Done.
cwpayton 2017/06/13 16:22:14 Done.
+ </template>
+ <template is="dom-if" if="{{_not(isLoading)}}">
nodir 2017/06/13 02:10:14 use [[]] for read-only data bindings
cwpayton 2017/06/13 16:22:15 Done.
+ <template is="dom-if" if="{{isEmpty}}">
nodir 2017/06/13 02:10:14 use [[]] for read-only data bindings
cwpayton 2017/06/13 16:22:14 Done.
+ <config-card name="No config sets found."></config-card>
+ </template>
+ <template is="dom-if" if="{{_not(isEmpty)}}">
nodir 2017/06/13 02:10:14 use [[]] for read-only data bindings
cwpayton 2017/06/13 16:22:14 Done.
+ <template is="dom-repeat" items="[[searchList]]" as="config">
+ <config-card name="[[config.config_set]]"></config-card>
+ </template>
+ </template>
+ </template>
+ </div>
+ </template>
+
+ <script>
+ Polymer({
+ is: 'front-page',
+
+ properties: {
+ configList: {
+ type: Array,
+ value: []
+ },
+
+ isEmpty: {
+ type: Boolean,
+ value: true
nodir 2017/06/13 02:10:15 FWIU isEmpty is true if and only if len(searchList
cwpayton 2017/06/13 16:22:14 If I implement this as a function, it only gets ca
nodir 2017/06/13 16:48:22 i meant that isEmpty should accept search results
cwpayton 2017/06/13 17:00:03 Done.
+ },
+
+ isLoading: {
+ type: Boolean,
+ value: true
+ },
+
+ search: {
nodir 2017/06/13 02:10:15 responsibility of this property is not obvious fro
cwpayton 2017/06/13 16:22:15 Done.
+ type: String,
+ observer: '_searched'
+ },
+
+ searchList: {
+ type: Array,
+ value: []
nodir 2017/06/13 02:10:14 see https://www.polymer-project.org/1.0/docs/devgu
cwpayton 2017/06/13 16:22:15 Done. Does it matter whether I use arrow function
nodir 2017/06/13 16:48:22 arrow function is nice
cwpayton 2017/06/13 17:00:03 Done.
+ },
+
+ url: {
+ type: String,
+ value: "https://luci-config.appspot.com/_ah/api/config/v1/config-sets"
+ }
nodir 2017/06/13 02:10:15 i don't think this property is needed
cwpayton 2017/06/13 16:22:15 Done.
+ },
+
+ _getConfigs: function(event) {
nodir 2017/06/13 02:10:15 name "_getConfigs" looks like it will get configs
cwpayton 2017/06/13 16:22:14 Done.
+ this.configList = event.detail.response.config_sets;
+ this.searchList = this._searched();
nodir 2017/06/13 02:10:14 _searched() sets this.searchList and returns it. T
cwpayton 2017/06/13 16:22:14 Done.
+ this.isLoading = false;
+ this.isEmpty = this.searchList.length === 0;
+ },
+
+ _not: function(bool) {
+ return (!(bool));
+ },
+
+ _searched: function() {
nodir 2017/06/13 02:10:14 responsibility of this function is not obvious fro
cwpayton 2017/06/13 16:22:14 Done.
+ this.searchList = [];
+ this.configList.forEach((elem) => {
nodir 2017/06/13 02:10:15 parens around elem are unnecessary
cwpayton 2017/06/13 16:22:14 Done.
+ if (elem.config_set.includes(this.search)) {
+ this.searchList.push(elem);
+ }
+ });
nodir 2017/06/13 02:10:14 this essentially filters this.configList. Using fi
cwpayton 2017/06/13 16:22:15 Done.
+ this.isEmpty = this.searchList.length === 0;
+ return this.searchList;
nodir 2017/06/13 02:10:14 there is no need to return this.searchList. If som
cwpayton 2017/06/13 16:22:15 Done.
+ }
+ });
+ </script>
+</dom-module>

Powered by Google App Engine
This is Rietveld 408576698