UI Dialog: Don't show dialog with empty message
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/62fd9115 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/62fd9115 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/62fd9115 Branch: refs/heads/ui-multiple-pod-ranges Commit: 62fd9115c2fd0a742aff15f43b401b34553ffe04 Parents: 61d8dde Author: Brian Federle <[email protected]> Authored: Thu Mar 21 13:24:22 2013 -0700 Committer: Brian Federle <[email protected]> Committed: Thu Mar 21 13:24:22 2013 -0700 ---------------------------------------------------------------------- ui/scripts/ui/dialog.js | 46 ++++++++++++++++++++++------------------- 1 files changed, 25 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/62fd9115/ui/scripts/ui/dialog.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index 88dba3f..bb372fb 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -585,27 +585,31 @@ * Notice dialog */ notice: function(args) { - return $( - $('<span>').addClass('message').html( - _l(args.message) - ) - ).dialog({ - title: _l('label.status'), - dialogClass: 'notice', - closeOnEscape: false, - zIndex: 5000, - buttons: [ - { - text: _l('Close'), - 'class': 'close', - click: function() { - $(this).dialog('destroy'); - if (args.clickAction) args.clickAction(); - $('.hovered-elem').hide(); - } - } - ] - }); + if (args.message) { + return $( + $('<span>').addClass('message').html( + _l(args.message) + ) + ).dialog({ + title: _l('label.status'), + dialogClass: 'notice', + closeOnEscape: false, + zIndex: 5000, + buttons: [ + { + text: _l('Close'), + 'class': 'close', + click: function() { + $(this).dialog('destroy'); + if (args.clickAction) args.clickAction(); + $('.hovered-elem').hide(); + } + } + ] + }); + } + + return false; } }; })(window.jQuery, window.cloudStack);
