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