mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix: dont show settings for viewers
This commit is contained in:
@@ -35,6 +35,7 @@ export class SettingsCtrl {
|
||||
|
||||
buildSectionList() {
|
||||
this.sections = [];
|
||||
|
||||
if (this.dashboard.meta.canEdit) {
|
||||
this.sections.push({ title: 'General', id: 'settings', icon: 'gicon gicon-preferences' });
|
||||
this.sections.push({ title: 'Annotations', id: 'annotations', icon: 'gicon gicon-annotation' });
|
||||
@@ -46,9 +47,8 @@ export class SettingsCtrl {
|
||||
this.sections.push({ title: 'Versions', id: 'versions', icon: 'fa fa-fw fa-history' });
|
||||
}
|
||||
|
||||
if (contextSrv.isEditor && !this.dashboard.editable) {
|
||||
if (this.dashboard.meta.canMakeEditable) {
|
||||
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' });
|
||||
@@ -69,11 +69,14 @@ export class SettingsCtrl {
|
||||
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 });
|
||||
if (!currentSection) {
|
||||
this.sections.unshift({ title: 'Not found', id: '404', icon: 'fa fa-fw fa-warning' });
|
||||
this.viewId = '404';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user