Fix for dashboard items without before: {} block
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/72fa89eb Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/72fa89eb Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/72fa89eb Branch: refs/heads/master Commit: 72fa89eb7a326582abac2554a25786f339ef58ca Parents: cd7287a Author: Brian Federle <brian.fede...@citrix.com> Authored: Fri May 24 13:07:42 2013 -0700 Committer: Brian Federle <brian.fede...@citrix.com> Committed: Fri May 24 13:07:42 2013 -0700 ---------------------------------------------------------------------- ui/modules/vpc/vpc.js | 52 ++++++++++++++++++++++--------------------- 1 files changed, 27 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/72fa89eb/ui/modules/vpc/vpc.js ---------------------------------------------------------------------- diff --git a/ui/modules/vpc/vpc.js b/ui/modules/vpc/vpc.js index 6eb721a..1a3b3e8 100644 --- a/ui/modules/vpc/vpc.js +++ b/ui/modules/vpc/vpc.js @@ -196,34 +196,36 @@ }); }; - before.check({ - context: context, - response: { - success: function(result) { - // true means content exists - if (result) { - load(); - } else { - cloudStack.dialog.confirm({ - message: before.messages.confirm, - action: function() { - $loading.appendTo($dashboardItem.closest('.vpc-network-chart')); - before.action({ - context: context, - response: { - success: function() { - $loading.remove(); - $dashboardItem.closest('.vpc-network-chart').trigger('reload'); - load(); + if (before) { + before.check({ + context: context, + response: { + success: function(result) { + // true means content exists + if (result) { + load(); + } else { + cloudStack.dialog.confirm({ + message: before.messages.confirm, + action: function() { + $loading.appendTo($dashboardItem.closest('.vpc-network-chart')); + before.action({ + context: context, + response: { + success: function() { + $loading.remove(); + $dashboardItem.closest('.vpc-network-chart').trigger('reload'); + load(); + } } - } - }); - } - }) + }); + } + }) + } } } - } - }); + }); + } }); });