Commit d4a231fe by Torkel Ödegaard

ux: fixed sidenav issues

parent 4dd4631b
...@@ -65,7 +65,7 @@ export class GrafanaCtrl { ...@@ -65,7 +65,7 @@ export class GrafanaCtrl {
} }
/** @ngInject */ /** @ngInject */
export function grafanaAppDirective(playlistSrv, contextSrv) { export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScope) {
return { return {
restrict: 'E', restrict: 'E',
controller: GrafanaCtrl, controller: GrafanaCtrl,
...@@ -118,6 +118,7 @@ export function grafanaAppDirective(playlistSrv, contextSrv) { ...@@ -118,6 +118,7 @@ export function grafanaAppDirective(playlistSrv, contextSrv) {
var lastActivity = new Date().getTime(); var lastActivity = new Date().getTime();
var activeUser = true; var activeUser = true;
var inActiveTimeLimit = 60 * 1000; var inActiveTimeLimit = 60 * 1000;
var sidemenuHidden = false;
function checkForInActiveUser() { function checkForInActiveUser() {
if (!activeUser) { if (!activeUser) {
...@@ -131,6 +132,14 @@ export function grafanaAppDirective(playlistSrv, contextSrv) { ...@@ -131,6 +132,14 @@ export function grafanaAppDirective(playlistSrv, contextSrv) {
if ((new Date().getTime() - lastActivity) > inActiveTimeLimit) { if ((new Date().getTime() - lastActivity) > inActiveTimeLimit) {
activeUser = false; activeUser = false;
body.addClass('user-activity-low'); body.addClass('user-activity-low');
// hide sidemenu
if (sidemenuOpen) {
sidemenuHidden = true;
body.removeClass('sidemenu-open');
$timeout(function() {
$rootScope.$broadcast("render");
}, 100);
}
} }
} }
...@@ -139,6 +148,15 @@ export function grafanaAppDirective(playlistSrv, contextSrv) { ...@@ -139,6 +148,15 @@ export function grafanaAppDirective(playlistSrv, contextSrv) {
if (!activeUser) { if (!activeUser) {
activeUser = true; activeUser = true;
body.removeClass('user-activity-low'); body.removeClass('user-activity-low');
// restore sidemenu
if (sidemenuHidden) {
sidemenuHidden = false;
body.addClass('sidemenu-open');
$timeout(function() {
$rootScope.$broadcast("render");
}, 100);
}
} }
} }
......
...@@ -9,7 +9,7 @@ export default class UserGroupDetailsCtrl { ...@@ -9,7 +9,7 @@ export default class UserGroupDetailsCtrl {
navModel: any; navModel: any;
constructor(private $scope, private $http, private backendSrv, private $routeParams, navModelSrv) { constructor(private $scope, private $http, private backendSrv, private $routeParams, navModelSrv) {
this.navModel = navModelSrv.getOrgNav(3); this.navModel = navModelSrv.getNav('cfg', 'users');
this.get(); this.get();
} }
......
...@@ -15,7 +15,7 @@ export class UserGroupsCtrl { ...@@ -15,7 +15,7 @@ export class UserGroupsCtrl {
/** @ngInject */ /** @ngInject */
constructor(private $scope, private $http, private backendSrv, private $location, navModelSrv) { constructor(private $scope, private $http, private backendSrv, private $location, navModelSrv) {
this.navModel = navModelSrv.getOrgNav(3); this.navModel = navModelSrv.getNav('cfg', 'users');
this.get(); this.get();
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
display: block; display: block;
overflow: visible; overflow: visible;
position: relative; position: relative;
margin-left: $side-menu-width;
} }
.navbar-inner { .navbar-inner {
...@@ -10,12 +11,11 @@ ...@@ -10,12 +11,11 @@
padding-right: $spacer; padding-right: $spacer;
background-color: $navbarBackground; background-color: $navbarBackground;
border-bottom: $navbarBorder; border-bottom: $navbarBorder;
margin-left: $side-menu-width;
@include clearfix(); @include clearfix();
} }
.sidemenu-open { .sidemenu-open {
.navbar-inner { .navbar {
margin-left: 0; margin-left: 0;
} }
} }
...@@ -61,46 +61,6 @@ ...@@ -61,46 +61,6 @@
background-color: $navbarLinkBackgroundActive; background-color: $navbarLinkBackgroundActive;
} }
.navbar-brand-btn {
display: block;
margin-bottom: 3rem;
background-color: $side-menu-bg;
padding: 0.4rem 1.0rem 0.4rem 0.65rem;
min-height: $navbarHeight;
.fa-caret-down {
font-size: 70%;
}
&:hover {
background: $navbarButtonBackgroundHighlight;
}
img {
width: 30px;
position: relative;
top: -1px;
}
.navbar-brand-btn-background {
display: inline-block;
border: 1px solid $body-bg;
padding: 4px;
border-radius: 50%;
background: $iconContainerBackground;
width: 40px;
height: 40px;
}
.icon-gf-grafana_wordmark {
font-size: 21px;
position: relative;
top: 6px;
padding-left: 5px;
display: none;
}
}
.navbar-page-btn-wrapper { .navbar-page-btn-wrapper {
float: left; float: left;
&:hover { &:hover {
......
.sidemenu { .sidemenu {
position: fixed; position: fixed;
height: 30px;
display: flex; display: flex;
flex-flow: column; flex-flow: column;
flex-direction: column; flex-direction: column;
width: $side-menu-width; width: $side-menu-width;
background-color: $side-menu-bg; background: $navbarBackground;
z-index: 1; z-index: 1;
a:focus { a:focus {
...@@ -18,6 +14,7 @@ ...@@ -18,6 +14,7 @@
.sidemenu-open { .sidemenu-open {
.sidemenu { .sidemenu {
background: $side-menu-bg;
position: initial; position: initial;
height: auto; height: auto;
} }
...@@ -28,6 +25,7 @@ ...@@ -28,6 +25,7 @@
} }
.sidemenu__top { .sidemenu__top {
padding-top: 3rem;
flex-grow: 1; flex-grow: 1;
display: none; display: none;
} }
...@@ -153,8 +151,6 @@ li.sidemenu-org-switcher { ...@@ -153,8 +151,6 @@ li.sidemenu-org-switcher {
.sidemenu__logo { .sidemenu__logo {
display: block; display: block;
margin-bottom: 3rem;
background-color: $side-menu-bg;
padding: 0.4rem 1.0rem 0.4rem 0.65rem; padding: 0.4rem 1.0rem 0.4rem 0.65rem;
min-height: $navbarHeight; min-height: $navbarHeight;
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
} }
// navbar buttons // navbar buttons
.navbar-brand-btn,
.navbar-inner { .navbar-inner {
border-color: transparent; border-color: transparent;
background: transparent; background: transparent;
...@@ -52,7 +51,7 @@ ...@@ -52,7 +51,7 @@
.navbar-page-btn { .navbar-page-btn {
border-color: transparent; border-color: transparent;
background: transparent; background: transparent;
transform: translate3d(-50px, 0, 0); transform: translate3d(-40px, 0, 0);
transition: all 1.5s ease-in-out 1s; transition: all 1.5s ease-in-out 1s;
.icon-gf { .icon-gf {
opacity: 0; opacity: 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment