Skip to content

Commit

Permalink
[console] open kbnTopNav when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Apr 1, 2016
1 parent 57ab24a commit 1c46009
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/plugins/console/public/src/directives/sense_navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ require('ui/modules')
},
controllerAs: 'navbar',
controller: class SenseNavbarController {
constructor($scope) {
constructor($scope, $timeout, $element) {
$scope.chrome = require('ui/chrome');

this.menu = [
{
key: 'welcome',
noButton: true,
openByDefault: storage.get('version_welcome_shown') !== '@@SENSE_REVISION',
template: `<sense-welcome></sense-welcome>`
},
{
Expand All @@ -43,6 +42,19 @@ require('ui/modules')
},
];

$timeout(function tryToOpenWelcomeTemplate() {
if (storage.get('version_welcome_shown') === '@@SENSE_REVISION') {
return;
}

const $topNavScope = $element.find('kbn-top-nav').scope();
if ($topNavScope && $topNavScope.kbnTopNav) {
$topNavScope.kbnTopNav.open('welcome')
} else {
$timeout(tryToOpenWelcomeTemplate, 10);
}
}, 0)

this.updateServerUrlHistory();
}

Expand Down

0 comments on commit 1c46009

Please sign in to comment.