Skip to content

Commit 64560e3

Browse files
author
Landry JUGE
committed
Fix service offering category selector label, reset, and VNF wizard support
- Add missing label.categoryid translation so the compute offering edit form shows "Category" instead of the raw i18n key. - Fix instance wizard not resetting the offering list when switching the category back to "All": the stale categoryid persisted in the merged search options and was re-sent. Now explicitly cleared. - Wire up the service offering category selector in the VNF appliance deploy wizard, mirroring the standard instance wizard.
1 parent 8260735 commit 64560e3

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@
524524
"label.capacitybytes": "Capacity bytes",
525525
"label.capacityiops": "IOPS total",
526526
"label.category": "Category",
527+
"label.categoryid": "Category",
527528
"label.categoryname": "Category name",
528529
"label.certchain": "Chain",
529530
"label.certificate": "Certificate",

ui/src/views/compute/DeployVM.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,6 +2315,8 @@ export default {
23152315
}
23162316
if (categoryId && categoryId !== '-1') {
23172317
params.categoryid = categoryId
2318+
} else {
2319+
this.deleteFrom(this.params.serviceOfferings.options, ['categoryid'])
23182320
}
23192321
this.handleSearchFilter('serviceOfferings', params)
23202322
},

ui/src/views/compute/DeployVnfAppliance.vue

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,11 @@
167167
:minimum-cpunumber="templateConfigurationExists && selectedTemplateConfiguration && selectedTemplateConfiguration.cpunumber ? selectedTemplateConfiguration.cpunumber : 0"
168168
:minimum-cpuspeed="templateConfigurationExists && selectedTemplateConfiguration && selectedTemplateConfiguration.cpuspeed ? selectedTemplateConfiguration.cpuspeed : 0"
169169
:minimum-memory="templateConfigurationExists && selectedTemplateConfiguration && selectedTemplateConfiguration.memory ? selectedTemplateConfiguration.memory : 0"
170+
:service-offering-categories="options.serviceOfferingCategories"
171+
:selected-service-offering-category-id="selectedServiceOfferingCategoryId"
170172
@select-compute-item="($event) => updateComputeOffering($event)"
171173
@handle-search-filter="($event) => handleSearchFilter('serviceOfferings', $event)"
174+
@service-offering-category-change="($event) => handleServiceOfferingCategoryChange($event)"
172175
></compute-offering-selection>
173176
<compute-selection
174177
v-if="serviceOffering && (serviceOffering.iscustomized || serviceOffering.iscustomizediops)"
@@ -935,8 +938,10 @@ export default {
935938
rootdisksize: null,
936939
disksize: null
937940
},
941+
selectedServiceOfferingCategoryId: '-1',
938942
options: {
939943
guestOsCategories: [],
944+
serviceOfferingCategories: [],
940945
templates: {},
941946
isos: {},
942947
hypervisors: [],
@@ -960,6 +965,7 @@ export default {
960965
loading: {
961966
deploy: false,
962967
guestOsCategories: false,
968+
serviceOfferingCategories: false,
963969
templates: false,
964970
isos: false,
965971
hypervisors: false,
@@ -2639,6 +2645,8 @@ export default {
26392645
if (this.isModernImageSelection && guestOsFetch) {
26402646
await guestOsFetch
26412647
}
2648+
// Load service offering categories
2649+
this.fetchServiceOfferingCategories()
26422650
this.fetchAllTemplates()
26432651
this.updateTemplateKey()
26442652
this.formModel = toRaw(this.form)
@@ -2700,6 +2708,46 @@ export default {
27002708
this.params[name].options = { ...this.params[name].options, ...options }
27012709
this.fetchOptions(this.params[name], name)
27022710
},
2711+
fetchServiceOfferingCategories () {
2712+
this.loading.serviceOfferingCategories = true
2713+
return new Promise((resolve, reject) => {
2714+
getAPI('listServiceOfferingCategories').then(json => {
2715+
const categories = json.listserviceofferingcategoriesresponse.serviceofferingcategory || []
2716+
this.options.serviceOfferingCategories = [
2717+
{
2718+
id: '-1',
2719+
name: this.$t('label.all')
2720+
},
2721+
...categories
2722+
]
2723+
resolve()
2724+
}).catch(error => {
2725+
console.error('Error fetching service offering categories:', error)
2726+
this.options.serviceOfferingCategories = [
2727+
{
2728+
id: '-1',
2729+
name: this.$t('label.all')
2730+
}
2731+
]
2732+
reject(error)
2733+
}).finally(() => {
2734+
this.loading.serviceOfferingCategories = false
2735+
})
2736+
})
2737+
},
2738+
handleServiceOfferingCategoryChange (categoryId) {
2739+
this.selectedServiceOfferingCategoryId = categoryId
2740+
const params = {
2741+
page: 1,
2742+
pageSize: 10
2743+
}
2744+
if (categoryId && categoryId !== '-1') {
2745+
params.categoryid = categoryId
2746+
} else {
2747+
this.deleteFrom(this.params.serviceOfferings.options, ['categoryid'])
2748+
}
2749+
this.handleSearchFilter('serviceOfferings', params)
2750+
},
27032751
onTabChange (key, type) {
27042752
this[type] = key
27052753
},

0 commit comments

Comments
 (0)