From 5cd00bd77aebead8333378c568ca7857ed89eb6a Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Sat, 9 May 2020 09:04:38 +0300 Subject: [PATCH] Prometheus provider/path related ui fixes (#354) Signed-off-by: Jari Kolehmainen --- .../components/ClusterSettings/Preferences/index.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/ClusterSettings/Preferences/index.vue b/src/renderer/components/ClusterSettings/Preferences/index.vue index 00753e9ff7..1da11ad072 100644 --- a/src/renderer/components/ClusterSettings/Preferences/index.vue +++ b/src/renderer/components/ClusterSettings/Preferences/index.vue @@ -41,6 +41,7 @@ placeholder="/:" id="input-prometheuspath" @blur="onPrometheusSave" + :state="errors.prometheusPath" /> @@ -82,6 +83,7 @@ export default { data(){ return { errors: { + prometheusPath: null, terminalcwd: null }, prometheusPath: "", @@ -110,7 +112,8 @@ export default { methods: { updateValues: function(){ if (this.cluster.preferences.prometheus) { - const prom = this.cluster.preferences.prometheus; + const prom = this.cluster.preferences.prometheus + if (!prom.prefix) prom.prefix = "" this.prometheusPath = `${prom.namespace}/${prom.service}:${prom.port}${prom.prefix}` } else { this.prometheusPath = "" @@ -124,6 +127,11 @@ export default { parsePrometheusPath: function(path) { const parsed = path.split(/\/|:/, 3) const apiPrefix = path.substring(parsed.join("/").length) + if (parsed[0] && parsed[1] && parsed[2]) { + this.errors.prometheusPath = true; + } else { + this.errors.prometheusPath = false; + } return { namespace: parsed[0], service: parsed[1], @@ -165,6 +173,7 @@ export default { onPrometheusProviderSave: function() { if (this.prometheusProvider === "") { this.cluster.preferences.prometheusProvider = null; + this.cluster.preferences.prometheus = null; } else { this.cluster.preferences.prometheusProvider = { type: this.prometheusProvider } }