forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request elastic#7723 from cjcenizal/7467/pin-sidebar-funct…
…ionality [7467] Add "Collapse/Expand" button to sidebar.
- Loading branch information
Showing
24 changed files
with
381 additions
and
250 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
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: 0 additions & 11 deletions
11
src/ui/public/chrome/directives/app_switcher/app_switcher.html
This file was deleted.
Oops, something went wrong.
72 changes: 0 additions & 72 deletions
72
src/ui/public/chrome/directives/app_switcher/app_switcher.less
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="switcher.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()); | ||
}; | ||
|
||
} | ||
}; | ||
}); |
44 changes: 44 additions & 0 deletions
44
src/ui/public/chrome/directives/global_nav/global_nav.less
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,44 @@ | ||
|
||
@import (reference) "~ui/styles/variables"; | ||
|
||
.global-nav { | ||
width: @as-closed-width; | ||
position: fixed; | ||
left: 0; | ||
top: 0; | ||
bottom: 0; | ||
z-index: 0; | ||
background-color: @app-links-wrapper-background; | ||
overflow: hidden; | ||
|
||
&.is-global-nav-open { | ||
width: @as-open-width; | ||
|
||
.app-title { | ||
display: inline-block; | ||
} | ||
|
||
+ .app-wrapper { | ||
left: @as-open-width; | ||
} | ||
} | ||
|
||
.logo-small, | ||
.logo { | ||
height: 70px; | ||
width: @as-open-width; | ||
list-style-type: none; | ||
&.kibana { | ||
background-image: url("~ui/images/kibana.svg"); | ||
background-position: 6px 10px; | ||
background-size: 140px 50px; | ||
background-repeat: no-repeat; | ||
background-color: #e8488b; | ||
} | ||
} | ||
} | ||
|
||
.gloal-nav__bottom-links { | ||
position: absolute; | ||
bottom: 0; | ||
} |
Oops, something went wrong.