| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2017 The LUCI Authors. All rights reserved. | 2 Copyright 2017 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 | 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. | 4 that can be found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <link rel="import" href="../../bower_components/app-layout/app-layout.html"> | 7 <link rel="import" href="../../bower_components/app-layout/app-layout.html"> |
| 8 <link rel="import" href="config-card.html"> | |
| 9 <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> | 8 <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> |
| 10 <link rel="import" href="../../bower_components/paper-button/paper-button.html"> | 9 <link rel="import" href="../../bower_components/paper-button/paper-button.html"> |
| 11 <link rel="import" href="../../bower_components/paper-search/paper-search-bar.ht
ml"> | 10 <link rel="import" href="../../bower_components/paper-search/paper-search-bar.ht
ml"> |
| 12 <link rel="import" href="../../bower_components/polymer/polymer.html"> | 11 <link rel="import" href="../../bower_components/polymer/polymer.html"> |
| 13 | 12 |
| 13 <link rel="import" href="config-set-card.html"> |
| 14 |
| 14 <dom-module id="front-page"> | 15 <dom-module id="front-page"> |
| 15 <template> | 16 <template> |
| 16 <style> | 17 <style> |
| 17 app-toolbar { | |
| 18 background-color: #efefef; | |
| 19 color: #232323; | |
| 20 } | |
| 21 | |
| 22 app-header { | |
| 23 @apply --layout-fixed-top; | |
| 24 } | |
| 25 | |
| 26 .center { | 18 .center { |
| 27 width: 50%; | 19 width: 50%; |
| 28 margin: auto; | 20 margin: auto; |
| 29 text-align: center; | 21 text-align: center; |
| 30 } | 22 } |
| 31 | 23 |
| 32 .logo { | |
| 33 height: 100%; | |
| 34 } | |
| 35 | |
| 36 .title { | |
| 37 padding-left: 1%; | |
| 38 font-size: 150%; | |
| 39 font-family: sans-serif; | |
| 40 } | |
| 41 | |
| 42 .search-bar { | 24 .search-bar { |
| 43 padding-top: 7%; | 25 padding-top: 7%; |
| 44 padding-bottom: 2%; | 26 padding-bottom: 2%; |
| 45 } | 27 } |
| 46 | 28 |
| 47 paper-search-bar { | 29 paper-search-bar { |
| 48 border-style: solid; | 30 border-style: solid; |
| 49 border-width: 2px; | 31 border-width: 2px; |
| 50 width: 40%; | 32 width: 40%; |
| 51 height: 100%; | 33 height: 100%; |
| 52 margin: auto; | 34 margin: auto; |
| 53 } | 35 } |
| 54 </style> | 36 </style> |
| 55 | 37 |
| 56 <app-header reveals> | |
| 57 <app-toolbar> | |
| 58 <image class="logo" src="/static/images/chromium.png"/> | |
| 59 <div class="title" main-title>Configuration Service (not fully implement
ed)</div> | |
| 60 </app-toolbar> | |
| 61 </app-header> | |
| 62 | |
| 63 <iron-ajax | 38 <iron-ajax |
| 64 auto | 39 auto |
| 65 id="requestConfigs" | 40 id="requestConfigs" |
| 66 url="/_ah/api/config/v1/config-sets" | 41 url="/_ah/api/config/v1/config-sets" |
| 67 handle-as="json" | 42 handle-as="json" |
| 68 on-response="_onGotConfigSets"> | 43 on-response="_onGotConfigSets"> |
| 69 </iron-ajax> | 44 </iron-ajax> |
| 70 | 45 |
| 71 <div class="search-bar"> | 46 <div class="search-bar"> |
| 72 <paper-search-bar query="{{query}}"></paper-search-bar> | 47 <paper-search-bar query="{{query}}"></paper-search-bar> |
| 73 </div> | 48 </div> |
| 74 | 49 |
| 75 <div class="config-list"> | 50 <div class="config-list"> |
| 76 <template is="dom-if" if="[[isLoading]]"> | 51 <template is="dom-if" if="[[isLoading]]"> |
| 77 <div class="center">Fetching config sets...</div> | 52 <div class="center">Fetching config sets...</div> |
| 78 </template> | 53 </template> |
| 79 <template is="dom-if" if="[[_not(isLoading)]]"> | 54 <template is="dom-if" if="[[_not(isLoading)]]"> |
| 80 <template is="dom-if" if="[[_isEmpty(searchResults)]]"> | 55 <template is="dom-if" if="[[_isEmpty(searchResults)]]"> |
| 81 <div class="center">No config sets found.</div> | 56 <div class="center">No config sets found.</div> |
| 82 </template> | 57 </template> |
| 83 <template is="dom-if" if="[[_not(_isEmpty(searchResults))]]"> | 58 <template is="dom-if" if="[[_not(_isEmpty(searchResults))]]"> |
| 84 <template is="dom-repeat" items="[[searchResults]]" as="config"> | 59 <template is="dom-repeat" items="[[searchResults]]" as="config"> |
| 85 <config-card name="[[config.config_set]]"></config-card> | 60 <config-set-card name="[[config.config_set]]" on-tap="_handleClick">
</config-set-card> |
| 86 </template> | 61 </template> |
| 87 </template> | 62 </template> |
| 88 </template> | 63 </template> |
| 89 </div> | 64 </div> |
| 90 </template> | 65 </template> |
| 91 | 66 |
| 92 <script> | 67 <script> |
| 93 Polymer({ | 68 Polymer({ |
| 94 is: 'front-page', | 69 is: 'front-page', |
| 95 | 70 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 124 this._updateSearchResults(); | 99 this._updateSearchResults(); |
| 125 this.isLoading = false; | 100 this.isLoading = false; |
| 126 }, | 101 }, |
| 127 | 102 |
| 128 _not: function(b) { | 103 _not: function(b) { |
| 129 return !b; | 104 return !b; |
| 130 }, | 105 }, |
| 131 | 106 |
| 132 _updateSearchResults: function() { | 107 _updateSearchResults: function() { |
| 133 this.searchResults = this.configSetList.filter(e => e.config_set.include
s(this.query)); | 108 this.searchResults = this.configSetList.filter(e => e.config_set.include
s(this.query)); |
| 134 } | 109 }, |
| 110 |
| 111 _handleClick: function(event) { |
| 112 window.location = window.location.href + event.model.config.config_set; |
| 113 }, |
| 114 |
| 135 }); | 115 }); |
| 136 </script> | 116 </script> |
| 137 </dom-module> | 117 </dom-module> |
| OLD | NEW |