From 9e789e6d82520a6f4e7ec1b26c8d731d7cc508b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 25 Feb 2015 14:27:34 +0100 Subject: [PATCH] More work on organization / admin nav, views, #1506 --- pkg/api/api.go | 10 +-- src/app/controllers/sidemenuCtrl.js | 35 ++++++++-- .../features/org/partials/datasourceEdit.html | 6 +- .../features/org/partials/datasources.html | 2 +- src/app/partials/sidemenu.html | 64 +++++++++++-------- src/css/less/sidemenu.less | 17 ++--- 6 files changed, 84 insertions(+), 50 deletions(-) diff --git a/pkg/api/api.go b/pkg/api/api.go index 2d42377ed60..f704ed3eb98 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -25,11 +25,11 @@ func Register(r *macaron.Macaron) { // authed views r.Get("/profile/", reqSignedIn, Index) - r.Get("/account/", reqSignedIn, Index) - r.Get("/account/datasources/", reqSignedIn, Index) - r.Get("/account/users/", reqSignedIn, Index) - r.Get("/account/apikeys/", reqSignedIn, Index) - r.Get("/account/import/", reqSignedIn, Index) + r.Get("/org/", reqSignedIn, Index) + r.Get("/datasources/", reqSignedIn, Index) + r.Get("/org/users/", reqSignedIn, Index) + r.Get("/org/apikeys/", reqSignedIn, Index) + r.Get("/dashboard/import/", reqSignedIn, Index) r.Get("/admin/settings", reqGrafanaAdmin, Index) r.Get("/admin/users", reqGrafanaAdmin, Index) r.Get("/admin/users/create", reqGrafanaAdmin, Index) diff --git a/src/app/controllers/sidemenuCtrl.js b/src/app/controllers/sidemenuCtrl.js index e962a35af35..5e80e819ac1 100644 --- a/src/app/controllers/sidemenuCtrl.js +++ b/src/app/controllers/sidemenuCtrl.js @@ -15,23 +15,48 @@ function (angular, _, $, config) { return config.appSubUrl + url; }; - $scope.menu = []; - $scope.menu.push({ + $scope.mainLinks = []; + $scope.mainLinks.push({ text: "Dashboards", icon: "fa fa-fw fa-th-large", href: $scope.getUrl("/"), }); if (contextSrv.hasRole('Admin')) { - $scope.menu.push({ + $scope.mainLinks.push({ text: "Data Sources", icon: "fa fa-fw fa-database", href: $scope.getUrl("/datasources"), }); - $scope.menu.push({ - text: "Organization", href: $scope.getUrl("/org"), + } + + $scope.bottomLinks = []; + if (contextSrv.user.isSignedIn) { + $scope.bottomLinks.push({ + text: contextSrv.user.name, + imgSrc: contextSrv.user.gravatarUrl, + href: $scope.getUrl("/profile"), + }); + + $scope.bottomLinks.push({ + text: contextSrv.user.orgName, + href: $scope.getUrl("/org"), icon: "fa fa-fw fa-users", }); + + if (contextSrv.hasRole('Admin')) { + $scope.bottomLinks.push({ + text: "System admin", + icon: "fa fa-fw fa-cog", + href: $scope.getUrl("/admin/settings"), + }); + } + + $scope.bottomLinks.push({ + text: "Sign out", + icon: "fa fa-fw fa-sign-out", + href: $scope.getUrl("/logout"), + }); } $scope.updateState = function() { diff --git a/src/app/features/org/partials/datasourceEdit.html b/src/app/features/org/partials/datasourceEdit.html index 741b8c47579..d744cdbca10 100644 --- a/src/app/features/org/partials/datasourceEdit.html +++ b/src/app/features/org/partials/datasourceEdit.html @@ -1,8 +1,8 @@ diff --git a/src/app/features/org/partials/datasources.html b/src/app/features/org/partials/datasources.html index 6a41ed03136..a2e62673e70 100644 --- a/src/app/features/org/partials/datasources.html +++ b/src/app/features/org/partials/datasources.html @@ -35,7 +35,7 @@ - + Edit diff --git a/src/app/partials/sidemenu.html b/src/app/partials/sidemenu.html index f7efd3dcf28..c51497a2161 100644 --- a/src/app/partials/sidemenu.html +++ b/src/app/partials/sidemenu.html @@ -2,14 +2,14 @@
-
diff --git a/src/css/less/sidemenu.less b/src/css/less/sidemenu.less index 7e0c9ab7d1d..e73e52233c1 100644 --- a/src/css/less/sidemenu.less +++ b/src/css/less/sidemenu.less @@ -43,7 +43,7 @@ padding: 0; li { - margin-bottom: 7px; + margin-bottom: 9px; } &.sidemenu-small { @@ -54,7 +54,7 @@ height: 28px; i { top: 1px; - left: 6px; + left: 4px; font-size: 110%; } } @@ -62,6 +62,7 @@ .sidemenu-item { color: @textColor; line-height: 28px; + padding-left: 25px; } } } @@ -76,13 +77,7 @@ text-overflow: ellipsis; white-space: nowrap; } - img { - border-radius: 50%; - width: 28px; - height: 28px; - box-shadow: 0 0 14px 2px rgba(255,255,255, 0.05); } -} .sidemenu-top-btn { display: block; @@ -135,6 +130,12 @@ padding-left: 59px; } } + img { + border-radius: 50%; + width: 28px; + height: 28px; + box-shadow: 0 0 14px 2px rgba(255,255,255, 0.05); + } }