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
d1e0e369
Commit
d1e0e369
authored
Dec 15, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: dont show settings for viewers
parent
a8a5f818
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
+9
-4
public/app/features/dashboard/dashboard_model.ts
+2
-0
public/app/features/dashboard/dashnav/dashnav.html
+1
-1
public/app/features/dashboard/settings/settings.ts
+6
-3
No files found.
public/app/features/dashboard/dashboard_model.ts
View file @
d1e0e369
...
@@ -117,6 +117,8 @@ export class DashboardModel {
...
@@ -117,6 +117,8 @@ export class DashboardModel {
meta
.
canSave
=
meta
.
canSave
!==
false
;
meta
.
canSave
=
meta
.
canSave
!==
false
;
meta
.
canStar
=
meta
.
canStar
!==
false
;
meta
.
canStar
=
meta
.
canStar
!==
false
;
meta
.
canEdit
=
meta
.
canEdit
!==
false
;
meta
.
canEdit
=
meta
.
canEdit
!==
false
;
meta
.
showSettings
=
meta
.
canEdit
;
meta
.
canMakeEditable
=
meta
.
canSave
&&
!
this
.
editable
;
if
(
!
this
.
editable
)
{
if
(
!
this
.
editable
)
{
meta
.
canEdit
=
false
;
meta
.
canEdit
=
false
;
...
...
public/app/features/dashboard/dashnav/dashnav.html
View file @
d1e0e369
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<i
class=
"fa fa-link"
></i>
<i
class=
"fa fa-link"
></i>
</button>
</button>
<button
class=
"btn navbar-button navbar-button--settings"
ng-click=
"ctrl.toggleSettings()"
bs-tooltip=
"'Settings'"
data-placement=
"bottom"
>
<button
class=
"btn navbar-button navbar-button--settings"
ng-click=
"ctrl.toggleSettings()"
bs-tooltip=
"'Settings'"
data-placement=
"bottom"
ng-show=
"ctrl.dashboard.meta.showSettings"
>
<i
class=
"fa fa-cog"
></i>
<i
class=
"fa fa-cog"
></i>
</button>
</button>
</div>
</div>
...
...
public/app/features/dashboard/settings/settings.ts
View file @
d1e0e369
...
@@ -35,6 +35,7 @@ export class SettingsCtrl {
...
@@ -35,6 +35,7 @@ export class SettingsCtrl {
buildSectionList
()
{
buildSectionList
()
{
this
.
sections
=
[];
this
.
sections
=
[];
if
(
this
.
dashboard
.
meta
.
canEdit
)
{
if
(
this
.
dashboard
.
meta
.
canEdit
)
{
this
.
sections
.
push
({
title
:
'General'
,
id
:
'settings'
,
icon
:
'gicon gicon-preferences'
});
this
.
sections
.
push
({
title
:
'General'
,
id
:
'settings'
,
icon
:
'gicon gicon-preferences'
});
this
.
sections
.
push
({
title
:
'Annotations'
,
id
:
'annotations'
,
icon
:
'gicon gicon-annotation'
});
this
.
sections
.
push
({
title
:
'Annotations'
,
id
:
'annotations'
,
icon
:
'gicon gicon-annotation'
});
...
@@ -46,9 +47,8 @@ export class SettingsCtrl {
...
@@ -46,9 +47,8 @@ export class SettingsCtrl {
this
.
sections
.
push
({
title
:
'Versions'
,
id
:
'versions'
,
icon
:
'fa fa-fw fa-history'
});
this
.
sections
.
push
({
title
:
'Versions'
,
id
:
'versions'
,
icon
:
'fa fa-fw fa-history'
});
}
}
if
(
contextSrv
.
isEditor
&&
!
this
.
dashboard
.
e
ditable
)
{
if
(
this
.
dashboard
.
meta
.
canMakeE
ditable
)
{
this
.
sections
.
push
({
title
:
'Make Editable'
,
icon
:
'fa fa-fw fa-edit'
,
id
:
'make_editable'
});
this
.
sections
.
push
({
title
:
'Make Editable'
,
icon
:
'fa fa-fw fa-edit'
,
id
:
'make_editable'
});
this
.
viewId
=
'make_editable'
;
}
}
this
.
sections
.
push
({
title
:
'View JSON'
,
id
:
'view_json'
,
icon
:
'gicon gicon-json'
});
this
.
sections
.
push
({
title
:
'View JSON'
,
id
:
'view_json'
,
icon
:
'gicon gicon-json'
});
...
@@ -69,11 +69,14 @@ export class SettingsCtrl {
...
@@ -69,11 +69,14 @@ export class SettingsCtrl {
this
.
json
=
JSON
.
stringify
(
this
.
dashboard
.
getSaveModelClone
(),
null
,
2
);
this
.
json
=
JSON
.
stringify
(
this
.
dashboard
.
getSaveModelClone
(),
null
,
2
);
}
}
if
(
this
.
viewId
===
'settings'
&&
this
.
dashboard
.
meta
.
canMakeEditable
)
{
this
.
viewId
=
'make_editable'
;
}
const
currentSection
=
_
.
find
(
this
.
sections
,
{
id
:
this
.
viewId
});
const
currentSection
=
_
.
find
(
this
.
sections
,
{
id
:
this
.
viewId
});
if
(
!
currentSection
)
{
if
(
!
currentSection
)
{
this
.
sections
.
unshift
({
title
:
'Not found'
,
id
:
'404'
,
icon
:
'fa fa-fw fa-warning'
});
this
.
sections
.
unshift
({
title
:
'Not found'
,
id
:
'404'
,
icon
:
'fa fa-fw fa-warning'
});
this
.
viewId
=
'404'
;
this
.
viewId
=
'404'
;
return
;
}
}
}
}
...
...
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