Skip to content

Commit

Permalink
fix(macvlanv2) Resolve regular user permission issue
Browse files Browse the repository at this point in the history
  • Loading branch information
smallteeths authored and ly5156 committed Jan 16, 2025
1 parent e18e5c9 commit 40d3dc2
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions pkg/macvlan/pages/flatnetworkIp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,26 @@ export default {
},
async fetch() {
const { currentCluster } = this;
let config = {};
if (this.$route.params?.id) {
await this.$store.dispatch('flatnetwork/loadFlatnetworkIps', {
cluster: currentCluster?.id,
query: { labelSelector: { subnet: this.$route.params?.id } }
});
const config = await this.$store.dispatch('flatnetwork/loadFlatnetwork', {
cluster: currentCluster?.id,
query: this.$route.params?.id
});
try {
await this.$store.dispatch('flatnetwork/loadFlatnetworkIps', {
cluster: currentCluster?.id,
query: { labelSelector: { subnet: this.$route.params?.id } }
});
} catch (e) {
this.$store.commit('flatnetwork/setFlatnetworkIpList', []);
}
try {
config = await this.$store.dispatch('flatnetwork/loadFlatnetwork', {
cluster: currentCluster?.id,
query: this.$route.params?.id
});
} catch (e) {
config = {};
}
this.config = config;
}
Expand Down Expand Up @@ -121,6 +131,9 @@ export default {
groupBy() {
return 'metadata.namespace';
},
canEdit() {
return !!this.config?.links?.update;
}
},
methods: {
getWorkloadName(name, workloadselector) {
Expand Down Expand Up @@ -168,6 +181,7 @@ export default {
/>
<div class="container">
<button
v-if="canEdit"
type="button"
class="btn role-primary mr-10 edit-button"
@click.prevent.stop="editView"
Expand Down

0 comments on commit 40d3dc2

Please sign in to comment.