Skip to content

Commit afd2b19

Browse files
committed
minor enhancements
1 parent 0939c8c commit afd2b19

File tree

3 files changed

+53
-6
lines changed

3 files changed

+53
-6
lines changed

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3761,6 +3761,7 @@
37613761
"message.warn.change.primary.storage.scope": "This feature is tested and supported for the following configurations:<br>KVM - NFS/Ceph - DefaultPrimary<br>VMware - NFS - DefaultPrimary<br>*There might be extra steps involved to make it work for other configurations.",
37623762
"message.warn.filetype": "jpg, jpeg, png, bmp and svg are the only supported image formats.",
37633763
"message.warn.importing.instance.without.nic": "WARNING: This Instance is being imported without NICs and many Network resources will not be available. Consider creating a NIC via vCenter before importing or as soon as the Instance is imported.",
3764+
"message.warn.select.template": "Please select a Template for Registration.",
37643765
"message.warn.zone.mtu.update": "Please note that this limit won't affect pre-existing Network’s MTU settings",
37653766
"message.webhook.deliveries.time.filter": "Webhook deliveries list can be filtered based on date-time. Select 'Custom' for specifying start and end date range.",
37663767
"message.zone.creation.complete": "Zone creation complete.",

ui/src/views/infra/zone/ZoneWizard.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
<zone-wizard-register-template
9292
v-else-if="zoneSteps[currentStep].name === 'registerTemplate'"
9393
:zoneid="returnedZoneId"
94+
:arch="selectedArch"
95+
:zoneSuperType="selectedZoneSuperType"
9496
@closeAction="onCloseAction"
9597
@refresh-data="onRefreshData"
9698
/>
@@ -177,7 +179,9 @@ export default {
177179
}
178180
],
179181
zoneConfig: {},
180-
returnedZoneId: null
182+
returnedZoneId: null,
183+
selectedArch: null,
184+
selectedZoneSuperType: 'Core'
181185
}
182186
},
183187
computed: {
@@ -222,11 +226,15 @@ export default {
222226
data.zoneType !== this.zoneConfig.zoneType) {
223227
this.zoneConfig.physicalNetworks = null
224228
}
225-
226-
if (data.zoneReturned) {
229+
if (data.zoneSuperType && data.zoneSuperType !== this.selectedZoneSuperType) {
230+
this.selectedZoneSuperType = data.zoneSuperType
231+
}
232+
if (data.arch && data.arch !== this.selectedArch) {
233+
this.selectedArch = data.arch
234+
}
235+
if (data.zoneReturned?.id) {
227236
this.returnedZoneId = data.zoneReturned.id
228237
}
229-
230238
this.zoneConfig = { ...this.zoneConfig, ...data }
231239
},
232240
onCloseAction () {

ui/src/views/infra/zone/ZoneWizardRegisterTemplate.vue

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@
4040
<a-button class="button-back" @click="handleDone">{{ selectedRowKeys.length > 0 ? $t('label.done') : $t('label.skip') }}</a-button>
4141
<a-button class="button-next" type="primary" @click="handleSubmit" ref="submit">{{ $t('label.register.template') }}</a-button>
4242
</div>
43+
44+
<a-modal
45+
:visible="showAlert"
46+
:footer="null"
47+
style="top: 20px;"
48+
centered
49+
width="auto"
50+
@cancel="showAlert = false"
51+
>
52+
<template #title>
53+
{{ $t('label.warning') }}
54+
</template>
55+
<a-alert type="warning">
56+
<template #message>
57+
<span v-html="$t('message.warn.select.template')" />
58+
</template>
59+
</a-alert>
60+
<a-divider style="margin-top: 0;"></a-divider>
61+
</a-modal>
4362
</div>
4463
</template>
4564

@@ -57,6 +76,14 @@ export default {
5776
zoneid: {
5877
type: String,
5978
required: false
79+
},
80+
arch: {
81+
type: String,
82+
required: false
83+
},
84+
zoneSuperType: {
85+
type: String,
86+
required: false
6087
}
6188
},
6289
data: () => ({
@@ -66,7 +93,8 @@ export default {
6693
rowKey: 0,
6794
selectedRowKeys: [],
6895
defaultOsTypeId: null,
69-
deployedTemplates: {}
96+
deployedTemplates: {},
97+
showAlert: false
7098
}),
7199
created () {
72100
this.initForm()
@@ -132,6 +160,9 @@ export default {
132160
ostypeid: await this.fetchOsTypeId(templateData.name),
133161
zoneid: this.zoneid
134162
}
163+
if (this.zoneSuperType === 'Edge') {
164+
params.directdownload = true
165+
}
135166
return new Promise((resolve, reject) => {
136167
api('registerTemplate', params).then(json => {
137168
const result = json.registertemplateresponse.template[0]
@@ -144,6 +175,10 @@ export default {
144175
},
145176
async stepRegisterTemplates () {
146177
const templatesToRegister = this.predefinedTemplates.filter(template => this.selectedRowKeys.includes(template.id) && this.deployedTemplates[template.id] !== true)
178+
if (templatesToRegister.length === 0) {
179+
this.showAlert = true
180+
return
181+
}
147182
const registrationResults = []
148183
for (const templateData of templatesToRegister) {
149184
const promise = this.registerTemplate(templateData)
@@ -223,7 +258,10 @@ export default {
223258
if (!response.ok) {
224259
throw new Error(`Error fetching predefined templates, status_code: ${response.status}`)
225260
}
226-
this.predefinedTemplates = await response.json()
261+
const templates = await response.json()
262+
this.predefinedTemplates = this.arch
263+
? templates.filter(template => template.arch === this.arch)
264+
: templates
227265
} catch (error) {
228266
console.error('Error fetching predefined templates:', error)
229267
this.predefinedTemplates = []

0 commit comments

Comments
 (0)