mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Prometheus provider/path related ui fixes (#354)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
2c3dc8370d
commit
5cd00bd77a
@ -41,6 +41,7 @@
|
||||
placeholder="<namespace>/<service>:<port>"
|
||||
id="input-prometheuspath"
|
||||
@blur="onPrometheusSave"
|
||||
:state="errors.prometheusPath"
|
||||
/>
|
||||
</b-form-group>
|
||||
</div>
|
||||
@ -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 }
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user