Skip to content

Fix import network filtering for account and project scope - #13836

Draft
andrijapanicsb wants to merge 1 commit into
apache:4.22from
andrijapanicsb:agent/fix-import-project-network-scope
Draft

Fix import network filtering for account and project scope#13836
andrijapanicsb wants to merge 1 commit into
apache:4.22from
andrijapanicsb:agent/fix-import-project-network-scope

Conversation

@andrijapanicsb

Copy link
Copy Markdown
Contributor

Summary

Fixes #12685.

The unmanaged instance import wizard now lists networks in the ownership scope selected by the root administrator and cannot retain a network mapping from a previously selected owner.

This is a focused 4.22-based replacement for the project-network fix attempted in #12854. It contains only the two affected UI components and their unit tests, without the unrelated backend, schema, packaging, or formatting changes currently present in that PR.

Problems

The existing import wizard has four related owner-scope problems:

  1. ImportUnmanagedInstance exposes a project selector but does not pass projectid to MultiNetworkSelection. Consequently, listNetworks runs without the selected project and project networks are not listed, as reported for 4.22.0 in UI: Import VM wizard doesn't list the project networks #12685.
  2. The network selector watches account changes only. It does not refetch for domain or project changes, and it deliberately skips the request when the account is cleared. This can leave networks from the previous owner visible.
  3. Existing NIC-to-network mappings are retained while the ownership scope changes. A network selected for the root-admin account can therefore remain in the form after switching to another account or project.
  4. Network requests are not sequenced. If an earlier request completes after a later owner-scope request, its response can overwrite the current network list.

Changes

  • Pass the selected projectid into MultiNetworkSelection.
  • Build mutually exclusive listNetworks owner parameters:
    • projectid for project imports;
    • domainid and account for account imports;
    • neither for the default root-admin scope.
  • Clear conflicting account/domain/project form fields when the administrator changes target ownership.
  • Clear NIC network mappings immediately whenever the owner scope changes.
  • Refetch when zone, domain, account, or project changes, including when a value is cleared.
  • Retain the existing debounce for account text input.
  • Ignore responses belonging to an older owner scope.
  • Clear pending timers and invalidate requests when the component is unmounted.

User impact

When a root administrator imports an unmanaged instance:

  • the default scope lists the administrator-visible networks;
  • selecting an account and domain lists networks for that account scope;
  • selecting a project lists networks for that project without mixing account/domain parameters;
  • switching scopes clears any previously selected network before loading the new allowed list;
  • a delayed response from the previous scope cannot restore stale networks.

The API remains the authorization boundary; this change makes the UI use the selected target scope consistently and prevents submission of stale UI mappings.

Validation

  • MultiNetworkSelection.spec.js: five tests covering account/domain parameters, project precedence, domain refresh, clearing an account and stale mapping, and out-of-order responses.
  • ImportUnmanagedInstance.spec.js: two tests covering mutually exclusive account/domain/project transitions and NIC mapping reset.
  • Targeted unit tests: 7 passed.
  • Targeted ESLint: passed.
  • git diff --check: passed.

The project-network failure is reported against a live 4.22.0 environment in #12685. The additional stale-state and request-order cases are verified deterministically by the new unit tests; this PR does not claim a separate live 4.22 deployment test.

Signed-off-by: andrijapanicsb <andrija.panic@gmail.com>
@andrijapanicsb

Copy link
Copy Markdown
Contributor Author

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

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

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 17.70%. Comparing base (5328528) to head (35813af).

Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #13836      +/-   ##
============================================
+ Coverage     17.69%   17.70%   +0.01%     
+ Complexity    15835    15831       -4     
============================================
  Files          5925     5925              
  Lines        533539   533581      +42     
  Branches      65274    65282       +8     
============================================
+ Hits          94427    94495      +68     
+ Misses       428435   428396      -39     
- Partials      10677    10690      +13     
Flag Coverage Δ
uitests 3.92% <ø> (+0.23%) ⬆️
unittests 18.77% <ø> (-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.

@blueorangutan

Copy link
Copy Markdown

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

@andrijapanicsb

Copy link
Copy Markdown
Contributor Author

Simulator is 4.21, no support for KVM migration screens/operations

@andrijapanicsb

Copy link
Copy Markdown
Contributor Author

@ACSHomeBot package

@ACSHomeBot

ACSHomeBot commented Aug 10, 2026

Copy link
Copy Markdown

Packaging results (commit 35813af)

Result Artifact Platform
FAIL RPM EL (EL8/9/10)
FAIL DEB Ubuntu, Debian

Package artifacts were retained locally, but no public repository was promoted.

Error: Package workflow returned 1; detailed output remains in the local job log.

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.

3 participants