Repository: cloudstack Updated Branches: refs/heads/master 77e74841a -> dbbc6d42f
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). Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dbbc6d42 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dbbc6d42 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dbbc6d42 Branch: refs/heads/master Commit: dbbc6d42fdfc76649f4a7884859dd9668e0203ab Parents: 77e7484 Author: Jessica Wang <[email protected]> Authored: Wed Jun 18 12:20:43 2014 -0700 Committer: Jessica Wang <[email protected]> Committed: Wed Jun 18 12:23:10 2014 -0700 ---------------------------------------------------------------------- ui/scripts/system.js | 10 ++++++---- ui/scripts/ui/dialog.js | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dbbc6d42/ui/scripts/system.js ---------------------------------------------------------------------- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 710832c..7d49d8d 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -15436,17 +15436,19 @@ dependsOn: 'clusterId', select: function (args) { var clusterId = args.clusterId; - if (clusterId == null) + if (clusterId == null || clusterId.length == 0) { + args.response.success({ + data: [] + }); return; - var items =[]; + } + $(clusterObjs).each(function () { if (this.id == clusterId) { selectedClusterObj = this; return false; //break the $.each() loop } }); - if (selectedClusterObj == null) - return; if (selectedClusterObj.hypervisortype == "KVM") { var items =[]; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dbbc6d42/ui/scripts/ui/dialog.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index 7a903fd..0fddcf7 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -271,6 +271,11 @@ context: args.context, response: { success: function(args) { + if (args.data == undefined || args.data.length == 0) { + var $option = $('<option>') + .appendTo($input) + .html(""); + } else { $(args.data).each(function() { var id; if (field.valueField) @@ -290,6 +295,7 @@ .data('json-obj', this) .html(_s(desc)); }); + } if (field.defaultValue) { $input.val(_s(strOrFunc(field.defaultValue, args.data)));
