-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor kbn_chrome and app_switcher.
- Rename app_switcher -> global_nav, and rename associated services and subcomponents accordingly. - Rename chrome.html -> kbn_chrome.html and create kbn_chrome.less.
- Loading branch information
Showing
21 changed files
with
311 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/ui/public/chrome/directives/app_switcher/app_switcher.html
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/ui/public/chrome/directives/global_nav/app_switcher/app_switcher.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
<global-nav-link | ||
ng-repeat="link in switcher.shownNavLinks" | ||
is-active="link.active" | ||
is-disabled="!switcher.isNavLinkEnabled(link)" | ||
tooltip-content="getTooltip(link)" | ||
on-click="switcher.ensureNavigation($event, link)" | ||
href="link.active ? link.url : (link.lastSubUrl || link.url)" | ||
icon="link.icon" | ||
title="link.title" | ||
></global-nav-link> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/ui/public/chrome/directives/global_nav/global_nav.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<nav | ||
class="global-nav" | ||
ng-class="{'is-global-nav-open': isGlobalNavOpen}" | ||
ng-show="isVisible" | ||
> | ||
<!-- Logo --> | ||
<li | ||
ng-if="!logoBrand && !smallLogoBrand" | ||
aria-label="{{ appTitle }} Logo" | ||
class="logo kibana" | ||
></li> | ||
|
||
<li | ||
ng-if="logoBrand" | ||
ng-style="{ 'background': logoBrand }" | ||
aria-label="{{ appTitle }} Logo" | ||
class="logo hidden-sm" | ||
></li> | ||
|
||
<li | ||
ng-if="smallLogoBrand" | ||
ng-style="{ 'background': smallLogoBrand }" | ||
aria-label="{{ appTitle }} Logo" | ||
class="logo-small visible-sm hidden-xs" | ||
></li> | ||
|
||
<!-- Main apps --> | ||
<app-switcher | ||
chrome="chrome" | ||
></app-switcher> | ||
|
||
<!-- Bottom button --> | ||
<div class="gloal-nav__bottom-links"> | ||
<div class="chrome-actions" kbn-chrome-append-nav-controls></div> | ||
|
||
<!-- Open/close sidebar --> | ||
<global-nav-link | ||
class="{{ globalNavToggleButton.classes }}" | ||
tooltip-content="globalNavToggleButton.tooltipContent" | ||
on-click="toggleGlobalNav($event)" | ||
icon="'/plugins/kibana/assets/play-circle.svg'" | ||
title="globalNavToggleButton.title" | ||
></global-nav-link> | ||
</div> | ||
|
||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
import './app_switcher'; | ||
import './global_nav_link'; | ||
|
||
import globalNavTemplate from './global_nav.html'; | ||
import './global_nav.less'; | ||
import uiModules from 'ui/modules'; | ||
|
||
const module = uiModules.get('kibana'); | ||
|
||
module.directive('globalNav', globalNavState => { | ||
return { | ||
restrict: 'E', | ||
replace: true, | ||
scope: { | ||
chrome: '=', | ||
isVisible: '=', | ||
logoBrand: '=', | ||
smallLogoBrand: '=', | ||
appTitle: '=', | ||
}, | ||
template: globalNavTemplate, | ||
link: scope => { | ||
// App switcher functionality. | ||
function updateGlobalNav() { | ||
const isOpen = globalNavState.isOpen(); | ||
scope.isGlobalNavOpen = isOpen; | ||
scope.globalNavToggleButton = { | ||
classes: isOpen ? 'global-nav-link--close' : undefined, | ||
title: isOpen ? 'Collapse' : 'Expand', | ||
tooltipContent: isOpen ? 'Collapse side bar' : 'Expand side bar', | ||
}; | ||
|
||
// Notify visualizations, e.g. the dashboard, that they should re-render. | ||
scope.$root.$broadcast('globalNav:update'); | ||
} | ||
|
||
updateGlobalNav(); | ||
|
||
scope.$root.$on('globalNavState:change', () => { | ||
updateGlobalNav(); | ||
}); | ||
|
||
scope.toggleGlobalNav = event => { | ||
event.preventDefault(); | ||
globalNavState.setOpen(!globalNavState.isOpen()); | ||
}; | ||
|
||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.