This is an automated email from the ASF dual-hosted git repository.

sureshanaparti pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.19 by this push:
     new 4f85c3fd231 Honour listall param for list templates api (#9300)
4f85c3fd231 is described below

commit 4f85c3fd2317b751a6b7ca2e3e2c2a707b0394a8
Author: Vishesh <[email protected]>
AuthorDate: Wed Jun 26 12:09:56 2024 +0530

    Honour listall param for list templates api (#9300)
    
    * Honour listall param for list templates api
    
    * Don't show templates from another project inside a project view
---
 .../main/java/com/cloud/api/query/QueryManagerImpl.java    |  2 +-
 ui/src/views/compute/DeployVM.vue                          | 14 ++++++++++++--
 ui/src/views/compute/wizard/TemplateIsoRadioGroup.vue      |  3 +++
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java 
b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
index 74c9b53a50b..58ad44df164 100644
--- a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
@@ -4348,7 +4348,7 @@ public class QueryManagerImpl extends 
MutualExclusiveIdsManagerBase implements Q
         Account caller = CallContext.current().getCallingAccount();
         Long parentTemplateId = cmd.getParentTemplateId();
 
-        boolean listAll = false;
+        boolean listAll = cmd.listAll();
         if (templateFilter != null && templateFilter == TemplateFilter.all) {
             if (caller.getType() == Account.Type.NORMAL) {
                 throw new InvalidParameterValueException("Filter " + 
TemplateFilter.all + " can be specified by admin only");
diff --git a/ui/src/views/compute/DeployVM.vue 
b/ui/src/views/compute/DeployVM.vue
index 0bd68e5e204..01e190440b2 100644
--- a/ui/src/views/compute/DeployVM.vue
+++ b/ui/src/views/compute/DeployVM.vue
@@ -2276,11 +2276,16 @@ export default {
       }
       args.zoneid = _.get(this.zone, 'id')
       args.templatefilter = templateFilter
-      args.projectid = -1
+      if (this.$store.getters.project?.id) {
+        args.projectid = this.$store.getters.project.id
+      } else {
+        args.projectid = -1
+      }
       args.details = 'all'
       args.showicon = 'true'
       args.id = this.templateId
       args.isvnf = false
+      args.listall = true
 
       return new Promise((resolve, reject) => {
         api('listTemplates', args).then((response) => {
@@ -2299,10 +2304,15 @@ export default {
       }
       args.zoneid = _.get(this.zone, 'id')
       args.isoFilter = isoFilter
-      args.projectid = -1
+      if (this.$store.getters.project?.id) {
+        args.projectid = this.$store.getters.project.id
+      } else {
+        args.projectid = -1
+      }
       args.bootable = true
       args.showicon = 'true'
       args.id = this.isoId
+      args.listall = true
 
       return new Promise((resolve, reject) => {
         api('listIsos', args).then((response) => {
diff --git a/ui/src/views/compute/wizard/TemplateIsoRadioGroup.vue 
b/ui/src/views/compute/wizard/TemplateIsoRadioGroup.vue
index 00fa2ef9a25..1cd1fa5f291 100644
--- a/ui/src/views/compute/wizard/TemplateIsoRadioGroup.vue
+++ b/ui/src/views/compute/wizard/TemplateIsoRadioGroup.vue
@@ -46,6 +46,9 @@
                 :os-name="item.osName" />
               &nbsp;
               {{ item.displaytext }}
+              <span v-if="item?.projectid">
+                | <project-outlined /> {{ item.project }}
+            </span>
             </a-radio>
           </a-radio-group>
         </a-list-item>

Reply via email to