Skip to content

Commit 1f1e38f

Browse files
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
1 parent 7124922 commit 1f1e38f

File tree

13 files changed

+32
-4
lines changed

13 files changed

+32
-4
lines changed

api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd implements UserCmd {
5757
@Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true if the ISO is publicly available to all users, false otherwise.")
5858
private Boolean publicIso;
5959

60-
@Parameter(name = ApiConstants.IS_READY, type = CommandType.BOOLEAN, description = "true if this ISO is ready to be deployed")
60+
@Parameter(name = ApiConstants.IS_READY, type = CommandType.BOOLEAN, description = "list ISOs that are ready to be deployed")
6161
private Boolean ready;
6262

6363
@Parameter(name = ApiConstants.ISO_FILTER,

api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User
126126
since = "4.21.0")
127127
private Long extensionId;
128128

129+
@Parameter(name = ApiConstants.IS_READY, type = CommandType.BOOLEAN, description = "list templates that are ready to be deployed", since = "4.21.0")
130+
private Boolean ready;
131+
129132
/////////////////////////////////////////////////////
130133
/////////////////// Accessors ///////////////////////
131134
/////////////////////////////////////////////////////
@@ -195,6 +198,13 @@ public boolean listInReadyState() {
195198
boolean onlyReady =
196199
(templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable) ||
197200
(templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community);
201+
202+
if (!onlyReady) {
203+
if (isReady() != null && isReady().booleanValue() != onlyReady) {
204+
onlyReady = isReady().booleanValue();
205+
}
206+
}
207+
198208
return onlyReady;
199209
}
200210

@@ -230,6 +240,10 @@ public Long getExtensionId() {
230240
return extensionId;
231241
}
232242

243+
public Boolean isReady() {
244+
return ready;
245+
}
246+
233247
@Override
234248
public String getCommandName() {
235249
return s_name;

ui/src/views/compute/AttachIso.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ export default {
106106
const params = {
107107
listall: true,
108108
zoneid: this.resource.zoneid,
109-
isready: true,
110-
isofilter: isoFilter
109+
isofilter: isoFilter,
110+
isready: true
111111
}
112112
return new Promise((resolve, reject) => {
113113
getAPI('listIsos', params).then((response) => {

ui/src/views/compute/AutoScaleVmProfile.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ export default {
424424
}
425425
if (isAdmin()) {
426426
params.templatefilter = 'all'
427+
params.isready = true
427428
} else {
428429
params.templatefilter = 'executable'
429430
}

ui/src/views/compute/CreateAutoScaleVmGroup.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,6 +1881,7 @@ export default {
18811881
apiName = 'listTemplates'
18821882
params.listall = true
18831883
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
1884+
params.isready = true
18841885
params.id = this.queryTemplateId
18851886
this.dataPreFill.templateid = this.queryTemplateId
18861887
} else if (this.queryNetworkId) {
@@ -2989,6 +2990,7 @@ export default {
29892990
args.arch = this.selectedArchitecture
29902991
}
29912992
args.templatefilter = templateFilter
2993+
args.isready = true
29922994
args.details = 'all'
29932995
args.showicon = 'true'
29942996
args.id = this.queryTemplateId

ui/src/views/compute/CreateKubernetesCluster.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ export default {
671671
for (const filtername of filters) {
672672
const params = {
673673
templatefilter: filtername,
674-
forcks: true
674+
forcks: true,
675+
isready: true
675676
}
676677
this.templateLoading = true
677678
getAPI('listTemplates', params).then(json => {

ui/src/views/compute/DeployVM.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,12 +1796,14 @@ export default {
17961796
apiName = 'listTemplates'
17971797
params.listall = true
17981798
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
1799+
params.isready = true
17991800
params.id = this.queryTemplateId
18001801
this.dataPreFill.templateid = this.queryTemplateId
18011802
} else if (this.queryIsoId) {
18021803
apiName = 'listIsos'
18031804
params.listall = true
18041805
params.isofilter = this.isNormalAndDomainUser ? 'executable' : 'all'
1806+
params.isready = true
18051807
params.id = this.queryIsoId
18061808
this.dataPreFill.isoid = this.queryIsoId
18071809
} else if (this.queryNetworkId) {
@@ -2617,6 +2619,7 @@ export default {
26172619
args.domainid = store.getters.project?.id ? null : this.owner.domainid
26182620
args.projectid = store.getters.project?.id || this.owner.projectid
26192621
args.templatefilter = templateFilter
2622+
args.isready = true
26202623
args.details = 'all'
26212624
args.showicon = 'true'
26222625
args.id = this.queryTemplateId
@@ -2652,6 +2655,7 @@ export default {
26522655
args.domainid = store.getters.project?.id ? null : this.owner.domainid
26532656
args.projectid = store.getters.project?.id || this.owner.projectid
26542657
args.isoFilter = isoFilter
2658+
args.isready = true
26552659
args.bootable = true
26562660
args.showicon = 'true'
26572661
args.id = this.queryIsoId

ui/src/views/compute/DeployVnfAppliance.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,6 +2555,7 @@ export default {
25552555
args.arch = this.selectedArchitecture
25562556
}
25572557
args.templatefilter = templateFilter
2558+
args.isready = true
25582559
args.details = 'all'
25592560
args.showicon = 'true'
25602561
args.id = this.queryTemplateId

ui/src/views/compute/EditVM.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ export default {
283283
params.id = this.resource.templateid
284284
params.isrecursive = true
285285
params.templatefilter = 'all'
286+
params.isready = true
286287
var apiName = 'listTemplates'
287288
getAPI(apiName, params).then(json => {
288289
const templateResponses = json.listtemplatesresponse.template

ui/src/views/compute/ReinstallVm.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ export default {
367367
}
368368
args.zoneid = this.resource.zoneid
369369
args.templatefilter = templateFilter
370+
args.isready = true
370371
if (this.resource.arch) {
371372
args.arch = this.resource.arch
372373
}

0 commit comments

Comments
 (0)