diff --git a/public/app/features/dashboard/dashgrid/DashboardRow.tsx b/public/app/features/dashboard/dashgrid/DashboardRow.tsx index 74630ac8f47..378cf4c2c7c 100644 --- a/public/app/features/dashboard/dashgrid/DashboardRow.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardRow.tsx @@ -87,6 +87,7 @@ export class DashboardRow extends React.Component { const title = templateSrv.replaceWithText(this.props.panel.title, this.props.panel.scopedVars); const count = this.props.panel.panels ? this.props.panel.panels.length : 0; const panels = count === 1 ? 'panel' : 'panels'; + const canEdit = this.dashboard.meta.canEdit === true; return (
@@ -97,7 +98,7 @@ export class DashboardRow extends React.Component { ({count} {panels}) - {this.dashboard.meta.canEdit === true && ( + {canEdit && (
@@ -112,7 +113,7 @@ export class DashboardRow extends React.Component {  
)} -
+ {canEdit &&
}
); } diff --git a/public/app/features/dashboard/specs/DashboardRow.test.tsx b/public/app/features/dashboard/specs/DashboardRow.test.tsx index 8424346b0c5..3d89c22f962 100644 --- a/public/app/features/dashboard/specs/DashboardRow.test.tsx +++ b/public/app/features/dashboard/specs/DashboardRow.test.tsx @@ -39,6 +39,12 @@ describe('DashboardRow', () => { expect(wrapper.find('.dashboard-row__actions .pointer')).toHaveLength(2); }); + it('should not show row drag handle when cannot edit', () => { + dashboardMock.meta.canEdit = false; + wrapper = shallow(); + expect(wrapper.find('.dashboard-row__drag')).toHaveLength(0); + }); + it('should have zero actions when cannot edit', () => { dashboardMock.meta.canEdit = false; panel = new PanelModel({ collapsed: false });