Skip to content

ui: handle empty network offerings without Request failed (#14377) - #14399

Open
nabassa1323 wants to merge 1 commit into
apache:4.22from
nabassa1323:fix-14377-add-network-empty-offerings
Open

nabassa1323 wants to merge 1 commit into
apache:4.22from
nabassa1323:fix-14377-add-network-empty-offerings

Conversation

@nabassa1323

Copy link
Copy Markdown

Description

Fixes the Add Network UI showing "Request failed" when Isolated/Shared
have no enabled network offerings (empty/null listNetworkOfferings response).

Shows a clear warning instead. Does not hide guest-type tabs (separate
enhancement from #14377).

Fixes: #14377 (UI error handling part only)

Types of changes

  • Bug fix
  • New feature

How to test

  1. Disable all Isolated and Shared network offerings; keep L2 enabled
  2. Open Guest Networks → Add Network
  3. Isolated / Shared: no "Request failed"; empty list + warning
  4. L2: offerings still listed and usable

@boring-cyborg

boring-cyborg Bot commented Oct 14, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

this.networkOfferings = json.listnetworkofferingsresponse.networkoffering || []
this.networkOfferings = this.networkOfferings.filter(offering => offering.fornsx === this.selectedZone.isnsxenabled)
if (!this.selectedZone.routedmodeenabled) {
const offerings = json?.listnetworkofferingsresponse?.networkoffering || []

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.

looks like #13503 already fixed the crash on the isolated tab for 4.22 and main. does it still show request failed on main without this change?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks @Damans227 for the review — I was not aware of #13503 when I opened #14377 and this PR.
Our report is on CloudStack 4.22.1.0. #13503 is targeted at the 4.22.2 milestone, so it was not something we had on our installed 4.22.1.0 packages when we hit the bug.

Isolated repro on 4.22.1.0

  1. Add Network → Isolated (all Isolated network offerings disabled)
  2. Toast: Request failed. (no HTTP status)
  3. Network tab: listNetworkOfferings → HTTP 200
  4. Response:
    { "listnetworkofferingsresponse": {} }
  5. Console:
    TypeError: can't access property "filter", t.networkOfferings is undefined
    at fetchNetworkOfferingData (CreateIsolatedNetworkForm.vue:555)

Root cause
Same as #13485 / #13503: empty listnetworkofferingsresponse -> networkOfferings stays undefined -> TypeError on .filter -> UI shows "Request failed."

The difference is only the trigger: in our case it is disabling Isolated offerings, not physical-network tags.

Beyond the same || [] guard as #13503, this PR also:

  • shows a clear warning on Isolated when no offerings are available (instead of only failing silently / with a toast)
  • hardens L2 the same way (|| [] / safe parse) — UI: Prevent failure when loading network offerings when physical network has a tag #13503 only touched Isolated
  • adds a catch on listVPCs so a VPC lookup failure does not break the offerings path
  • documents that the empty-response crash is also triggered by disabled offerings, not only physical-network tags

I’m happy to slim this PR to the L2 / warning / listVPCs parts, or close whatever is redundant

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.

thanks, that explains it. can we slim this to the isolated warning and the l2 change? the empty list crash itself is already fixed on 4.22 and main

this.networkOfferings = []
getAPI('listNetworkOfferings', params).then(json => {
this.networkOfferings = json.listnetworkofferingsresponse.networkoffering || []
const offerings = json?.listnetworkofferingsresponse?.networkoffering || []

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.

the shared tab already handles an empty list here in 4.22.1.0. which request fails on that tab in the browser network tab?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

None. On Shared, listNetworkOfferings also returns HTTP 200 with an empty
listnetworkofferingsresponse. No request fails in the Network tab; the
"Request failed" toast comes from the client-side TypeError path, same as Isolated

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.

in 4.22.1.0 that line already falls back to an empty list and shows the shared warning. can you share the console error from the shared tab? it might be the isolated tab erroring when the dialog opens

@Damans227

Copy link
Copy Markdown
Collaborator

can we point this at the 4.22 branch? its a fix for 4.22.1.0 so it should go into 4.22.2 and merge forward to main

@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 20.21%. Comparing base (a945a7c) to head (39d4570).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14399      +/-   ##
============================================
- Coverage     20.21%   20.21%   -0.01%     
  Complexity    20749    20749              
============================================
  Files          6426     6426              
  Lines        580181   580195      +14     
  Branches      71033    71039       +6     
============================================
- Hits         117292   117288       -4     
- Misses       450174   450195      +21     
+ Partials      12715    12712       -3     
Flag Coverage Δ
uitests 3.68% <ø> (-0.01%) ⬇️
unittests 21.51% <ø> (-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.

@nabassa1323
nabassa1323 force-pushed the fix-14377-add-network-empty-offerings branch from 39d4570 to 8f64372 Compare October 20, 2026 13:03
@boring-cyborg boring-cyborg Bot added distro:ubuntu Python Warning... Python code Ahead! labels Oct 20, 2026
@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@Damans227

Copy link
Copy Markdown
Collaborator

@nabassa1323 thanks for slimming it down. the branch is on 4.22 now but the PR still targets main, so it picks up the java 21 packaging commit and shows conflicts. can you switch the base to 4.22 with the edit button next to the title?

@nabassa1323
nabassa1323 changed the base branch from main to 4.22 October 20, 2026 13:20
@nabassa1323

Copy link
Copy Markdown
Author

@Damans227 Done. PR base switched to 4.22.

@Damans227 Damans227 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.

thanks @nabassa1323, the isolated warning and l2 fix look right. LGTM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:UI distro:ubuntu Python Warning... Python code Ahead!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Network: no way to disable Isolated/Shared + "Request failed" on those tabs

2 participants