cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/4.5-ui-plugin-enhancement to f8693d2
Date Tue, 07 Jul 2015 09:42:54 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.5-ui-plugin-enhancement [created] f8693d24a


ui: 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 <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f8693d24
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f8693d24
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f8693d24

Branch: refs/heads/4.5-ui-plugin-enhancement
Commit: f8693d24a42dc806c67a4b12731b0ea20f6bd791
Parents: 7eac631
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Tue Jul 7 15:01:12 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Tue Jul 7 15:11:45 2015 +0530

----------------------------------------------------------------------
 ui/plugins/testPlugin/testPlugin.js |  1 +
 ui/scripts/cloudStack.js            | 13 ++++++++++++-
 ui/scripts/ui/core.js               |  4 ++--
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f8693d24/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/f8693d24/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index a701c41..67ec1d5 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -32,7 +32,18 @@
             }
 
             if (cloudStack.plugins.length) {
-                sections.push('plugins');
+                var displayPluginSection = false;
+                $.each(cloudStack.plugins, function(idx, plugin) {
+                    if (cloudStack.sections.hasOwnProperty(plugin)) {
+                        if (!cloudStack.sections[plugin].showOnNavigation) {
+                            displayPluginSection = true;
+                            return false;
+                        }
+                    }
+                });
+                if (displayPluginSection) {
+                    sections.push('plugins');
+                }
             }
 
             return sections;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f8693d24/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;
 


Mime
View raw message