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
This commit is contained in:
Suresh Kumar Anaparti 2025-07-31 10:08:35 +05:30 committed by GitHub
parent 712492230a
commit 1f1e38f3a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 32 additions and 4 deletions

View File

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

View File

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

View File

@ -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) => {

View File

@ -424,6 +424,7 @@ export default {
}
if (isAdmin()) {
params.templatefilter = 'all'
params.isready = true
} else {
params.templatefilter = 'executable'
}

View File

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

View File

@ -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 => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -584,6 +584,7 @@ export default {
isLoad: true,
options: {
templatefilter: 'all',
isready: true,
hypervisor: this.cluster.hypervisortype,
showicon: true
},