Copilot commented on code in PR #12144:
URL: https://github.com/apache/cloudstack/pull/12144#discussion_r3950280001
##########
ui/src/components/view/ListView.vue:
##########
@@ -1056,6 +1056,12 @@
<template v-if="column.key === 'vgpuActions'">
<slot name="actionButtons" :record="record" :actions="actions"></slot>
</template>
+ <template v-if="column.key === 'category' && $route.path.split('/')[1]
=== 'computeoffering'">
+ <span v-if="record.categoryid">
+ <router-link :to="{ path: '/serviceofferingcategory/' +
record.categoryid }">{{ text }}</router-link>
+ </span>
+ <span v-else>{{ text }}</span>
+ </template>
Review Comment:
The new category link rendering is guarded by `$route.path.split('/')[1] ===
'computeoffering'`, which is brittle (e.g. nested routes like `/project/...` or
other route variants) and inconsistent with the existing pattern used for OS
category links (`'listOsCategories' in $store.getters.apis`). This can prevent
the category from being linkable even when `record.categoryid` is present.
##########
ui/src/views/compute/DeployVnfAppliance.vue:
##########
@@ -2700,6 +2708,46 @@ export default {
this.params[name].options = { ...this.params[name].options, ...options }
this.fetchOptions(this.params[name], name)
},
+ fetchServiceOfferingCategories () {
+ this.loading.serviceOfferingCategories = true
+ return new Promise((resolve, reject) => {
+ getAPI('listServiceOfferingCategories').then(json => {
Review Comment:
`fetchServiceOfferingCategories()` calls `listServiceOfferingCategories`
unconditionally. In the UI, optional APIs are typically guarded via
`$store.getters.apis` (see the existing `listOsCategories` checks in ListView).
Without a guard, this will log errors / reject for users/roles (or older
servers) where the API isn’t available.
##########
ui/src/views/compute/DeployVM.vue:
##########
@@ -2333,6 +2339,46 @@ export default {
console.error('Error fetching guestOsCategories:', e)
})
},
+ fetchServiceOfferingCategories () {
+ this.loading.serviceOfferingCategories = true
+ return new Promise((resolve, reject) => {
+ getAPI('listServiceOfferingCategories').then(json => {
Review Comment:
`fetchServiceOfferingCategories()` calls `listServiceOfferingCategories`
unconditionally. In the UI, optional APIs are typically guarded via
`$store.getters.apis` (see the existing `listOsCategories` checks in ListView).
Without a guard, this will log errors / reject for users/roles (or older
servers) where the API isn’t available.
##########
api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java:
##########
@@ -124,6 +125,13 @@ public class ListServiceOfferingsCmd extends
BaseListProjectAndAccountResourcesC
since = "4.21.0")
private Boolean gpuEnabled;
+ @Parameter(name = ApiConstants.SERVICE_OFFERING_CATEGORY_ID,
+ type = CommandType.UUID,
+ entityType = ServiceOfferingCategoryResponse.class,
+ description = "the ID of the service offering category",
+ since = "24.0")
+ private Long categoryId;
+
Review Comment:
The new `categoryid` filter parameter is annotated with `since = "24.0"`,
which doesn’t match the CloudStack version format used elsewhere. Please update
to the correct release version (likely `4.23.0`) so the API metadata stays
consistent.
##########
api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCategoryCmd.java:
##########
@@ -0,0 +1,95 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.offering;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ServiceOfferingCategoryResponse;
+
+import com.cloud.offering.ServiceOfferingCategory;
+import com.cloud.user.Account;
+
+@APICommand(name = "updateServiceOfferingCategory",
+ description = "Updates a service offering category",
+ responseObject = ServiceOfferingCategoryResponse.class,
+ since = "24.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
Review Comment:
`since = "24.0"` is inconsistent with the CloudStack API version strings
used throughout the project (e.g. `4.23.0`). Update this to the correct
CloudStack release version for the new command so API docs remain accurate.
##########
api/src/main/java/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCategoryCmd.java:
##########
@@ -0,0 +1,76 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.offering;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ServiceOfferingCategoryResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "deleteServiceOfferingCategory",
+ description = "Deletes a service offering category.",
+ responseObject = SuccessResponse.class,
+ since = "24.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
Review Comment:
`since = "24.0"` is inconsistent with the CloudStack API version strings
used throughout the project (e.g. `4.23.0`). Update this to the correct
CloudStack release version for the new command so API docs remain accurate.
##########
api/src/main/java/org/apache/cloudstack/api/command/admin/offering/ListServiceOfferingCategoriesCmd.java:
##########
@@ -0,0 +1,71 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.offering;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingCategoryResponse;
+
+@APICommand(name = "listServiceOfferingCategories",
+ description = "Lists service offering categories.",
+ responseObject = ServiceOfferingCategoryResponse.class,
+ since = "24.0",
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = false)
Review Comment:
`since = "24.0"` is inconsistent with the CloudStack API version strings
used throughout the project (e.g. `4.23.0`). Update this to the correct
CloudStack release version for the new command so API docs remain accurate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]