Skip to content

ui: fix SourceNat error when adding a network offering - #14576

Merged
RosiKyu merged 1 commit into
apache:mainfrom
shapeblue:fixNetworkOfferingSourceNat
Nov 4, 2026
Merged

RosiKyu merged 1 commit into
apache:mainfrom
shapeblue:fixNetworkOfferingSourceNat

Conversation

@sudo87

@sudo87 sudo87 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes undefined error coming while Adding Network offering with only SourceNat. buildServiceCapabilityParams is a standalone function, so this is undefined and this.selectedServiceProviderMap threw a TypeError whenever SourceNat was selected, leaving the Add Network Offering form stuck on OK.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

buildServiceCapabilityParams is a standalone function, so `this` is
undefined and `this.selectedServiceProviderMap` threw a TypeError
whenever SourceNat was selected, leaving the Add Network Offering form
stuck on OK. Use the selectedServiceProviderMap parameter instead.
Copilot AI balanced review requested due to automatic review settings November 4, 2026 05:23
@sudo87
sudo87 requested a review from nvazquez November 4, 2026 05:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change to read the SourceNat provider from the helper’s argument.

No open issues 🎉

What changed in this PR

Fixes the Add Network Offering form failing when SourceNat is selected by removing an invalid this reference in a standalone helper.

Changes:

  • Uses the selectedServiceProviderMap argument to identify the Netris SourceNat provider, avoiding the TypeError that blocked form submission.
File Description
ui/​src/​composables/​useServiceCapabilityParams.js Reads the SourceNat provider from the function argument instead of this.

Review effort: Balanced

@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 20.77%. Comparing base (3370d9f) to head (601bcf4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #14576   +/-   ##
=========================================
  Coverage     20.77%   20.77%           
- Complexity    21913    21915    +2     
=========================================
  Files          6496     6496           
  Lines        591629   591629           
  Branches      72590    72590           
=========================================
+ Hits         122912   122916    +4     
+ Misses       455378   455374    -4     
  Partials      13339    13339           
Flag Coverage Δ
uitests 3.88% <ø> (ø)
unittests 22.08% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sudo87

sudo87 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

@sudo87 a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/14576 (QA-JID-1010)

@nvazquez nvazquez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM

@nvazquez nvazquez added this to the 24.0 milestone Nov 4, 2026
@RosiKyu RosiKyu self-assigned this Nov 4, 2026

@RosiKyu RosiKyu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Tested on the PR UI build (backend 4.21.0.0) via Add Network Offering: an isolated offering with only SourceNat (VirtualRouter) is now created with no console error, a full isolated offering (Dhcp, Dns, Firewall, SourceNat, StaticNat, PortForwarding, redundant router) is created with all services listed, a shared offering without SourceNat still works, and Per Zone source NAT on VirtualRouter now reaches the server and is rejected with a clear validation error instead of the form hanging.

Image Image Image Image Image Image Image Image Image

@RosiKyu
RosiKyu merged commit f00e0c7 into apache:main Nov 4, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants