Skip to content

Commit 0f411a0

Browse files
sureshanapartidhslove
authored andcommitted
Support to list templates in ready state (new API parameter 'isready', similar to list ISOs) (apache#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 100c2f9 commit 0f411a0

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
@@ -131,6 +131,9 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User
131131
since = "4.21.0")
132132
private Long extensionId;
133133

134+
@Parameter(name = ApiConstants.IS_READY, type = CommandType.BOOLEAN, description = "list templates that are ready to be deployed", since = "4.21.0")
135+
private Boolean ready;
136+
134137
/////////////////////////////////////////////////////
135138
/////////////////// Accessors ///////////////////////
136139
/////////////////////////////////////////////////////
@@ -200,6 +203,13 @@ public boolean listInReadyState() {
200203
boolean onlyReady =
201204
(templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable) ||
202205
(templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community);
206+
207+
if (!onlyReady) {
208+
if (isReady() != null && isReady().booleanValue() != onlyReady) {
209+
onlyReady = isReady().booleanValue();
210+
}
211+
}
212+
203213
return onlyReady;
204214
}
205215

@@ -239,6 +249,10 @@ public Long getExtensionId() {
239249
return extensionId;
240250
}
241251

252+
public Boolean isReady() {
253+
return ready;
254+
}
255+
242256
@Override
243257
public String getCommandName() {
244258
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
@@ -672,7 +672,8 @@ export default {
672672
for (const filtername of filters) {
673673
const params = {
674674
templatefilter: filtername,
675-
forcks: true
675+
forcks: true,
676+
isready: true
676677
}
677678
this.templateLoading = true
678679
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
@@ -1915,12 +1915,14 @@ export default {
19151915
apiName = 'listTemplates'
19161916
params.listall = true
19171917
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
1918+
params.isready = true
19181919
params.id = this.queryTemplateId
19191920
this.dataPreFill.templateid = this.queryTemplateId
19201921
} else if (this.queryIsoId) {
19211922
apiName = 'listIsos'
19221923
params.listall = true
19231924
params.isofilter = this.isNormalAndDomainUser ? 'executable' : 'all'
1925+
params.isready = true
19241926
params.id = this.queryIsoId
19251927
this.dataPreFill.isoid = this.queryIsoId
19261928
} else if (this.volumeId) {
@@ -2848,6 +2850,7 @@ export default {
28482850
args.domainid = store.getters.project?.id ? null : this.owner.domainid
28492851
args.projectid = store.getters.project?.id || this.owner.projectid
28502852
args.templatefilter = templateFilter
2853+
args.isready = true
28512854
args.details = 'all'
28522855
args.showicon = 'true'
28532856
args.id = this.queryTemplateId
@@ -2883,6 +2886,7 @@ export default {
28832886
args.domainid = store.getters.project?.id ? null : this.owner.domainid
28842887
args.projectid = store.getters.project?.id || this.owner.projectid
28852888
args.isoFilter = isoFilter
2889+
args.isready = true
28862890
args.bootable = true
28872891
args.showicon = 'true'
28882892
args.id = this.queryIsoId

ui/src/views/compute/DeployVnfAppliance.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,6 +2563,7 @@ export default {
25632563
args.arch = this.selectedArchitecture
25642564
}
25652565
args.templatefilter = templateFilter
2566+
args.isready = true
25662567
args.details = 'all'
25672568
args.showicon = 'true'
25682569
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
@@ -369,6 +369,7 @@ export default {
369369
}
370370
args.zoneid = this.resource.zoneid
371371
args.templatefilter = templateFilter
372+
args.isready = true
372373
if (this.resource.arch) {
373374
args.arch = this.resource.arch
374375
}

0 commit comments

Comments
 (0)