diff --git a/pkg/dashboard/static/actions.js b/pkg/dashboard/static/actions.js index 6113e2e..d20ec32 100644 --- a/pkg/dashboard/static/actions.js +++ b/pkg/dashboard/static/actions.js @@ -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) { diff --git a/pkg/dashboard/static/repo.js b/pkg/dashboard/static/repo.js index f79cec6..9b9be9e 100644 --- a/pkg/dashboard/static/repo.js +++ b/pkg/dashboard/static/repo.js @@ -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) } } \ No newline at end of file diff --git a/pkg/dashboard/static/scripts.js b/pkg/dashboard/static/scripts.js index 4e9d0ba..f81288f 100644 --- a/pkg/dashboard/static/scripts.js +++ b/pkg/dashboard/static/scripts.js @@ -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);