Skip to content

Commit b67e49d

Browse files
committed
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.
1 parent 4a96a20 commit b67e49d

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

ui/scripts/cloudStack.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,26 @@
1919
home: 'dashboard',
2020

2121
sectionPreFilter: function(args) {
22+
var sections = [];
23+
2224
if(isAdmin()) {
23-
return ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects", "plugins"];
25+
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects"];
2426
}
2527
else if(isDomainAdmin()) {
26-
return ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects"];
28+
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects"];
2729
}
2830
else if (g_userProjectsEnabled) {
29-
return ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "projects"];
31+
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "projects"];
3032
}
3133
else { //normal user
32-
return ["dashboard", "instances", "storage", "network", "templates", "accounts", "events"];
34+
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events"];
35+
}
36+
37+
if (cloudStack.plugins.length) {
38+
sections.push('plugins');
3339
}
40+
41+
return sections;
3442
},
3543
sections: {
3644
/**

0 commit comments

Comments
 (0)