Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
c75e6692
Commit
c75e6692
authored
Jan 28, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide sidemenu links that the user does not have access to
parent
1758412a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
29 deletions
+50
-29
src/app/controllers/grafanaCtrl.js
+2
-4
src/app/controllers/sidemenuCtrl.js
+44
-24
src/app/partials/sidemenu.html
+4
-1
No files found.
src/app/controllers/grafanaCtrl.js
View file @
c75e6692
...
...
@@ -28,6 +28,7 @@ function (angular, config, _, $, store) {
$scope
.
dashAlerts
=
alertSrv
;
$scope
.
grafana
.
style
=
'dark'
;
$scope
.
grafana
.
user
=
{};
if
(
window
.
grafanaBackend
)
{
$scope
.
initBackendFeatures
();
...
...
@@ -36,10 +37,7 @@ function (angular, config, _, $, store) {
$scope
.
initBackendFeatures
=
function
()
{
$scope
.
grafana
.
sidemenu
=
store
.
getBool
(
'grafana.sidemenu'
);
if
(
window
.
grafanaBootData
.
user
.
login
)
{
$scope
.
grafana
.
user
=
window
.
grafanaBootData
.
user
;
}
$scope
.
grafana
.
user
=
window
.
grafanaBootData
.
user
;
$scope
.
onAppEvent
(
'logged-out'
,
function
()
{
$scope
.
grafana
.
sidemenu
=
false
;
...
...
src/app/controllers/sidemenuCtrl.js
View file @
c75e6692
...
...
@@ -15,39 +15,59 @@ function (angular, _, $, config) {
return
config
.
appSubUrl
+
url
;
};
$scope
.
menu
=
[
{
text
:
"Dashbord"
,
href
:
$scope
.
getUrl
(
"/"
),
startsWith
:
config
.
appSubUrl
+
'/dashboard/'
,
icon
:
"fa fa-th-large"
,
links
:
[
{
text
:
'Settings'
,
editview
:
'settings'
,
icon
:
"fa fa-cogs"
},
{
text
:
'Templating'
,
editview
:
'templating'
,
icon
:
"fa fa-cogs"
},
{
text
:
'Annotations'
,
editview
:
'annotations'
,
icon
:
"fa fa-bolt"
},
{
text
:
'Export'
,
href
:
""
,
icon
:
"fa fa-bolt"
},
{
text
:
'JSON'
,
href
:
""
,
icon
:
"fa fa-bolt"
},
]
},
{
$scope
.
menu
=
[];
$scope
.
menu
.
push
({
text
:
"Dashbord"
,
href
:
$scope
.
getUrl
(
"/"
),
startsWith
:
config
.
appSubUrl
+
'/dashboard/'
,
icon
:
"fa fa-th-large"
,
links
:
[
{
text
:
'Settings'
,
editview
:
'settings'
},
{
text
:
'Templating'
,
editview
:
'templating'
},
{
text
:
'Annotations'
,
editview
:
'annotations'
},
{
text
:
'Export'
,
href
:
""
},
{
text
:
'JSON'
,
href
:
""
},
]
});
if
(
$scope
.
grafana
.
user
.
accountRole
===
'Admin'
)
{
$scope
.
menu
.
push
({
text
:
"Account"
,
href
:
$scope
.
getUrl
(
"/account"
),
requireRole
:
"Admin"
,
icon
:
"fa fa-shield"
,
links
:
[
{
text
:
'Info'
,
href
:
$scope
.
getUrl
(
"/account"
),
icon
:
"fa fa-sitemap"
},
{
text
:
'Data sources'
,
href
:
$scope
.
getUrl
(
"/account/datasources"
)
,
icon
:
"fa fa-sitemap"
},
{
text
:
'Users'
,
href
:
$scope
.
getUrl
(
"/account/users"
),
icon
:
"fa fa-users"
},
{
text
:
'API Keys'
,
href
:
$scope
.
getUrl
(
"/account/apikeys"
),
icon
:
"fa fa-key"
},
{
text
:
'Info'
,
href
:
$scope
.
getUrl
(
"/account"
)
},
{
text
:
'Data sources'
,
href
:
$scope
.
getUrl
(
"/account/datasources"
)},
{
text
:
'Users'
,
href
:
$scope
.
getUrl
(
"/account/users"
)
},
{
text
:
'API Keys'
,
href
:
$scope
.
getUrl
(
"/account/apikeys"
)
},
]
},
{
});
}
if
(
$scope
.
grafana
.
user
.
isSignedIn
)
{
$scope
.
menu
.
push
({
text
:
"Profile"
,
href
:
$scope
.
getUrl
(
"/profile"
),
icon
:
"fa fa-user"
,
requireSignedIn
:
true
,
links
:
[
{
text
:
'Info'
,
href
:
$scope
.
getUrl
(
"/profile"
),
icon
:
"fa fa-sitemap"
},
{
text
:
'Info'
,
href
:
$scope
.
getUrl
(
"/profile"
),
icon
:
"fa fa-sitemap"
},
{
text
:
'Password'
,
href
:
""
,
icon
:
"fa fa-lock"
},
]
}
];
});
}
if
(
$scope
.
grafana
.
user
.
isGrafanaAdmin
)
{
$scope
.
menu
.
push
({
text
:
"Admin"
,
href
:
$scope
.
getUrl
(
"/admin/users"
),
icon
:
"fa fa-cube"
,
requireSignedIn
:
true
,
links
:
[
{
text
:
'Settings'
,
href
:
$scope
.
getUrl
(
"/admin/settings"
)},
{
text
:
'Users'
,
href
:
$scope
.
getUrl
(
"/admin/users"
),
icon
:
"fa fa-lock"
},
{
text
:
'Log'
,
href
:
""
,
icon
:
"fa fa-lock"
},
]
});
}
$scope
.
onAppEvent
(
'$routeUpdate'
,
function
()
{
$scope
.
updateState
();
...
...
src/app/partials/sidemenu.html
View file @
c75e6692
<div
ng-controller=
"SideMenuCtrl"
ng-init=
"init()"
>
<ul
class=
"sidemenu"
>
<li
class=
"dropdown"
>
<li
class=
"dropdown"
ng-if=
"grafana.user.isSignedIn"
>
<a
class=
"sidemenu-user pointer"
data-toggle=
"dropdown"
title=
"{{grafana.user.email}}"
>
<span
class=
"gravatar-missing"
>
f
</span>
<img
ng-src=
"{{grafana.user.gravatarUrl}}"
width=
"35"
>
...
...
@@ -11,6 +11,9 @@
<li><a
href=
"{{appSubUrl}}/login?logout"
>
Logout
</a></li>
</ul>
</li>
<li
ng-if=
"!grafana.user.isSignedIn"
>
<a
href=
"login"
class=
"sidemenu-item"
><i
class=
"fa fa-sign-in"
></i>
Sign in
</a>
</li>
<li
ng-repeat-start=
"item in menu"
ng-class=
"{'active': item.active}"
>
<a
href=
"{{item.href}}"
class=
"sidemenu-item"
><i
class=
"{{item.icon}}"
></i>
{{item.text}}
</a>
</li>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment