From 01df53074cbe311590a33995727a53d039a9b1a4 Mon Sep 17 00:00:00 2001 From: Vikrant Gupta <54737045+Vikrant2520@users.noreply.github.com> Date: Wed, 29 Nov 2023 00:02:51 +0530 Subject: [PATCH] fix: [GH-4075]: block action on the view section if the dashboard is locked (#4089) * fix: [GH-4075]: block action on the view section if the dashboard is locked --- .../GridCardLayout/GridCard/FullView/GraphManager.tsx | 3 +++ .../GridCard/FullView/TableRender/CustomCheckBox.tsx | 7 ++++++- .../GridCard/FullView/TableRender/GetLabel.tsx | 2 ++ .../FullView/TableRender/GraphManagerColumns.tsx | 5 ++++- .../GridCard/FullView/TableRender/Label.tsx | 2 ++ .../GridCard/FullView/WidgetFullView.styles.scss | 4 ++++ .../GridCardLayout/GridCard/FullView/index.tsx | 11 ++++++++--- .../GridCardLayout/GridCard/FullView/styles.ts | 7 +++++-- .../GridCardLayout/GridCard/FullView/types.ts | 2 ++ 9 files changed, 36 insertions(+), 7 deletions(-) diff --git a/frontend/src/container/GridCardLayout/GridCard/FullView/GraphManager.tsx b/frontend/src/container/GridCardLayout/GridCard/FullView/GraphManager.tsx index b139af7e0e..956c915496 100644 --- a/frontend/src/container/GridCardLayout/GridCard/FullView/GraphManager.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/FullView/GraphManager.tsx @@ -4,6 +4,7 @@ import { Button, Input } from 'antd'; import { CheckboxChangeEvent } from 'antd/es/checkbox'; import { ResizeTable } from 'components/ResizeTable'; import { useNotifications } from 'hooks/useNotifications'; +import { useDashboard } from 'providers/Dashboard/Dashboard'; import { memo, useCallback, useState } from 'react'; import { getGraphManagerTableColumns } from './TableRender/GraphManagerColumns'; @@ -29,6 +30,7 @@ function GraphManager({ ); const { notifications } = useNotifications(); + const { isDashboardLocked } = useDashboard(); const checkBoxOnChangeHandler = useCallback( (e: CheckboxChangeEvent, index: number): void => { @@ -66,6 +68,7 @@ function GraphManager({ graphVisibilityState: graphsVisibilityStates, labelClickedHandler, yAxisUnit, + isGraphDisabled: isDashboardLocked, }); const filterHandler = useCallback( diff --git a/frontend/src/container/GridCardLayout/GridCard/FullView/TableRender/CustomCheckBox.tsx b/frontend/src/container/GridCardLayout/GridCard/FullView/TableRender/CustomCheckBox.tsx index 922510eaea..280edac867 100644 --- a/frontend/src/container/GridCardLayout/GridCard/FullView/TableRender/CustomCheckBox.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/FullView/TableRender/CustomCheckBox.tsx @@ -9,6 +9,7 @@ function CustomCheckBox({ index, graphVisibilityState = [], checkBoxOnChangeHandler, + disabled = false, }: CheckBoxProps): JSX.Element { const onChangeHandler = (e: CheckboxChangeEvent): void => { checkBoxOnChangeHandler(e, index); @@ -28,7 +29,11 @@ function CustomCheckBox({ }, }} > - + ); } diff --git a/frontend/src/container/GridCardLayout/GridCard/FullView/TableRender/GetLabel.tsx b/frontend/src/container/GridCardLayout/GridCard/FullView/TableRender/GetLabel.tsx index 1cafd49bf5..8e516be9a7 100644 --- a/frontend/src/container/GridCardLayout/GridCard/FullView/TableRender/GetLabel.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/FullView/TableRender/GetLabel.tsx @@ -5,12 +5,14 @@ import Label from './Label'; export const getLabel = ( labelClickedHandler: (labelIndex: number) => void, + disabled?: boolean, ): ColumnType => ({ render: (label: string, record): JSX.Element => (