Repository: cloudstack Updated Branches: refs/heads/4.5 7eac6310b -> 4de4a0f3d
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 (cherry picked from commit 7c206c30a58471ecb8ffafc3627ad296d0b06538) Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4de4a0f3 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4de4a0f3 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4de4a0f3 Branch: refs/heads/4.5 Commit: 4de4a0f3dd8db48c2cd3f2367e9970b9ca5561b0 Parents: 7eac631 Author: Rohit Yadav <[email protected]> Authored: Tue Jul 7 15:01:12 2015 +0530 Committer: Rohit Yadav <[email protected]> Committed: Thu Jul 9 15:26:00 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/4de4a0f3/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/4de4a0f3/ui/scripts/cloudStack.js ---------------------------------------------------------------------- diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index a701c41..feb6e26 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/4de4a0f3/ui/scripts/ui/core.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/core.js b/ui/scripts/ui/core.js index 6912d1b..e64f386 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;
