Skip to content

Commit 09994a4

Browse files
committed
Don't show register template, create/upload volume and create vpc button if zone is not created.
1 parent d053bb9 commit 09994a4

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

ui/src/config/section/image.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,27 @@ export default {
110110
docHelp: 'adminguide/templates.html#uploading-templates-from-a-remote-http-server',
111111
listView: true,
112112
popup: true,
113+
show: () => {
114+
if (!store.getters.zones || store.getters.zones.length === 0) {
115+
return false
116+
}
117+
return true
118+
},
113119
component: shallowRef(defineAsyncComponent(() => import('@/views/image/RegisterOrUploadTemplate.vue')))
114120
},
115121
{
116122
api: 'registerTemplate',
117123
icon: 'cloud-upload-outlined',
118124
label: 'label.upload.template.from.local',
119-
show: () => { return 'getUploadParamsForTemplate' in store.getters.apis },
120125
docHelp: 'adminguide/templates.html#uploading-templates-and-isos-from-a-local-computer',
121126
listView: true,
122127
popup: true,
128+
show: () => {
129+
if (!store.getters.zones || store.getters.zones.length === 0) {
130+
return false
131+
}
132+
return 'getUploadParamsForTemplate' in store.getters.apis
133+
},
123134
component: shallowRef(defineAsyncComponent(() => import('@/views/image/RegisterOrUploadTemplate.vue')))
124135
},
125136
{

ui/src/config/section/network.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ export default {
242242
icon: 'plus-outlined',
243243
label: 'label.add.vpc',
244244
docHelp: 'adminguide/networking_and_traffic.html#adding-a-virtual-private-cloud',
245+
show: () => {
246+
if (!store.getters.zones || store.getters.zones.length === 0) {
247+
return false
248+
}
249+
return true
250+
},
245251
listView: true,
246252
popup: true,
247253
component: shallowRef(defineAsyncComponent(() => import('@/views/network/CreateVpc.vue')))

ui/src/config/section/storage.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ export default {
103103
icon: 'plus-outlined',
104104
docHelp: 'adminguide/storage.html#creating-a-new-volume',
105105
label: 'label.action.create.volume',
106+
show: () => {
107+
if (!store.getters.zones || store.getters.zones.length === 0) {
108+
return false
109+
}
110+
return true
111+
},
106112
listView: true,
107113
popup: true,
108114
component: shallowRef(defineAsyncComponent(() => import('@/views/storage/CreateVolume.vue')))
@@ -112,7 +118,12 @@ export default {
112118
icon: 'cloud-upload-outlined',
113119
docHelp: 'adminguide/storage.html#uploading-an-existing-volume-to-a-virtual-machine',
114120
label: 'label.upload.volume.from.local',
115-
show: () => { return 'getUploadParamsForVolume' in store.getters.apis },
121+
show: () => {
122+
if (!store.getters.zones || store.getters.zones.length === 0) {
123+
return false
124+
}
125+
return 'getUploadParamsForVolume' in store.getters.apis
126+
},
116127
listView: true,
117128
popup: true,
118129
component: shallowRef(defineAsyncComponent(() => import('@/views/storage/UploadLocalVolume.vue')))
@@ -122,6 +133,12 @@ export default {
122133
icon: 'link-outlined',
123134
docHelp: 'adminguide/storage.html#uploading-an-existing-volume-to-a-virtual-machine',
124135
label: 'label.upload.volume.from.url',
136+
show: () => {
137+
if (!store.getters.zones || store.getters.zones.length === 0) {
138+
return false
139+
}
140+
return true
141+
},
125142
listView: true,
126143
popup: true,
127144
component: shallowRef(defineAsyncComponent(() => import('@/views/storage/UploadVolume.vue')))

0 commit comments

Comments
 (0)