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

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

Issue 2935763003: config_service: improve landing page (Closed)
Patch Set: Fixed nodir's comments 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..77edd12038e3b9c819b3ee17dad8eb9ac11a55c5
--- /dev/null
+++ b/appengine/config_service/ui/src/config-ui/front-page.html
@@ -0,0 +1,143 @@
+<!--
+ 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/app-layout/app-layout.html">
+<link rel="import" href="config-card.html">
+<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
+<link rel="import" href="../../bower_components/paper-button/paper-button.html">
+<link rel="import" href="../../bower_components/paper-search/paper-search-bar.html">
+<link rel="import" href="../../bower_components/polymer/polymer.html">
+
+<dom-module id="front-page">
+ <template>
+ <style>
+ app-toolbar {
+ background-color: #efefef;
+ color: #232323;
+ }
+
+ app-header {
+ @apply --layout-fixed-top;
+ }
+
+ .center {
+ width: 50%;
+ margin: auto;
+ text-align: center;
+ }
+
+ .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="https://luci-config.appspot.com/_ah/api/config/v1/config-sets"
nodir 2017/06/13 16:48:22 this is probably slow. currently this loads inform
+ handle-as="json"
+ on-response="_onGotConfigs">
nodir 2017/06/13 16:48:22 apologies, I realized that a better name would be
+ </iron-ajax>
+
+ <div class="search-bar">
+ <paper-search-bar query="{{query}}"></paper-search-bar>
+ </div>
+
+ <div class="config-list">
+ <template is="dom-if" if="[[isLoading]]">
+ <div class="center">Fetching config sets...</div>
+ </template>
+ <template is="dom-if" if="[[_not(isLoading)]]">
+ <template is="dom-if" if="[[isEmpty]]">
+ <config-card name="No config sets found."></config-card>
+ </template>
+ <template is="dom-if" if="[[_not(isEmpty)]]">
+ <template is="dom-repeat" items="[[searchResults]]" 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
+ },
+
+ isLoading: {
+ type: Boolean,
+ value: true
+ },
+
+ query: {
+ type: String,
+ observer: '_updateSearchResults'
+ },
+
+ searchResults: {
+ type: Array,
+ value: () => { return []; }
+ }
+ },
+
+ _onGotConfigs: function(event) {
+ this.configList = event.detail.response.config_sets;
+ this._updateSearchResults();
+ this.isEmpty = this.searchResults.length === 0;
nodir 2017/06/13 16:48:22 _updateSearchResults already updates isEmpty, so t
+ this.isLoading = false;
+ },
+
+ _not: function(bool) {
+ return (!(bool));
+ },
+
+ _updateSearchResults: function() {
+ var query = this.query;
+ this.searchResults = this.configList.filter(function(elem) {
+ return elem.config_set.includes(query);
+ });
nodir 2017/06/13 16:48:22 arrow functions are best for this kind of inline f
+ this.isEmpty = this.searchResults.length === 0;
+ }
+ });
+ </script>
+</dom-module>

Powered by Google App Engine
This is Rietveld 408576698