| OLD | NEW |
| (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="config-file-card.html"> |
| 8 <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> |
| 9 <link rel="import" href="../../bower_components/paper-item/paper-item.html"> |
| 10 <link rel="import" href="../../bower_components/polymer/polymer.html"> |
| 11 |
| 12 <dom-module id="config-set"> |
| 13 <template> |
| 14 <style> |
| 15 .category { |
| 16 font-size: 100%; |
| 17 font-family: sans-serif; |
| 18 } |
| 19 |
| 20 .center { |
| 21 width: 27%; |
| 22 margin: auto; |
| 23 text-align: left; |
| 24 } |
| 25 |
| 26 .name { |
| 27 font-size: 200%; |
| 28 font-family: sans-serif; |
| 29 } |
| 30 |
| 31 .title { |
| 32 padding-bottom: 1%; |
| 33 padding-top: 5%; |
| 34 } |
| 35 </style> |
| 36 |
| 37 <iron-ajax |
| 38 auto |
| 39 id="requestConfigs" |
| 40 url="/_ah/api/config/v1/config-sets?config_set=[[category]]%2F[[name]]&i
nclude_files=true" |
| 41 handle-as="json" |
| 42 on-response="_onGotConfigFiles"> |
| 43 </iron-ajax> |
| 44 |
| 45 <div class="center title"> |
| 46 <div class="name">[[name]][[route.path]]</div> |
| 47 <div class="category">[[_formatCategory(category)]]</div> |
| 48 </div> |
| 49 |
| 50 <template is="dom-if" if="[[isLoading]]"> |
| 51 <div class="center">Fetching config files...</div> |
| 52 </template> |
| 53 <template is="dom-if" if="[[_not(isLoading)]]"> |
| 54 <template is="dom-repeat" items="[[files]]" as="file"> |
| 55 <config-file-card |
| 56 name="[[file.path]]" link="[[location]]/[[file.path]]"> |
| 57 </config-file-card> |
| 58 </template> |
| 59 </template> |
| 60 </template> |
| 61 <script> |
| 62 Polymer({ |
| 63 is: "config-set", |
| 64 |
| 65 properties: { |
| 66 category: { |
| 67 type: String |
| 68 }, |
| 69 |
| 70 files: { |
| 71 type: Array |
| 72 }, |
| 73 |
| 74 isLoading: { |
| 75 type: Boolean, |
| 76 value: true |
| 77 }, |
| 78 |
| 79 location: { |
| 80 type: String |
| 81 }, |
| 82 |
| 83 name: { |
| 84 type: String |
| 85 } |
| 86 }, |
| 87 |
| 88 _formatCategory: function(category) { |
| 89 if (category === "projects") return "Project"; |
| 90 if (category === "services") return "Service"; |
| 91 }, |
| 92 |
| 93 _not: function(b) { |
| 94 return !b; |
| 95 }, |
| 96 |
| 97 _onGotConfigFiles: function(event) { |
| 98 this.files = event.detail.response.config_sets[0].files; |
| 99 this.location = event.detail.response.config_sets[0].location; |
| 100 this.isLoading = false; |
| 101 } |
| 102 }); |
| 103 </script> |
| 104 </dom-module> |
| OLD | NEW |