From 437746a5d591069f8ea27295dcfd7b2120e966cc Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Tue, 8 Feb 2022 19:19:00 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D1=80=D0=B0=D0=B2=20=D0=B4=D0=BB=D1=8F=20=D0=B8?= =?UTF-8?q?=D0=BC=D0=BF=D0=BE=D1=80=D1=82=D0=B0,=20=D0=B8=D0=B7=D0=BC?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=B8=20=D0=B0=D0=BD?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D1=82=D0=B8=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Measure/MeasureTable.jsx | 15 +++++++++------ src/pages/WellOperations/ImportExportBar.jsx | 3 ++- .../WellCompositeEditor/WellCompositeSections.jsx | 3 ++- .../WellOperations/WellCompositeEditor/index.jsx | 2 ++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/pages/Measure/MeasureTable.jsx b/src/pages/Measure/MeasureTable.jsx index 997d456..2cdf50a 100644 --- a/src/pages/Measure/MeasureTable.jsx +++ b/src/pages/Measure/MeasureTable.jsx @@ -18,11 +18,12 @@ import { View } from './View' import '@styles/index.css' import '@styles/measure.css' +import { hasPermission } from '@asb/utils/permissions' const createEditingColumns = (cols, renderDelegate) => cols.map(col => ({ render: renderDelegate, ...col })) -export const MeasureTable = memo(({idWell, group, updateMeasuresFunc, additionalButtons}) => { +export const MeasureTable = memo(({ idWell, group, updateMeasuresFunc, additionalButtons }) => { const [showLoader, setShowLoader] = useState(false) const [displayedValues, setDisplayedValues] = useState({}) const [editingColumns, setEditingColumns] = useState(group.columns) @@ -64,7 +65,9 @@ export const MeasureTable = memo(({idWell, group, updateMeasuresFunc, additional 'Удаление записи для скважины' ) - const isDataDefault = () => !!displayedValues?.isDefaultData + const disabled = !hasPermission('Measure.edit') + const editingDisabled = disabled || !!displayedValues?.isDefaultData + const deleteDisabled = !hasPermission('Measure.delete') || !!displayedValues?.isDefaultData const editTable = (action) => { setEditingActionName(action) @@ -116,14 +119,14 @@ export const MeasureTable = memo(({idWell, group, updateMeasuresFunc, additional ) : ( <> - - - - diff --git a/src/pages/WellOperations/ImportExportBar.jsx b/src/pages/WellOperations/ImportExportBar.jsx index 6dd3481..9e5f846 100644 --- a/src/pages/WellOperations/ImportExportBar.jsx +++ b/src/pages/WellOperations/ImportExportBar.jsx @@ -3,6 +3,7 @@ import { Button, Tooltip, Modal } from 'antd' import { FileOutlined, ImportOutlined, ExportOutlined } from '@ant-design/icons' import { download } from '@components/factory' +import { hasPermission } from '@utils/permissions' import { ImportOperations } from './ImportOperations' @@ -23,7 +24,7 @@ export const ImportExportBar = memo(({ idWell, onImported, disabled }) => { <>