From 423362dc1f90ef2dc80f8e8100dc633b4fd60544 Mon Sep 17 00:00:00 2001 From: Vishesh Date: Tue, 25 Jun 2024 14:00:55 +0530 Subject: [PATCH 1/2] Honour listall param for list templates api --- server/src/main/java/com/cloud/api/query/QueryManagerImpl.java | 2 +- ui/src/views/compute/DeployVM.vue | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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 6475baec4115..566da8fb5cf1 100644 --- a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java @@ -4337,7 +4337,7 @@ private Pair, Integer> searchForTemplatesInternal(ListTempl 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 0bd68e5e2044..f302ca7df656 100644 --- a/ui/src/views/compute/DeployVM.vue +++ b/ui/src/views/compute/DeployVM.vue @@ -2281,6 +2281,7 @@ export default { args.showicon = 'true' args.id = this.templateId args.isvnf = false + args.listall = true return new Promise((resolve, reject) => { api('listTemplates', args).then((response) => { @@ -2303,6 +2304,7 @@ export default { args.bootable = true args.showicon = 'true' args.id = this.isoId + args.listall = true return new Promise((resolve, reject) => { api('listIsos', args).then((response) => { From b9a6ec70861c4c44026ec53604f5e79b9adc6eb6 Mon Sep 17 00:00:00 2001 From: Vishesh Date: Wed, 26 Jun 2024 00:56:52 +0530 Subject: [PATCH 2/2] Don't show templates from another project inside a project view --- ui/src/views/compute/DeployVM.vue | 12 ++++++++++-- .../views/compute/wizard/TemplateIsoRadioGroup.vue | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue index f302ca7df656..01e190440b21 100644 --- a/ui/src/views/compute/DeployVM.vue +++ b/ui/src/views/compute/DeployVM.vue @@ -2276,7 +2276,11 @@ 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 @@ -2300,7 +2304,11 @@ 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 diff --git a/ui/src/views/compute/wizard/TemplateIsoRadioGroup.vue b/ui/src/views/compute/wizard/TemplateIsoRadioGroup.vue index 00fa2ef9a253..1cd1fa5f2910 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" />   {{ item.displaytext }} + + | {{ item.project }} +