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>"
|
placeholder="<namespace>/<service>:<port>"
|
||||||
id="input-prometheuspath"
|
id="input-prometheuspath"
|
||||||
@blur="onPrometheusSave"
|
@blur="onPrometheusSave"
|
||||||
|
:state="errors.prometheusPath"
|
||||||
/>
|
/>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</div>
|
</div>
|
||||||
@ -82,6 +83,7 @@ export default {
|
|||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
errors: {
|
errors: {
|
||||||
|
prometheusPath: null,
|
||||||
terminalcwd: null
|
terminalcwd: null
|
||||||
},
|
},
|
||||||
prometheusPath: "",
|
prometheusPath: "",
|
||||||
@ -110,7 +112,8 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
updateValues: function(){
|
updateValues: function(){
|
||||||
if (this.cluster.preferences.prometheus) {
|
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}`
|
this.prometheusPath = `${prom.namespace}/${prom.service}:${prom.port}${prom.prefix}`
|
||||||
} else {
|
} else {
|
||||||
this.prometheusPath = ""
|
this.prometheusPath = ""
|
||||||
@ -124,6 +127,11 @@ export default {
|
|||||||
parsePrometheusPath: function(path) {
|
parsePrometheusPath: function(path) {
|
||||||
const parsed = path.split(/\/|:/, 3)
|
const parsed = path.split(/\/|:/, 3)
|
||||||
const apiPrefix = path.substring(parsed.join("/").length)
|
const apiPrefix = path.substring(parsed.join("/").length)
|
||||||
|
if (parsed[0] && parsed[1] && parsed[2]) {
|
||||||
|
this.errors.prometheusPath = true;
|
||||||
|
} else {
|
||||||
|
this.errors.prometheusPath = false;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
namespace: parsed[0],
|
namespace: parsed[0],
|
||||||
service: parsed[1],
|
service: parsed[1],
|
||||||
@ -165,6 +173,7 @@ export default {
|
|||||||
onPrometheusProviderSave: function() {
|
onPrometheusProviderSave: function() {
|
||||||
if (this.prometheusProvider === "") {
|
if (this.prometheusProvider === "") {
|
||||||
this.cluster.preferences.prometheusProvider = null;
|
this.cluster.preferences.prometheusProvider = null;
|
||||||
|
this.cluster.preferences.prometheus = null;
|
||||||
} else {
|
} else {
|
||||||
this.cluster.preferences.prometheusProvider = { type: this.prometheusProvider }
|
this.cluster.preferences.prometheusProvider = { type: this.prometheusProvider }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user