From 736bb7f53ad30ff2386680cf984a18c02a168ca4 Mon Sep 17 00:00:00 2001 From: Katarzyna Ziomek-Zdanowicz Date: Thu, 30 Mar 2023 17:14:56 +0200 Subject: [PATCH] 8963 Remove edit icons in dashboard row --- .../components/DashboardRow/DashboardRow.tsx | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard/components/DashboardRow/DashboardRow.tsx b/public/app/features/dashboard/components/DashboardRow/DashboardRow.tsx index 0467ae662d79e..6ede7a2a29d85 100644 --- a/public/app/features/dashboard/components/DashboardRow/DashboardRow.tsx +++ b/public/app/features/dashboard/components/DashboardRow/DashboardRow.tsx @@ -1,6 +1,7 @@ import classNames from 'classnames'; import React from 'react'; import { Unsubscribable } from 'rxjs'; +import {connect} from "react-redux" import { selectors } from '@grafana/e2e-selectors'; import { getTemplateSrv, RefreshEvent } from '@grafana/runtime'; @@ -11,13 +12,15 @@ import { ShowConfirmModalEvent } from '../../../../types/events'; import { DashboardModel } from '../../state/DashboardModel'; import { PanelModel } from '../../state/PanelModel'; import { RowOptionsButton } from '../RowOptions/RowOptionsButton'; +import { StoreState } from 'app/types'; export interface DashboardRowProps { panel: PanelModel; dashboard: DashboardModel; + isFnDashboard: boolean } -export class DashboardRow extends React.Component { + class Component extends React.Component { sub?: Unsubscribable; componentDidMount() { @@ -69,10 +72,13 @@ export class DashboardRow extends React.Component { 'dashboard-row--collapsed': this.props.panel.collapsed, }); + const {isFnDashboard} = this.props + const title = getTemplateSrv().replace(this.props.panel.title, this.props.panel.scopedVars, 'text'); const count = this.props.panel.panels ? this.props.panel.panels.length : 0; const panels = count === 1 ? 'panel' : 'panels'; - const canEdit = this.props.dashboard.meta.canEdit === true; + const canEdit = this.props.dashboard.meta.canEdit === true && !isFnDashboard; + return (
@@ -110,3 +116,13 @@ export class DashboardRow extends React.Component { ); } } + + +function mapStateToProps () { + return (state: StoreState) => ({ + isFnDashboard: state.fnGlobalState.FNDashboard + }); +} + + +export const DashboardRow = connect(mapStateToProps)(Component);