Copilot commented on code in PR #14062:
URL: https://github.com/apache/cloudstack/pull/14062#discussion_r3968105797


##########
ui/src/views/offering/CloneNetworkOffering.vue:
##########
@@ -1294,6 +1289,10 @@ export default {
           params.guestiptype = values.guestiptype
         }
 
+        if (values.forvpc === true) {

Review Comment:
   This only sets `params.forvpc` when the form value is the boolean `true`. If 
the field is ever serialized as a string (commonly `"true"` from 
selects/radios) or a truthy value, the API payload will silently omit `forvpc` 
and may create the wrong offering type. Consider normalizing/coercing the value 
(e.g., accept `true` and `"true"`), or set `params.forvpc = Boolean(...)` if 
the API expects a boolean.



##########
ui/src/views/offering/CloneVpcOffering.vue:
##########
@@ -656,6 +660,45 @@ export default {
         this.form.nsxsupportlb = Boolean(this.serviceProviderMap.Lb)
       }
     },
+    syncServiceSelectionsForCurrentMode () {
+      const updatedServices = this.supportedServices.map(svc => {
+        const serviceCopy = { ...svc, provider: [...svc.provider] }
+        const providerName = this.selectedServiceProviderMap[serviceCopy.name]
+
+        if (providerName) {
+          const providerIndex = serviceCopy.provider.findIndex(p => p.name === 
providerName)
+          if (providerIndex > 0) {
+            const targetProvider = serviceCopy.provider[providerIndex]
+            serviceCopy.provider.splice(providerIndex, 1)
+            serviceCopy.provider.unshift(targetProvider)
+          }
+          serviceCopy.defaultChecked = true
+          serviceCopy.selectedProvider = providerName
+        } else {
+          serviceCopy.defaultChecked = false
+          serviceCopy.selectedProvider = null
+        }

Review Comment:
   `providerName` is treated as valid even when it no longer exists in 
`serviceCopy.provider` (i.e., `findIndex` returns `-1`). In that case the UI 
can end up marking the service as checked with a selected provider that isn’t 
actually available, and it can also leak an invalid provider into the eventual 
API payload. Handle `providerIndex === -1` explicitly (e.g., clear the 
selection for that service, or fall back to the first available provider) 
before setting `defaultChecked/selectedProvider`.



-- 
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]

Reply via email to