From 374eaaef21cf25f62970f01ce7850bca396b9a17 Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Mon, 7 Feb 2022 15:01:07 +0500 Subject: [PATCH] =?UTF-8?q?*=20=D0=94=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BC=D0=B5=D0=BC=D0=BE=D1=80=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=D0=BE=D0=B2=20*=20=D0=A1=D1=82=D0=B8=D0=BB=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=B8=D0=B5=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Cluster/functions.jsx | 2 +- src/pages/Deposit.jsx | 7 +++--- src/pages/Login.jsx | 10 ++++---- src/pages/Measure/MeasureTable.jsx | 20 ++++++++------- src/pages/Measure/index.jsx | 6 ++--- src/pages/Messages.jsx | 6 ++--- src/pages/Report/ReportCreationNotify.jsx | 25 ++++++++++--------- src/pages/Report/Reports.jsx | 6 ++--- src/pages/Report/index.jsx | 16 ++++++------ src/pages/TelemetryView/SetpointSender.jsx | 2 +- src/pages/TelemetryView/Setpoints.jsx | 12 ++++----- src/pages/WellOperations/ImportOperations.jsx | 9 ++++--- src/pages/WellOperations/WellSectionsStat.jsx | 8 +++--- 13 files changed, 70 insertions(+), 59 deletions(-) diff --git a/src/pages/Cluster/functions.jsx b/src/pages/Cluster/functions.jsx index e92d316..8aba6b7 100644 --- a/src/pages/Cluster/functions.jsx +++ b/src/pages/Cluster/functions.jsx @@ -3,7 +3,7 @@ import { OperationStatService } from '@api' const maxPrefix = 'isMax' const minPrefix = 'isMin' -export const getPrecision = (number) => Number.isNaN(number ?? NaN) ? '-' : number.toFixed(2) +export const getPrecision = (number) => Number.isFinite(number) ? number.toFixed(2) : '-' export const getOperations = async (idWell) => { const ops = await OperationStatService.getTvd(idWell) diff --git a/src/pages/Deposit.jsx b/src/pages/Deposit.jsx index 463438c..f337ed3 100644 --- a/src/pages/Deposit.jsx +++ b/src/pages/Deposit.jsx @@ -3,6 +3,7 @@ import { Link } from 'react-router-dom' import { useState, useEffect, memo } from 'react' import { ClusterService } from '@api' +import { arrayOrDefault } from '@utils' import { PointerIcon } from '@components/icons' import LoaderPortal from '@components/LoaderPortal' import { invokeWebApiWrapperAsync } from '@components/factory' @@ -43,7 +44,7 @@ export const Deposit = memo(() => { useEffect(() => invokeWebApiWrapperAsync( async () => { const data = await ClusterService.getClusters() - setClustersData(data) + setClustersData(arrayOrDefault(data)) setViewParams(calcViewParams(data)) }, setShowLoader, @@ -54,7 +55,7 @@ export const Deposit = memo(() => {
- {clustersData.map(cluster => + {clustersData.map(cluster => ( { {cluster.caption} - )} + ))}
diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx index 09432fe..31e30a8 100644 --- a/src/pages/Login.jsx +++ b/src/pages/Login.jsx @@ -1,20 +1,20 @@ +import { memo, useState } from 'react' +import { Link, useHistory } from 'react-router-dom' import { Card, Form, Input, Button } from 'antd' import { UserOutlined, LockOutlined } from '@ant-design/icons' -import { useState } from 'react' -import { Link, useHistory } from 'react-router-dom' import { AuthService } from '@api' +import { setUser } from '@utils/storage' import LoaderPortal from '@components/LoaderPortal' import { invokeWebApiWrapperAsync } from '@components/factory' import { loginRules, passwordRules } from '@utils/validationRules' -import { setUser } from '@utils/storage' import '@styles/index.css' import logo from '@images/logo_32.png' const logoIcon = {'АСБ'} -export const Login = () => { +export const Login = memo(() => { const history = useHistory() const [showLoader, setShowLoader] = useState(false) @@ -51,6 +51,6 @@ export const Login = () => { ) -} +}) export default Login diff --git a/src/pages/Measure/MeasureTable.jsx b/src/pages/Measure/MeasureTable.jsx index 191afc8..5d31991 100644 --- a/src/pages/Measure/MeasureTable.jsx +++ b/src/pages/Measure/MeasureTable.jsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react' +import { useState, useEffect, memo } from 'react' import { Button, Form, Input, Popconfirm, Timeline } from 'antd' import { CheckSquareOutlined, @@ -9,20 +9,20 @@ import { DeleteOutlined } from '@ant-design/icons' -import LoaderPortal from '../../components/LoaderPortal' -import { MeasureService } from '../../services/api' -import { invokeWebApiWrapperAsync } from '../../components/factory' +import LoaderPortal from '@components/LoaderPortal' +import { invokeWebApiWrapperAsync } from '@components/factory' +import { MeasureService } from '@api' +import { formatDate } from '@utils' import { View } from './View' -import '../../styles/index.css' -import '../../styles/measure.css' -import { formatDate } from '../../utils' +import '@styles/index.css' +import '@styles/measure.css' const createEditingColumns = (cols, renderDelegate) => cols.map(col => ({ render: renderDelegate, ...col })) -export const MeasureTable = ({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) @@ -160,4 +160,6 @@ export const MeasureTable = ({idWell, group, updateMeasuresFunc, additionalButto ) -} +}) + +export default MeasureTable diff --git a/src/pages/Measure/index.jsx b/src/pages/Measure/index.jsx index 06beb48..104b3ad 100644 --- a/src/pages/Measure/index.jsx +++ b/src/pages/Measure/index.jsx @@ -1,5 +1,5 @@ import { Button } from 'antd' -import { useState, useEffect } from 'react' +import { useState, useEffect, memo } from 'react' import { TableOutlined } from '@ant-design/icons' import { MeasureService } from '@api' @@ -41,7 +41,7 @@ const defaultData = [ } ] -export const Measure = ({ idWell }) => { +export const Measure = memo(({ idWell }) => { const [showLoader, setShowLoader] = useState(false) const [isMeasuresUpdating, setIsMeasuresUpdating] = useState(true) const [data, setData] = useState(defaultData) @@ -85,6 +85,6 @@ export const Measure = ({ idWell }) => { /> ) -} +}) export default Measure diff --git a/src/pages/Messages.jsx b/src/pages/Messages.jsx index a3664c5..5e80d6a 100644 --- a/src/pages/Messages.jsx +++ b/src/pages/Messages.jsx @@ -3,8 +3,8 @@ import { useState, useEffect, memo } from 'react' import { Table, Select, DatePicker, Input } from 'antd' import { MessageService } from '@api' -import { invokeWebApiWrapperAsync } from '@components/factory' import LoaderPortal from '@components/LoaderPortal' +import { invokeWebApiWrapperAsync } from '@components/factory' import '@styles/message.css' @@ -103,8 +103,8 @@ export const Messages = memo(({ idWell }) => { return ( <> -
-

Фильтр сообщений

+
+

Фильтр сообщений