andrijapanicsb opened a new pull request, #13836:
URL: https://github.com/apache/cloudstack/pull/13836

   ## 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 #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.
   


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