diff --git a/pkg/macvlan/pages/flatnetworkIp.vue b/pkg/macvlan/pages/flatnetworkIp.vue index 8ff5c1f85ae..384e76e676f 100644 --- a/pkg/macvlan/pages/flatnetworkIp.vue +++ b/pkg/macvlan/pages/flatnetworkIp.vue @@ -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; } @@ -121,6 +131,9 @@ export default { groupBy() { return 'metadata.namespace'; }, + canEdit() { + return !!this.config?.links?.update; + } }, methods: { getWorkloadName(name, workloadselector) { @@ -168,6 +181,7 @@ export default { />