Skip to content

Commit

Permalink
#853: Allow to configure plugins ordering/enable in nav bar. Work in …
Browse files Browse the repository at this point in the history
…progress.
  • Loading branch information
davsclaus committed Dec 18, 2013
1 parent 5aa6aea commit 950421e
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions hawtio-web/src/main/webapp/app/core/js/navbar.ts
Expand Up @@ -45,8 +45,28 @@ module Core {
$scope.currentPerspective = perspective;
reloadPerspective();
$scope.topLevelTabs = Perspective.getTopLevelTabsForPerspective($location, workspace, jolokia, localStorage);
if (perspective.lastPage) {
var path = Core.trimLeading(perspective.lastPage, "#");

// is any of the top level tabs marked as default?
var defaultPlugin = Core.getDefaultPlugin(pid, workspace, jolokia, localStorage);
var defaultTab;
var path;
if (defaultPlugin) {
$scope.topLevelTabs.forEach(tab => {
if (tab.id === defaultPlugin.id) {
defaultTab = tab;
}
});
if (defaultTab) {
path = Core.trimLeading(defaultTab.href(), "#");
}
} else {
// if no default plugin configured, then select the last page as the active location
if (perspective.lastPage) {
path = Core.trimLeading(perspective.lastPage, "#");
}
}

if (path) {
// lets avoid any old paths with ?p=" inside
var idx = path.indexOf("?p=") || path.indexOf("&p=");
if (idx > 0) {
Expand Down

0 comments on commit 950421e

Please sign in to comment.