improvement(offering): make network mode mandatory when creating vpc …#13622
improvement(offering): make network mode mandatory when creating vpc …#13622Chinmay048 wants to merge 1 commit into
Conversation
…and network offerings (apache#13607)
There was a problem hiding this comment.
Pull request overview
This PR aims to eliminate ambiguous VPC/Network Offering configurations by making networkmode (ROUTED vs NATTED) mandatory at both the UI form-validation layer and the Java API parameter layer.
Changes:
- Added Ant Design Vue form rules to require
networkmodeselection in the VPC Offering and Network Offering creation UIs. - Marked
networkmodeasrequired = truein the Java API command parameter annotations for VPC and Network offering creation flows.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| ui/src/views/offering/AddVpcOffering.vue | Adds a required validation rule for networkmode in the VPC offering creation form. |
| ui/src/views/offering/AddNetworkOffering.vue | Adds a required validation rule for networkmode in the network offering creation form. |
| api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java | Sets networkmode as required in the API command parameter definition for VPC offering creation (currently impacts clone as well via inheritance). |
| api/src/main/java/org/apache/cloudstack/api/command/admin/network/NetworkOfferingBaseCmd.java | Sets networkmode as required in the shared base command for network offering create/clone (currently impacts clone as well via inheritance). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // ADD THIS LINE: | ||
| networkmode: [{ required: true, message: this.$t('message.error.select') }], |
| // ADD THIS LINE: | ||
| networkmode: [{ required: true, message: this.$t('message.error.select') }], |
| @Parameter(name = ApiConstants.NETWORK_MODE, type = CommandType.STRING, required = true, description = "the network mode for the VPC offering") | ||
| private String networkMode; |
| @Parameter(name = ApiConstants.NETWORK_MODE, type = CommandType.STRING, required = true, description = "the network mode for the network offering") | ||
| private String networkMode; |
DaanHoogland
left a comment
There was a problem hiding this comment.
why remove the possible values from the descriptions of the networkMode parameters?
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13622 +/- ##
============================================
+ Coverage 19.50% 19.64% +0.14%
- Complexity 19444 19789 +345
============================================
Files 6303 6368 +65
Lines 569286 575107 +5821
Branches 69791 70370 +579
============================================
+ Hits 111040 112996 +1956
- Misses 446093 449826 +3733
- Partials 12153 12285 +132
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
This PR resolves an issue where the
networkmodeparameter (ROUTED vs NATTED) was treated as optional during the creation of VPC and Network Offerings, leading to ambiguous network configurations.Full-Stack Boundary Enforcement:
required: true) inAddVpcOffering.vueandAddNetworkOffering.vueto give administrators immediate visual feedback and prevent form submission if a network mode is not selected.required = trueto the@Parameterannotation inCreateVPCOfferingCmd.javaandNetworkOfferingBaseCmd.java(which governs creation and cloning operations without impacting updates).Types of changes
Checklist: