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

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 tests for config-set page and front-page. Created 3 years, 5 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
index e9137add5160c6ca86750d0cf1e5c5c037bd4e6a..a52040e8bfb8cb84c007abf758865bcaabf67987 100644
--- a/appengine/config_service/ui/src/config-ui/config-set.html
+++ b/appengine/config_service/ui/src/config-ui/config-set.html
@@ -9,6 +9,7 @@
<link rel="import" href="../../bower_components/iron-icons/iron-icons.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>
@@ -42,7 +43,7 @@
<iron-ajax
auto
id="requestConfigs"
- url="/_ah/api/config/v1/config-sets?config_set=[[category]]/[[name]][[route.path]]&include_files=true"
+ 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"
headers="[[auth_headers]]">
@@ -58,15 +59,40 @@
headers="[[auth_headers]]">
</iron-ajax>
- <div class="center title">
+ <div class="center title">
<div class="name">
[[name]][[route.path]]
- <template is="dom-if" if="[[auth_headers]]">
+ <template is="dom-if" if="[[_not(isLoading)]]">
+ <template is="dom-if" if="[[lastImportAttempt]]">
+ <template is="dom-if" if="[[lastImportAttempt.success]]">
+ <iron-icon id="valid" icon="icons:check-circle"></iron-icon>
+ </template>
+ <template is="dom-if" if="[[_not(lastImportAttempt.success)]]">
+ <iron-icon id="invalid" icon="icons:warning"></iron-icon>
+ </template>
+ </template>
+ <template is="dom-if" if="[[_not(lastImportAttempt)]]">
+ <iron-icon icon="icons:help"></iron-icon>
+ </template>
+ </template>
+ <template is="dom-if" if="[[auth_headers]]">
<iron-icon icon="icons:refresh" on-tap="_forceRefresh"></iron-icon>
<span id="refreshStatus">[[refreshMessage]]</span>
</template>
</div>
- <div class="category">[[_formatCategory(category)]]</div>
+ <div class="category">
+ [[_formatCategory(category)]] <br>
+ <template is="dom-if" if="[[_not(isLoading)]]">
+ <template is="dom-if" if="[[lastImportAttempt]]">
+ <template is="dom-if" if="[[_not(lastImportAttempt.success)]]">
+ Last import attempt failed: [[lastImportAttempt.message]]
+ </template>
+ </template>
+ <template is="dom-if" if="[[_not(lastImportAttempt)]]">
+ Last import attempt info not available.
+ </template>
+ </template>
+ </div>
</div>
<template is="dom-if" if="[[isRefreshing]]">
<div class="center">Refreshing config files...</div>
@@ -75,11 +101,18 @@
<template is="dom-if" if="[[isLoading]]">
<div class="center">Fetching config files...</div>
</template>
- <template is="dom-if" if="[[!isLoading]]">
- <template is="dom-repeat" items="[[files]]" as="file">
- <config-file-card
- name="[[file.path]]" link="[[location]]/[[file.path]]">
- </config-file-card>
+ <template is="dom-if" if="[[_not(isLoading)]]">
Ryan Tseng 2017/07/10 19:37:01 why are some ! and some _not()?
ayanaadylova 2017/07/10 20:33:34 Cameron used ! somewhere, but we figured out that
+ <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>
@@ -89,6 +122,12 @@
is: "config-set",
properties: {
+
+ frontPageIsActive: {
+ type: Boolean,
+ observer: '_frontPageIsActive'
+ },
+
category: {
type: String
},
@@ -107,6 +146,10 @@
value: false
},
+ lastImportAttempt: {
+ type: Object
+ },
+
location: {
type: String
},
@@ -127,6 +170,21 @@
this.isRefreshing = true;
},
+ _frontPageIsActive: function() {
+ if (this.frontPageIsActive === false) {
+ this.isLoading = true;
+ this.$.requestConfigs.generateRequest();
+ }
+ },
+
+ ready: function() {
+ this.isLoading = true;
+ },
+
+ _isEmpty: function(list) {
+ return list.length === 0;
+ },
+
_formatCategory: function(category) {
if (category === "projects") return "Project";
if (category === "services") return "Service";
@@ -137,9 +195,17 @@
this.refreshMessage = "Refresh successful.";
},
+ _not: function(b) {
+ return !b;
+ },
+
_onGotConfigFiles: function(event) {
- this.files = event.detail.response.config_sets[0].files;
+ this.files = event.detail.response.config_sets[0].files ?
Ryan Tseng 2017/07/10 19:37:01 event.detail.response.config_sets[0].files || []
ayanaadylova 2017/07/10 20:33:34 Done.
+ 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 ?
Ryan Tseng 2017/07/10 19:37:01 event.detail.response.config_sets[0].last_import_a
ayanaadylova 2017/07/10 20:33:34 Done.
+ event.detail.response.config_sets[0].last_import_attempt : null;
this.isLoading = false;
},

Powered by Google App Engine
This is Rietveld 408576698