Repository: cloudstack Updated Branches: refs/heads/master 616b0117c -> 7c206c30a
CLOUDSTACK-8621: Allow UI plugins to be shown on navigation bar Introduces a boolean option in UI plugins setting it to 'true' would display the UI plugin on the left navigation bar. Signed-off-by: Rohit Yadav <[email protected]> This closes #563 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7c206c30 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7c206c30 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7c206c30 Branch: refs/heads/master Commit: 7c206c30a58471ecb8ffafc3627ad296d0b06538 Parents: 616b011 Author: Rohit Yadav <[email protected]> Authored: Tue Jul 7 15:01:12 2015 +0530 Committer: Rohit Yadav <[email protected]> Committed: Thu Jul 9 15:25:13 2015 +0530 ---------------------------------------------------------------------- ui/plugins/testPlugin/testPlugin.js | 1 + ui/scripts/cloudStack.js | 9 ++++++--- ui/scripts/ui/core.js | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c206c30/ui/plugins/testPlugin/testPlugin.js ---------------------------------------------------------------------- diff --git a/ui/plugins/testPlugin/testPlugin.js b/ui/plugins/testPlugin/testPlugin.js index e340ae5..66ce56f 100644 --- a/ui/plugins/testPlugin/testPlugin.js +++ b/ui/plugins/testPlugin/testPlugin.js @@ -19,6 +19,7 @@ plugin.ui.addSection({ id: 'testPlugin', title: 'TestPlugin', + showOnNavigation: true, preFilter: function(args) { return isAdmin(); }, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c206c30/ui/scripts/cloudStack.js ---------------------------------------------------------------------- diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index 0e0a71a..14d0cc2 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -31,9 +31,12 @@ sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "regions", "affinityGroups"]; } - if (cloudStack.plugins.length) { - sections.push('plugins'); - } + $.each(cloudStack.plugins, function(idx, plugin) { + if (cloudStack.sections.hasOwnProperty(plugin) && !cloudStack.sections[plugin].showOnNavigation) { + sections.push('plugins'); + return false; + } + }); return sections; }, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c206c30/ui/scripts/ui/core.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/core.js b/ui/scripts/ui/core.js index da2a16c..7756390 100644 --- a/ui/scripts/ui/core.js +++ b/ui/scripts/ui/core.js @@ -61,7 +61,7 @@ ); } - if (args.isPlugin) { + if (args.isPlugin && !args.showOnNavigation) { $li.hide(); } @@ -88,7 +88,7 @@ return $(this).hasClass(sectionID); }); var data = args.sections[sectionID]; - var isPlugin = data.isPlugin; + var isPlugin = data.isPlugin && !data.showOnNavigation; data.$browser = $browser;
