fix: add back missing edit button for panels for viewers-can-edit (#110475)
* fix: add back missing edit button for panels for viewers-can-edit * lint fix * updated meta cansave function with config option * cleanup * lint --------- Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
This commit is contained in:
co-authored by
Haris Rozajac
parent
8a7c1f595a
commit
ce70900c73
@@ -681,7 +681,7 @@ export class DashboardScene extends SceneObjectBase<DashboardSceneState> impleme
|
||||
canEditDashboard() {
|
||||
const { meta } = this.state;
|
||||
|
||||
return Boolean(meta.canEdit || meta.canMakeEditable);
|
||||
return Boolean(meta.canEdit || meta.canMakeEditable || config.viewersCanEdit);
|
||||
}
|
||||
|
||||
public getInitialSaveModel() {
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
} from '@grafana/ui';
|
||||
import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate';
|
||||
import { NavToolbarSeparator } from 'app/core/components/AppChrome/NavToolbar/NavToolbarSeparator';
|
||||
import grafanaConfig from 'app/core/config';
|
||||
import { LS_PANEL_COPY_KEY } from 'app/core/constants';
|
||||
import { contextSrv } from 'app/core/core';
|
||||
import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
|
||||
@@ -92,11 +91,6 @@ export function ToolbarActions({ dashboard }: Props) {
|
||||
folderName: meta.folderUid,
|
||||
});
|
||||
|
||||
// Internal only;
|
||||
// allows viewer editing without ability to save
|
||||
// used for grafana play
|
||||
const canEdit = grafanaConfig.viewersCanEdit;
|
||||
|
||||
if (!isEditingPanel) {
|
||||
// This adds the presence indicators in enterprise
|
||||
addDynamicActions(toolbarActions, dynamicDashNavActions.left, 'left-actions');
|
||||
@@ -351,7 +345,7 @@ export function ToolbarActions({ dashboard }: Props) {
|
||||
|
||||
toolbarActions.push({
|
||||
group: 'main-buttons',
|
||||
condition: !isEditing && (dashboard.canEditDashboard() || canEdit) && !isViewingPanel && !isPlaying && editable,
|
||||
condition: !isEditing && dashboard.canEditDashboard() && !isViewingPanel && !isPlaying && editable,
|
||||
render: () => (
|
||||
<Button
|
||||
onClick={() => {
|
||||
|
||||
Reference in New Issue
Block a user