Skip to content

Commit 1190fc7

Browse files
ziomeckaKatarzyna Ziomek-Zdanowicz
and
Katarzyna Ziomek-Zdanowicz
authored
8963 Remove edit icons in dashboard row (#71)
Co-authored-by: Katarzyna Ziomek-Zdanowicz <[email protected]>
1 parent 83f5efc commit 1190fc7

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

public/app/features/dashboard/components/DashboardRow/DashboardRow.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import React from 'react';
33
import { Unsubscribable } from 'rxjs';
4+
import {connect} from "react-redux"
45

56
import { selectors } from '@grafana/e2e-selectors';
67
import { getTemplateSrv, RefreshEvent } from '@grafana/runtime';
@@ -11,13 +12,15 @@ import { ShowConfirmModalEvent } from '../../../../types/events';
1112
import { DashboardModel } from '../../state/DashboardModel';
1213
import { PanelModel } from '../../state/PanelModel';
1314
import { RowOptionsButton } from '../RowOptions/RowOptionsButton';
15+
import { StoreState } from 'app/types';
1416

1517
export interface DashboardRowProps {
1618
panel: PanelModel;
1719
dashboard: DashboardModel;
20+
isFnDashboard: boolean
1821
}
1922

20-
export class DashboardRow extends React.Component<DashboardRowProps> {
23+
class Component extends React.Component<DashboardRowProps> {
2124
sub?: Unsubscribable;
2225

2326
componentDidMount() {
@@ -69,10 +72,13 @@ export class DashboardRow extends React.Component<DashboardRowProps> {
6972
'dashboard-row--collapsed': this.props.panel.collapsed,
7073
});
7174

75+
const {isFnDashboard} = this.props
76+
7277
const title = getTemplateSrv().replace(this.props.panel.title, this.props.panel.scopedVars, 'text');
7378
const count = this.props.panel.panels ? this.props.panel.panels.length : 0;
7479
const panels = count === 1 ? 'panel' : 'panels';
75-
const canEdit = this.props.dashboard.meta.canEdit === true;
80+
const canEdit = this.props.dashboard.meta.canEdit === true && !isFnDashboard;
81+
7682

7783
return (
7884
<div className={classes} data-testid="dashboard-row-container">
@@ -110,3 +116,13 @@ export class DashboardRow extends React.Component<DashboardRowProps> {
110116
);
111117
}
112118
}
119+
120+
121+
function mapStateToProps () {
122+
return (state: StoreState) => ({
123+
isFnDashboard: state.fnGlobalState.FNDashboard
124+
});
125+
}
126+
127+
128+
export const DashboardRow = connect(mapStateToProps)(Component);

0 commit comments

Comments
 (0)