cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [1/2] git commit: refs/heads/ui-plugins - Conditionally load plugin section
Date Mon, 11 Feb 2013 19:48:04 GMT
Conditionally load plugin section

If no UI plugins are loaded via plugins.js, then hide 'plugins'
section, to avoid confusion due to a blank plugin page.


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

Branch: refs/heads/ui-plugins
Commit: b67e49d8ce297f8371bccdf7ad3c98ecd90e228b
Parents: 4a96a20
Author: Brian Federle <brian.federle@citrix.com>
Authored: Mon Feb 11 11:45:34 2013 -0800
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Mon Feb 11 11:45:34 2013 -0800

----------------------------------------------------------------------
 ui/scripts/cloudStack.js |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b67e49d8/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index fc85788..7456ef5 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -19,18 +19,26 @@
     home: 'dashboard',
 
     sectionPreFilter: function(args) {
+      var sections = [];
+
       if(isAdmin()) {
-        return ["dashboard", "instances", "storage", "network", "templates", "accounts",
"domains", "events", "system", "global-settings", "configuration", "projects", "plugins"];
+        sections = ["dashboard", "instances", "storage", "network", "templates", "accounts",
"domains", "events", "system", "global-settings", "configuration", "projects"];
       }
       else if(isDomainAdmin()) {
-        return ["dashboard", "instances", "storage", "network", "templates", "accounts",
"domains", "events", "projects"];
+        sections = ["dashboard", "instances", "storage", "network", "templates", "accounts",
"domains", "events", "projects"];
       }
       else if (g_userProjectsEnabled) {
-        return ["dashboard", "instances", "storage", "network", "templates", "accounts",
"events", "projects"];
+        sections = ["dashboard", "instances", "storage", "network", "templates", "accounts",
"events", "projects"];
       }
       else { //normal user
-        return ["dashboard", "instances", "storage", "network", "templates", "accounts",
"events"];
+        sections = ["dashboard", "instances", "storage", "network", "templates", "accounts",
"events"];
+      }
+
+      if (cloudStack.plugins.length) {
+        sections.push('plugins');
       }
+
+      return sections;
     },
     sections: {
       /**


Mime
View raw message