Skip to content

Commit 1085330

Browse files
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 86827f8 commit 1085330

10 files changed

Lines changed: 25 additions & 2 deletions

File tree

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/AutoScaleVmProfile.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ export default {
427427
} else {
428428
params.templatefilter = 'executable'
429429
}
430+
params.isready = true
430431
getAPI('listTemplates', params).then(json => {
431432
this.templatesList = json.listtemplatesresponse?.template || []
432433
})

ui/src/views/compute/CreateAutoScaleVmGroup.vue

Lines changed: 1 addition & 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) {

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,12 +1797,14 @@ export default {
17971797
apiName = 'listTemplates'
17981798
params.listall = true
17991799
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
1800+
params.isready = true
18001801
params.id = this.queryTemplateId
18011802
this.dataPreFill.templateid = this.queryTemplateId
18021803
} else if (this.queryIsoId) {
18031804
apiName = 'listIsos'
18041805
params.listall = true
18051806
params.isofilter = this.isNormalAndDomainUser ? 'executable' : 'all'
1807+
params.isready = true
18061808
params.id = this.queryIsoId
18071809
this.dataPreFill.isoid = this.queryIsoId
18081810
} else if (this.queryNetworkId) {

ui/src/views/compute/EditVM.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ export default {
285285
params.id = this.resource.templateid
286286
params.isrecursive = true
287287
params.templatefilter = 'all'
288+
params.isready = true
288289
var apiName = 'listTemplates'
289290
getAPI(apiName, params).then(json => {
290291
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
}

ui/src/views/compute/ResetUserData.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ export default {
245245
params.id = this.resource.templateid
246246
params.isrecursive = true
247247
params.templatefilter = 'all'
248+
params.isready = true
248249
var apiName = 'listTemplates'
249250
getAPI(apiName, params).then(json => {
250251
const templateResponses = json.listtemplatesresponse.template

ui/src/views/compute/ScaleVM.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export default {
189189
return new Promise((resolve, reject) => {
190190
getAPI('listTemplates', {
191191
templatefilter: 'all',
192+
isready: true,
192193
id: this.resource.templateid
193194
}).then(response => {
194195
var template = response?.listtemplatesresponse?.template?.[0] || null

0 commit comments

Comments
 (0)