Repository: cloudstack Updated Branches: refs/heads/4.4-forward a61f77523 -> b8a296158
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/b8a29615 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b8a29615 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b8a29615 Branch: refs/heads/4.4-forward Commit: b8a29615838bd12d0f6699ef3e64bb9b89158c26 Parents: a61f775 Author: Jessica Wang <[email protected]> Authored: Wed Jun 18 12:20:43 2014 -0700 Committer: Jessica Wang <[email protected]> Committed: Wed Jun 18 12:20:43 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/b8a29615/ui/scripts/system.js ---------------------------------------------------------------------- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 37fe504..24bdcf2 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/b8a29615/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)));
