Skip to content

Commit

Permalink
fix(ui): single namespace properly filtered
Browse files Browse the repository at this point in the history
  • Loading branch information
MilosPaunovic committed Jul 19, 2024
1 parent b1a7353 commit c0f8870
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
14 changes: 5 additions & 9 deletions ui/src/components/namespace/Namespace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
...mapState("auth", ["user"]),
...mapState("namespace", ["dependencies"]),
canCreateSecret() {
return this.$route.params.namespace && this.user &&
this.user.isAllowed(permission.SECRET, action.CREATE, this.$route.params.namespace);
return this.$route.params.id && this.user &&
this.user.isAllowed(permission.SECRET, action.CREATE, this.$route.params.id);
},
canCreateKv() {
return this.$route.params.namespace;
return this.$route.params.id;
},
routeInfo() {
return {
Expand Down Expand Up @@ -217,12 +217,8 @@
},
methods: {
loadItem() {
if (this.$route.params.namespace) {
this.$store
.dispatch(
"namespace/load",
this.$route.params
)
if (this.$route.params.id) {
this.$store.dispatch("namespace/load",this.$route.params.id)
}
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<NamespaceDependencies :id="route.params.namespace" />
<NamespaceDependencies :id="route.params.id" />
</template>

<script setup>
Expand Down
10 changes: 5 additions & 5 deletions ui/src/components/namespace/NamespaceKV.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@
return this.kv.key ? this.$t("kv.update", {key: this.kv.key}) : this.$t("kv.add");
},
canUpdateKv() {
return this.$route.params.namespace
return this.$route.params.id
},
canDeleteKv() {
return this.$route.params.namespace
return this.$route.params.id
},
addKvDrawerVisible: {
get() {
Expand Down Expand Up @@ -227,7 +227,7 @@
},
async updateKvModal(key) {
this.kv.key = key;
const {type, value} = await this.$store.dispatch("namespace/kv", {namespace: this.$route.params.namespace, key});
const {type, value} = await this.$store.dispatch("namespace/kv", {namespace: this.$route.params.id, key});
this.kv.type = type;
if (type === "JSON") {
this.kv.value = JSON.stringify(value);
Expand All @@ -242,7 +242,7 @@
removeKv(key) {
this.$toast().confirm(this.$t("delete confirm", {name: key}), () => {
return this.$store
.dispatch("namespace/deleteKv", {namespace: this.$route.params.namespace, key: key})
.dispatch("namespace/deleteKv", {namespace: this.$route.params.id, key: key})
.then(() => {
this.$toast().deleted(key);
});
Expand All @@ -269,7 +269,7 @@
return this.$store
.dispatch(
"namespace/createKv",
{namespace: this.$route.params.namespace, ...this.kv, value}
{namespace: this.$route.params.id, ...this.kv, value}
)
.then(() => {
this.$toast().saved(this.kv.key);
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/namespace/Overview.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div>
<home
:namespace="$route.params.namespace || $route.query.id"
:namespace="$route.params.id || $route.query.id"
:restore-url="false"
:description="$route.params.namespace ? namespace?.description : undefined"
:description="$route.params.id ? namespace?.description : undefined"
embed
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/stores/namespaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default {
return response.data.results;
})
},
load({commit}, options) {
return this.$http.get(`${apiUrl(this)}/namespaces/${options.id}`, VALIDATE)
load({commit}, id) {
return this.$http.get(`${apiUrl(this)}/namespaces/${id}`, VALIDATE)
.then(response => {
if(response.status === 200) commit("setNamespace", response.data)
return response.data;
Expand Down

0 comments on commit c0f8870

Please sign in to comment.