Skip to content

Commit b8a2961

Browse files
author
Jessica Wang
committed
CLOUDSTACK-6936: UI - (1)dialog widget > dropdown field > provide a blank option if there is no data for option(s) in a dropdown field. (2) Add Primary Storage dialog - cluster dropdown field - still calls args.response.success() when there is no data for option(s).
1 parent a61f775 commit b8a2961

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎ui/scripts/system.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15436,17 +15436,19 @@
1543615436
dependsOn: 'clusterId',
1543715437
select: function (args) {
1543815438
var clusterId = args.clusterId;
15439-
if (clusterId == null)
15439+
if (clusterId == null || clusterId.length == 0) {
15440+
args.response.success({
15441+
data: []
15442+
});
1544015443
return;
15441-
var items =[];
15444+
}
15445+
1544215446
$(clusterObjs).each(function () {
1544315447
if (this.id == clusterId) {
1544415448
selectedClusterObj = this;
1544515449
return false; //break the $.each() loop
1544615450
}
1544715451
});
15448-
if (selectedClusterObj == null)
15449-
return;
1545015452

1545115453
if (selectedClusterObj.hypervisortype == "KVM") {
1545215454
var items =[];

‎ui/scripts/ui/dialog.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@
271271
context: args.context,
272272
response: {
273273
success: function(args) {
274+
if (args.data == undefined || args.data.length == 0) {
275+
var $option = $('<option>')
276+
.appendTo($input)
277+
.html("");
278+
} else {
274279
$(args.data).each(function() {
275280
var id;
276281
if (field.valueField)
@@ -290,6 +295,7 @@
290295
.data('json-obj', this)
291296
.html(_s(desc));
292297
});
298+
}
293299

294300
if (field.defaultValue) {
295301
$input.val(_s(strOrFunc(field.defaultValue, args.data)));

0 commit comments

Comments
 (0)