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

   ### Description
   
   After the changes in #4774, when an account other than the root admin lists 
templates/ISOs with pagination, count gets set to the number of items returned 
in that page. For example, when the user lists 10 templates/ISOs and 15 entries 
are found, in the first page, count is set to 10 (the number of items being 
returned), as opposed to 15 (the total number of items). As a result, the 
deploy VM wizard only shows the first page of templates/ISOs.
   
   This PR fixes this behavior and makes count return the correct number of 
found entries.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [X] 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)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [X] Minor
   - [ ] Trivial
   
   
   ### Screenshots (if appropriate):
   
   
   ### How Has This Been Tested?
   
   Everything has been tested in a local lab.
   
   In the tested scenario, the following domains have templates:
   - `ROOT`: 13 public and featured templates;
   - `ROOT/test`: 4 public and featured templates.
   
   <details>
   
   <summary>
   CloudMonkey command used to list templates.
   </summary>
   
   ```
   list templates templatefilter=featured page=1 pageSize=5
   ```
   
   </details>
   
   In every test, the expected number of templates/ISOs was returned.
   
   With `share.public.templates.with.other.domains` set to `true` in both 
domains:
   - In the root admin account, I listed the templates. I verified that the 
expected value of 17 was returned;
   - In a user account belonging to `ROOT`, I listed the templates. I verified 
that the expected value of 17 was returned;
   - In a user account belonging to `ROOT/test`, I listed the templates. I 
verified that the expected value of 17 was returned;
   - I marked a template belonging to `ROOT` as not public. Then, in a user 
account belonging to `ROOT`, I listed the templates. I verified that the 
expected value of 16 was returned;
   - I marked a template belonging to `ROOT` as not public. Then, in a user 
account belonging to `ROOT/test`, I listed the templates. I verified that the 
expected value of 16 was returned;
   - I marked a template belonging to `ROOT/test` as not public. Then, in a 
user account belonging to `ROOT`, I listed the templates. I verified that the 
expected value of 16 was returned;
   - I marked a template belonging to `ROOT/test` as not public. Then, in a 
user account belonging to `ROOT/test`, I listed the template. I verified that 
the expected value of 16 was returned.
   
   With `share.public.templates.with.other.domains` set to `false` in both 
domains:
   - In the root admin account, I listed the templates. I verified that the 
expected value of 17 was returned;
   - In a user account belonging to `ROOT`, I listed the templates. I verified 
that the expected value of 13 was returned;
   - In a user account belonging to `ROOT/test`, I listed the templates. I 
verified that the expected value of 4 was returned;
   - I marked a template belonging to `ROOT` as not public. Then, in a user 
account belonging to `ROOT`, I listed the templates. I verified that the 
expected value of 12 was returned;
   - I marked a template belonging to `ROOT` as not public. Then, in a user 
account belonging to `ROOT/test`, I listed the templates. I verified that the 
expected value of 4 was returned;
   - I marked a template belonging to `ROOT/test` as not public. Then, in a 
user account belonging to `ROOT`, I listed the templates. I verified that the 
expected value of 13 was returned;
   - I marked a template belonging to `ROOT/test` as not public. Then, in a 
user account belonging to `ROOT/test`, I listed the template. I verified that 
the expected value of 3 was returned.
   
   I also verified the behavior of the listIsos API. In the tested scenario, 
the following domains have ISOs:
   - `ROOT`: 11 public and featured ISOs;
   - `ROOT/test`: 2 public and featured ISOs.
   
   <details>
   
   <summary>
   CloudMonkey command used to list ISOs.
   </summary>
   
   ```
   list isos page=1 pageSize=5 isoFilter=featured bootable=true
   ```
   
   </details>
   
   With `share.public.templates.with.other.domains` set to `true` in both 
domains:
   - In the root admin account, I listed the ISOs. I verified that the expected 
value of 13 was returned;
   - In a user account belonging to `ROOT`, I listed the ISOs. I verified that 
the expected value of 13 was returned;
   - In a user account belonging to `ROOT/test`, I listed the ISOs. I verified 
that the expected value of 13 was returned;
   - I marked an ISO belonging to `ROOT` as not public. Then, in a user account 
belonging to `ROOT`, I listed the ISOs. I verified that the expected value of 
12 was returned;
   - I marked an ISO belonging to `ROOT` as not public. Then, in a user account 
belonging to `ROOT/test`, I listed the ISOs. I verified that the expected value 
of 12 was returned;
   - I marked an ISO belonging to `ROOT/test` as not public. Then, in a user 
account belonging to `ROOT`, I listed the ISOs. I verified that the expected 
value of 12 was returned;
   - I marked an ISO belonging to `ROOT/test` as not public. Then, in a user 
account belonging to `ROOT/test`, I listed the ISOs. I verified that the 
expected value of 12 was returned.
   
   With `share.public.templates.with.other.domains` set to `false` in both 
domains:
   - In the root admin account, I listed the ISOs. I verified that the expected 
value of 13 was returned;
   - In a user account belonging to `ROOT`, I listed the ISOs. I verified that 
the expected value of 11 was returned;
   - In a user account belonging to `ROOT/test`, I listed the ISOs. I verified 
that the expected value of 2 was returned;
   - I marked an ISO belonging to `ROOT` as not public. Then, in a user account 
belonging to `ROOT`, I listed the ISOs. I verified that the expected value of 
10 was returned;
   - I marked an ISO belonging to `ROOT` as not public. Then, in a user account 
belonging to `ROOT/test`, I listed the ISOs. I verified that the expected value 
of 2 was returned;
   - I marked an ISO belonging to `ROOT/test` as not public. Then, in a user 
account belonging to `ROOT`, I listed the ISOs. I verified that the expected 
value of 11 was returned;
   - I marked an ISO belonging to `ROOT/test` as not public. Then, in a user 
account belonging to `ROOT/test`, I listed the ISOs. I verified that the 
expected value of 1 was returned.
   
   I also verified the changes in the UI. Before, the deploy VM wizard showed 
only one page of templates/ISOs. After the changes, all pages are shown as 
expected.


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