mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
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:
parent
712492230a
commit
1f1e38f3a8
@ -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.")
|
@Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true if the ISO is publicly available to all users, false otherwise.")
|
||||||
private Boolean publicIso;
|
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;
|
private Boolean ready;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.ISO_FILTER,
|
@Parameter(name = ApiConstants.ISO_FILTER,
|
||||||
|
|||||||
@ -126,6 +126,9 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User
|
|||||||
since = "4.21.0")
|
since = "4.21.0")
|
||||||
private Long extensionId;
|
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 ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -195,6 +198,13 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User
|
|||||||
boolean onlyReady =
|
boolean onlyReady =
|
||||||
(templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable) ||
|
(templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable) ||
|
||||||
(templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community);
|
(templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community);
|
||||||
|
|
||||||
|
if (!onlyReady) {
|
||||||
|
if (isReady() != null && isReady().booleanValue() != onlyReady) {
|
||||||
|
onlyReady = isReady().booleanValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return onlyReady;
|
return onlyReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +240,10 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User
|
|||||||
return extensionId;
|
return extensionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isReady() {
|
||||||
|
return ready;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName() {
|
public String getCommandName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
|
|||||||
@ -106,8 +106,8 @@ export default {
|
|||||||
const params = {
|
const params = {
|
||||||
listall: true,
|
listall: true,
|
||||||
zoneid: this.resource.zoneid,
|
zoneid: this.resource.zoneid,
|
||||||
isready: true,
|
isofilter: isoFilter,
|
||||||
isofilter: isoFilter
|
isready: true
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getAPI('listIsos', params).then((response) => {
|
getAPI('listIsos', params).then((response) => {
|
||||||
|
|||||||
@ -424,6 +424,7 @@ export default {
|
|||||||
}
|
}
|
||||||
if (isAdmin()) {
|
if (isAdmin()) {
|
||||||
params.templatefilter = 'all'
|
params.templatefilter = 'all'
|
||||||
|
params.isready = true
|
||||||
} else {
|
} else {
|
||||||
params.templatefilter = 'executable'
|
params.templatefilter = 'executable'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1881,6 +1881,7 @@ export default {
|
|||||||
apiName = 'listTemplates'
|
apiName = 'listTemplates'
|
||||||
params.listall = true
|
params.listall = true
|
||||||
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
|
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
|
||||||
|
params.isready = true
|
||||||
params.id = this.queryTemplateId
|
params.id = this.queryTemplateId
|
||||||
this.dataPreFill.templateid = this.queryTemplateId
|
this.dataPreFill.templateid = this.queryTemplateId
|
||||||
} else if (this.queryNetworkId) {
|
} else if (this.queryNetworkId) {
|
||||||
@ -2989,6 +2990,7 @@ export default {
|
|||||||
args.arch = this.selectedArchitecture
|
args.arch = this.selectedArchitecture
|
||||||
}
|
}
|
||||||
args.templatefilter = templateFilter
|
args.templatefilter = templateFilter
|
||||||
|
args.isready = true
|
||||||
args.details = 'all'
|
args.details = 'all'
|
||||||
args.showicon = 'true'
|
args.showicon = 'true'
|
||||||
args.id = this.queryTemplateId
|
args.id = this.queryTemplateId
|
||||||
|
|||||||
@ -671,7 +671,8 @@ export default {
|
|||||||
for (const filtername of filters) {
|
for (const filtername of filters) {
|
||||||
const params = {
|
const params = {
|
||||||
templatefilter: filtername,
|
templatefilter: filtername,
|
||||||
forcks: true
|
forcks: true,
|
||||||
|
isready: true
|
||||||
}
|
}
|
||||||
this.templateLoading = true
|
this.templateLoading = true
|
||||||
getAPI('listTemplates', params).then(json => {
|
getAPI('listTemplates', params).then(json => {
|
||||||
|
|||||||
@ -1796,12 +1796,14 @@ export default {
|
|||||||
apiName = 'listTemplates'
|
apiName = 'listTemplates'
|
||||||
params.listall = true
|
params.listall = true
|
||||||
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
|
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
|
||||||
|
params.isready = true
|
||||||
params.id = this.queryTemplateId
|
params.id = this.queryTemplateId
|
||||||
this.dataPreFill.templateid = this.queryTemplateId
|
this.dataPreFill.templateid = this.queryTemplateId
|
||||||
} else if (this.queryIsoId) {
|
} else if (this.queryIsoId) {
|
||||||
apiName = 'listIsos'
|
apiName = 'listIsos'
|
||||||
params.listall = true
|
params.listall = true
|
||||||
params.isofilter = this.isNormalAndDomainUser ? 'executable' : 'all'
|
params.isofilter = this.isNormalAndDomainUser ? 'executable' : 'all'
|
||||||
|
params.isready = true
|
||||||
params.id = this.queryIsoId
|
params.id = this.queryIsoId
|
||||||
this.dataPreFill.isoid = this.queryIsoId
|
this.dataPreFill.isoid = this.queryIsoId
|
||||||
} else if (this.queryNetworkId) {
|
} else if (this.queryNetworkId) {
|
||||||
@ -2617,6 +2619,7 @@ export default {
|
|||||||
args.domainid = store.getters.project?.id ? null : this.owner.domainid
|
args.domainid = store.getters.project?.id ? null : this.owner.domainid
|
||||||
args.projectid = store.getters.project?.id || this.owner.projectid
|
args.projectid = store.getters.project?.id || this.owner.projectid
|
||||||
args.templatefilter = templateFilter
|
args.templatefilter = templateFilter
|
||||||
|
args.isready = true
|
||||||
args.details = 'all'
|
args.details = 'all'
|
||||||
args.showicon = 'true'
|
args.showicon = 'true'
|
||||||
args.id = this.queryTemplateId
|
args.id = this.queryTemplateId
|
||||||
@ -2652,6 +2655,7 @@ export default {
|
|||||||
args.domainid = store.getters.project?.id ? null : this.owner.domainid
|
args.domainid = store.getters.project?.id ? null : this.owner.domainid
|
||||||
args.projectid = store.getters.project?.id || this.owner.projectid
|
args.projectid = store.getters.project?.id || this.owner.projectid
|
||||||
args.isoFilter = isoFilter
|
args.isoFilter = isoFilter
|
||||||
|
args.isready = true
|
||||||
args.bootable = true
|
args.bootable = true
|
||||||
args.showicon = 'true'
|
args.showicon = 'true'
|
||||||
args.id = this.queryIsoId
|
args.id = this.queryIsoId
|
||||||
|
|||||||
@ -2555,6 +2555,7 @@ export default {
|
|||||||
args.arch = this.selectedArchitecture
|
args.arch = this.selectedArchitecture
|
||||||
}
|
}
|
||||||
args.templatefilter = templateFilter
|
args.templatefilter = templateFilter
|
||||||
|
args.isready = true
|
||||||
args.details = 'all'
|
args.details = 'all'
|
||||||
args.showicon = 'true'
|
args.showicon = 'true'
|
||||||
args.id = this.queryTemplateId
|
args.id = this.queryTemplateId
|
||||||
|
|||||||
@ -283,6 +283,7 @@ export default {
|
|||||||
params.id = this.resource.templateid
|
params.id = this.resource.templateid
|
||||||
params.isrecursive = true
|
params.isrecursive = true
|
||||||
params.templatefilter = 'all'
|
params.templatefilter = 'all'
|
||||||
|
params.isready = true
|
||||||
var apiName = 'listTemplates'
|
var apiName = 'listTemplates'
|
||||||
getAPI(apiName, params).then(json => {
|
getAPI(apiName, params).then(json => {
|
||||||
const templateResponses = json.listtemplatesresponse.template
|
const templateResponses = json.listtemplatesresponse.template
|
||||||
|
|||||||
@ -367,6 +367,7 @@ export default {
|
|||||||
}
|
}
|
||||||
args.zoneid = this.resource.zoneid
|
args.zoneid = this.resource.zoneid
|
||||||
args.templatefilter = templateFilter
|
args.templatefilter = templateFilter
|
||||||
|
args.isready = true
|
||||||
if (this.resource.arch) {
|
if (this.resource.arch) {
|
||||||
args.arch = this.resource.arch
|
args.arch = this.resource.arch
|
||||||
}
|
}
|
||||||
|
|||||||
@ -245,6 +245,7 @@ export default {
|
|||||||
params.id = this.resource.templateid
|
params.id = this.resource.templateid
|
||||||
params.isrecursive = true
|
params.isrecursive = true
|
||||||
params.templatefilter = 'all'
|
params.templatefilter = 'all'
|
||||||
|
params.isready = true
|
||||||
var apiName = 'listTemplates'
|
var apiName = 'listTemplates'
|
||||||
getAPI(apiName, params).then(json => {
|
getAPI(apiName, params).then(json => {
|
||||||
const templateResponses = json.listtemplatesresponse.template
|
const templateResponses = json.listtemplatesresponse.template
|
||||||
|
|||||||
@ -189,6 +189,7 @@ export default {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getAPI('listTemplates', {
|
getAPI('listTemplates', {
|
||||||
templatefilter: 'all',
|
templatefilter: 'all',
|
||||||
|
isready: true,
|
||||||
id: this.resource.templateid
|
id: this.resource.templateid
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
var template = response?.listtemplatesresponse?.template?.[0] || null
|
var template = response?.listtemplatesresponse?.template?.[0] || null
|
||||||
|
|||||||
@ -584,6 +584,7 @@ export default {
|
|||||||
isLoad: true,
|
isLoad: true,
|
||||||
options: {
|
options: {
|
||||||
templatefilter: 'all',
|
templatefilter: 'all',
|
||||||
|
isready: true,
|
||||||
hypervisor: this.cluster.hypervisortype,
|
hypervisor: this.cluster.hypervisortype,
|
||||||
showicon: true
|
showicon: true
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user