This is an automated email from the ASF dual-hosted git repository. sureshanaparti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push: new 1f1e38f3a85 Support to list templates in ready state (new API parameter 'isready', similar to list ISOs) (#11343) 1f1e38f3a85 is described below commit 1f1e38f3a85f6bfe3e941c88671e36878a971fda Author: Suresh Kumar Anaparti <sureshkumar.anapa...@gmail.com> AuthorDate: Thu Jul 31 10:08:35 2025 +0530 Support to list templates in ready state (new API parameter 'isready', similar to list ISOs) (#11343) * Support to list templates in ready state (new API parameter 'isready', similar to list ISOs), and UI to display Templates/ISOs in ready state wherever applicable --- .../cloudstack/api/command/user/iso/ListIsosCmd.java | 2 +- .../api/command/user/template/ListTemplatesCmd.java | 14 ++++++++++++++ ui/src/views/compute/AttachIso.vue | 4 ++-- ui/src/views/compute/AutoScaleVmProfile.vue | 1 + ui/src/views/compute/CreateAutoScaleVmGroup.vue | 2 ++ ui/src/views/compute/CreateKubernetesCluster.vue | 3 ++- ui/src/views/compute/DeployVM.vue | 4 ++++ ui/src/views/compute/DeployVnfAppliance.vue | 1 + ui/src/views/compute/EditVM.vue | 1 + ui/src/views/compute/ReinstallVm.vue | 1 + ui/src/views/compute/ResetUserData.vue | 1 + ui/src/views/compute/ScaleVM.vue | 1 + ui/src/views/tools/ImportUnmanagedInstance.vue | 1 + 13 files changed, 32 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java index 760a531e899..346eca8cff0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java @@ -57,7 +57,7 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd implements UserCmd { @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true if the ISO is publicly available to all users, false otherwise.") private Boolean publicIso; - @Parameter(name = ApiConstants.IS_READY, type = CommandType.BOOLEAN, description = "true if this ISO is ready to be deployed") + @Parameter(name = ApiConstants.IS_READY, type = CommandType.BOOLEAN, description = "list ISOs that are ready to be deployed") private Boolean ready; @Parameter(name = ApiConstants.ISO_FILTER, diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java index 4727e395c41..223ac57b11f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java @@ -126,6 +126,9 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User since = "4.21.0") private Long extensionId; + @Parameter(name = ApiConstants.IS_READY, type = CommandType.BOOLEAN, description = "list templates that are ready to be deployed", since = "4.21.0") + private Boolean ready; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -195,6 +198,13 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User boolean onlyReady = (templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable) || (templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community); + + if (!onlyReady) { + if (isReady() != null && isReady().booleanValue() != onlyReady) { + onlyReady = isReady().booleanValue(); + } + } + return onlyReady; } @@ -230,6 +240,10 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User return extensionId; } + public Boolean isReady() { + return ready; + } + @Override public String getCommandName() { return s_name; diff --git a/ui/src/views/compute/AttachIso.vue b/ui/src/views/compute/AttachIso.vue index 9a1bcb50a42..aafed017a21 100644 --- a/ui/src/views/compute/AttachIso.vue +++ b/ui/src/views/compute/AttachIso.vue @@ -106,8 +106,8 @@ export default { const params = { listall: true, zoneid: this.resource.zoneid, - isready: true, - isofilter: isoFilter + isofilter: isoFilter, + isready: true } return new Promise((resolve, reject) => { getAPI('listIsos', params).then((response) => { diff --git a/ui/src/views/compute/AutoScaleVmProfile.vue b/ui/src/views/compute/AutoScaleVmProfile.vue index 92ff9c8777b..9d944c59898 100644 --- a/ui/src/views/compute/AutoScaleVmProfile.vue +++ b/ui/src/views/compute/AutoScaleVmProfile.vue @@ -424,6 +424,7 @@ export default { } if (isAdmin()) { params.templatefilter = 'all' + params.isready = true } else { params.templatefilter = 'executable' } diff --git a/ui/src/views/compute/CreateAutoScaleVmGroup.vue b/ui/src/views/compute/CreateAutoScaleVmGroup.vue index 292d3fc6a7f..3c509462958 100644 --- a/ui/src/views/compute/CreateAutoScaleVmGroup.vue +++ b/ui/src/views/compute/CreateAutoScaleVmGroup.vue @@ -1881,6 +1881,7 @@ export default { apiName = 'listTemplates' params.listall = true params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all' + params.isready = true params.id = this.queryTemplateId this.dataPreFill.templateid = this.queryTemplateId } else if (this.queryNetworkId) { @@ -2989,6 +2990,7 @@ export default { args.arch = this.selectedArchitecture } args.templatefilter = templateFilter + args.isready = true args.details = 'all' args.showicon = 'true' args.id = this.queryTemplateId diff --git a/ui/src/views/compute/CreateKubernetesCluster.vue b/ui/src/views/compute/CreateKubernetesCluster.vue index 7a2bcec49b9..f945da73213 100644 --- a/ui/src/views/compute/CreateKubernetesCluster.vue +++ b/ui/src/views/compute/CreateKubernetesCluster.vue @@ -671,7 +671,8 @@ export default { for (const filtername of filters) { const params = { templatefilter: filtername, - forcks: true + forcks: true, + isready: true } this.templateLoading = true getAPI('listTemplates', params).then(json => { diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue index cd248f123f1..e4b15e5bbe2 100644 --- a/ui/src/views/compute/DeployVM.vue +++ b/ui/src/views/compute/DeployVM.vue @@ -1796,12 +1796,14 @@ export default { apiName = 'listTemplates' params.listall = true params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all' + params.isready = true params.id = this.queryTemplateId this.dataPreFill.templateid = this.queryTemplateId } else if (this.queryIsoId) { apiName = 'listIsos' params.listall = true params.isofilter = this.isNormalAndDomainUser ? 'executable' : 'all' + params.isready = true params.id = this.queryIsoId this.dataPreFill.isoid = this.queryIsoId } else if (this.queryNetworkId) { @@ -2617,6 +2619,7 @@ export default { args.domainid = store.getters.project?.id ? null : this.owner.domainid args.projectid = store.getters.project?.id || this.owner.projectid args.templatefilter = templateFilter + args.isready = true args.details = 'all' args.showicon = 'true' args.id = this.queryTemplateId @@ -2652,6 +2655,7 @@ export default { args.domainid = store.getters.project?.id ? null : this.owner.domainid args.projectid = store.getters.project?.id || this.owner.projectid args.isoFilter = isoFilter + args.isready = true args.bootable = true args.showicon = 'true' args.id = this.queryIsoId diff --git a/ui/src/views/compute/DeployVnfAppliance.vue b/ui/src/views/compute/DeployVnfAppliance.vue index cf8677a2c61..6a467c34cb6 100644 --- a/ui/src/views/compute/DeployVnfAppliance.vue +++ b/ui/src/views/compute/DeployVnfAppliance.vue @@ -2555,6 +2555,7 @@ export default { args.arch = this.selectedArchitecture } args.templatefilter = templateFilter + args.isready = true args.details = 'all' args.showicon = 'true' args.id = this.queryTemplateId diff --git a/ui/src/views/compute/EditVM.vue b/ui/src/views/compute/EditVM.vue index e35ca6dd49d..7489674b966 100644 --- a/ui/src/views/compute/EditVM.vue +++ b/ui/src/views/compute/EditVM.vue @@ -283,6 +283,7 @@ export default { params.id = this.resource.templateid params.isrecursive = true params.templatefilter = 'all' + params.isready = true var apiName = 'listTemplates' getAPI(apiName, params).then(json => { const templateResponses = json.listtemplatesresponse.template diff --git a/ui/src/views/compute/ReinstallVm.vue b/ui/src/views/compute/ReinstallVm.vue index 982c4543a37..4c7ad2191c0 100644 --- a/ui/src/views/compute/ReinstallVm.vue +++ b/ui/src/views/compute/ReinstallVm.vue @@ -367,6 +367,7 @@ export default { } args.zoneid = this.resource.zoneid args.templatefilter = templateFilter + args.isready = true if (this.resource.arch) { args.arch = this.resource.arch } diff --git a/ui/src/views/compute/ResetUserData.vue b/ui/src/views/compute/ResetUserData.vue index c05c9452b2d..2870af7dd1a 100644 --- a/ui/src/views/compute/ResetUserData.vue +++ b/ui/src/views/compute/ResetUserData.vue @@ -245,6 +245,7 @@ export default { params.id = this.resource.templateid params.isrecursive = true params.templatefilter = 'all' + params.isready = true var apiName = 'listTemplates' getAPI(apiName, params).then(json => { const templateResponses = json.listtemplatesresponse.template diff --git a/ui/src/views/compute/ScaleVM.vue b/ui/src/views/compute/ScaleVM.vue index 1a80f595f63..a040a81d32b 100644 --- a/ui/src/views/compute/ScaleVM.vue +++ b/ui/src/views/compute/ScaleVM.vue @@ -189,6 +189,7 @@ export default { return new Promise((resolve, reject) => { getAPI('listTemplates', { templatefilter: 'all', + isready: true, id: this.resource.templateid }).then(response => { var template = response?.listtemplatesresponse?.template?.[0] || null diff --git a/ui/src/views/tools/ImportUnmanagedInstance.vue b/ui/src/views/tools/ImportUnmanagedInstance.vue index aabd1df7572..4c1a3d53fbc 100644 --- a/ui/src/views/tools/ImportUnmanagedInstance.vue +++ b/ui/src/views/tools/ImportUnmanagedInstance.vue @@ -584,6 +584,7 @@ export default { isLoad: true, options: { templatefilter: 'all', + isready: true, hypervisor: this.cluster.hypervisortype, showicon: true },