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

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

Issue 2959833002: config_service: add last import validation and tests (Closed)
Patch Set: Add test files. 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/config-set.html
diff --git a/appengine/config_service/ui/src/config-ui/config-set.html b/appengine/config_service/ui/src/config-ui/config-set.html
new file mode 100644
index 0000000000000000000000000000000000000000..16424aecb831029a2f879a34531fd2bebb9b8bba
--- /dev/null
+++ b/appengine/config_service/ui/src/config-ui/config-set.html
@@ -0,0 +1,151 @@
+<!--
+ 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="config-file-card.html">
+<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
+<link rel="import" href="../../bower_components/paper-item/paper-item.html">
+<link rel="import" href="../../bower_components/polymer/polymer.html">
+<link rel="import" href="../../bower_components/iron-icons/maps-icons.html">
+
+<dom-module id="config-set">
+ <template>
+ <style>
+ .category {
+ font-size: 100%;
+ font-family: sans-serif;
+ }
+
+ .center {
+ width: 27%;
+ margin: auto;
+ text-align: left;
+ }
+
+ .name {
+ font-size: 200%;
+ font-family: sans-serif;
+ }
+
+ .title {
+ padding-bottom: 1%;
+ padding-top: 5%;
+ }
+ </style>
+
+ <iron-ajax
+ auto
+ id="requestConfigs"
+ url="/_ah/api/config/v1/config-sets?config_set=[[category]]%2F[[name]][[route.path]]&include_files=true&include_last_import_attempt=true"
+ handle-as="json"
+ on-response="_onGotConfigFiles">
+ </iron-ajax>
+
+ <div class="center title">
+ <div class="name">[[name]][[route.path]]
+ <template is="dom-if" if="[[_not(isLoading)]]">
+ <template is="dom-if" if="[[lastImportAttempt.success]]">
+ <iron-icon icon="icons:check-circle"></iron-icon>
+ </template>
+ <template is="dom-if" if="[[_not(lastImportAttempt.success)]]">
+ <iron-icon icon="icons:warning"></iron-icon>
+ </template>
+ </template>
+ </div>
+ <div class="category">
+ [[_formatCategory(category)]] <br>
+ <template is="dom-if" if="[[_not(isLoading)]]">
+ <template is="dom-if" if="[[_not(lastImportAttempt.success)]]">
+ Last import attempt failed: [[lastImportAttempt.message]]
+ </template>
+ </template>
+ </div>
+ </div>
+
+ <template is="dom-if" if="[[isLoading]]">
+ <div class="center">Fetching config files...</div>
+ </template>
+ <template is="dom-if" if="[[_not(isLoading)]]">
+ <template is="dom-if" if="[[_isEmpty(files)]]">
+ <div class="center" style="font-family: sans-serif;">
+ No config files found.
+ </div>
+ </template>
+ <template is="dom-if" if="[[_not(_isEmpty(files))]]">
+ <template is="dom-repeat" items="[[files]]" as="file">
+ <config-file-card
+ name="[[file.path]]" link="[[location]]/[[file.path]]">
+ </config-file-card>
+ </template>
+ </template>
+ </template>
+ </template>
+ <script>
+ Polymer({
+ is: "config-set",
+
+ properties: {
+
+ frontPageIsActive: {
+ type: Boolean,
+ observer: '_frontPageIsActive'
+ },
+
+ category: {
+ type: String
+ },
+
+ files: {
+ type: Array
+ },
+
+ isLoading: {
+ type: Boolean
+ },
+
+ lastImportAttempt: {
+ type: Object
+ },
+
+ location: {
+ type: String
+ },
+
+ name: {
+ type: String
+ }
+ },
+
+ _frontPageIsActive: function() {
+ if (this.frontPageIsActive === false) {
+ this.isLoading = true;
+ this.$.requestConfigs.generateRequest();
+ }
+ },
+
+ _isEmpty: function(list) {
+ return list.length === 0;
+ },
+
+ _formatCategory: function(category) {
+ if (category === "projects") return "Project";
+ if (category === "services") return "Service";
+ },
+
+ _not: function(b) {
+ return !b;
+ },
+
+ _onGotConfigFiles: function(event) {
+ this.files = event.detail.response.config_sets[0].files ?
+ event.detail.response.config_sets[0].files : [];
+ this.location = event.detail.response.config_sets[0].location;
+ this.lastImportAttempt =
+ event.detail.response.config_sets[0].last_import_attempt;
+ this.isLoading = false;
+ }
+ });
+ </script>
+</dom-module>

Powered by Google App Engine
This is Rietveld 408576698