Use namespace defined in kubeconfig as default in install view (#99)

* respect defualt namespace from kubeconfig

* respect defualt namespace from kubeconfig

* Replace exists with available - avoid confusion in status

* use data attribute

* remove commented line

* fix
This commit is contained in:
ronahk
2022-11-16 13:50:32 +02:00
committed by GitHub
parent d0dbb42492
commit 34a7dc57b2
3 changed files with 5 additions and 3 deletions

View File

@@ -70,7 +70,7 @@ function popUpUpgrade(elm, ns, name, verCur, lastRev) {
$("#upgradeModalLabel .type").text("Install")
$("#upgradeModal .ver-old").hide()
$("#upgradeModal .rel-name").prop("disabled", false).val(elm.name.split("/").pop())
$("#upgradeModal .rel-ns").prop("disabled", false).val("")
$("#upgradeModal .rel-ns").prop("disabled", false).val(ns)
}
$.getJSON("/api/helm/repo/search?name=" + elm.name).fail(function (xhr) {

View File

@@ -130,6 +130,8 @@ function repoChartClicked() {
setHashParam("chart", elm.installed_name)
window.location.reload()
} else {
popUpUpgrade(elm)
const contexts = $("body").data("contexts")
contextNamespace = contexts.filter(obj => {return obj.Name === getHashParam("context")})[0].Namespace
popUpUpgrade(elm, contextNamespace)
}
}

View File

@@ -4,10 +4,10 @@ $(function () {
window.location.href = "/#context=" + clusterSelect.find("input:radio:checked").val()
window.location.reload()
})
$.getJSON("/api/kube/contexts").fail(function (xhr) {
reportError("Failed to get list of clusters", xhr)
}).done(function (data) {
$("body").data("contexts", data)
const context = getHashParam("context")
data.sort((a, b) => (getCleanClusterName(a.Name) > getCleanClusterName(b.Name)) - (getCleanClusterName(a.Name) < getCleanClusterName(b.Name)))
fillClusterList(data, context);