From 7ea9d8a393855fe50a25071901e9ac8419031270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Fri, 13 Aug 2021 11:37:54 +0500 Subject: [PATCH] cleanup --- src/components/CementFluid.jsx | 0 src/components/Disposition.jsx | 19 ----------- src/components/MessageFilter.jsx | 35 --------------------- src/components/Nnb.jsx | 0 src/components/RigMnemo.jsx | 1 + src/{components => pages}/Documents.jsx | 23 ++++++-------- src/pages/FluidService.jsx | 2 +- src/pages/LastData.jsx | 34 ++------------------ src/pages/Main.jsx | 2 +- src/{components => pages}/MenuDocuments.jsx | 13 ++++---- src/pages/Smbo/EquipmentDetails.jsx | 2 +- src/pages/TelemetryView/index.jsx | 1 - src/pages/Well.jsx | 22 ++++++------- 13 files changed, 33 insertions(+), 121 deletions(-) delete mode 100644 src/components/CementFluid.jsx delete mode 100644 src/components/Disposition.jsx delete mode 100644 src/components/MessageFilter.jsx delete mode 100644 src/components/Nnb.jsx rename src/{components => pages}/Documents.jsx (91%) rename src/{components => pages}/MenuDocuments.jsx (92%) diff --git a/src/components/CementFluid.jsx b/src/components/CementFluid.jsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/Disposition.jsx b/src/components/Disposition.jsx deleted file mode 100644 index b40e30b..0000000 --- a/src/components/Disposition.jsx +++ /dev/null @@ -1,19 +0,0 @@ -let date = new Date().toLocaleString() - - -export default function Disposition() { - return ( - <> -

Распоряжение

- -

- Текст -

- -

Ф.И.О.

-

Должность

-

Компания

-

{date}

- - ) -} \ No newline at end of file diff --git a/src/components/MessageFilter.jsx b/src/components/MessageFilter.jsx deleted file mode 100644 index 7b326d8..0000000 --- a/src/components/MessageFilter.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React, { useMemo, useState } from "react"; - -export default function MessageFilter() { - return ( -
- -
- ) -} - -function List({ words }) { - const [searchString, setSearchString] = useState("") - - function handleChange(e) { - setSearchString(e.target.value) - } - - const filteredWords = useMemo(() => { - if (!searchString) { - return words - } - return words.filter((w) => w.includes(searchString)) - }, [searchString, words]) - - return ( - <> - - - - ) -} \ No newline at end of file diff --git a/src/components/Nnb.jsx b/src/components/Nnb.jsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/RigMnemo.jsx b/src/components/RigMnemo.jsx index 0d7c18e..29f536d 100644 --- a/src/components/RigMnemo.jsx +++ b/src/components/RigMnemo.jsx @@ -8,6 +8,7 @@ const styleCasing = { ...styleBase, fill: "#808080", }; + const styleGround = { ...styleBase, fill: "#deaa87", diff --git a/src/components/Documents.jsx b/src/pages/Documents.jsx similarity index 91% rename from src/components/Documents.jsx rename to src/pages/Documents.jsx index 23bbaad..e4e6602 100644 --- a/src/components/Documents.jsx +++ b/src/pages/Documents.jsx @@ -1,20 +1,17 @@ +import {useState, useEffect} from "react" import {Table, DatePicker, Button, Modal, ConfigProvider} from 'antd' import { UploadOutlined } from '@ant-design/icons' -import DocumentCreationForm from './modalWindows/DocumentCreationForm' -import { FileService } from '../services/api' -import {useState, useEffect} from "react" -import { useParams } from "react-router-dom" -import notify from './notify' -import LoaderPortal from './LoaderPortal' import locale from "antd/lib/locale/ru_RU" import moment from 'moment' +import DocumentCreationForm from '../components/modalWindows/DocumentCreationForm' +import { FileService } from '../services/api' +import notify from '../components/notify' +import LoaderPortal from '../components/LoaderPortal' const pageSize = 12 const {RangePicker} = DatePicker; -export default function Documents({selectedFileCategory}) { - let {id} = useParams() - +export default function Documents({selectedFileCategory, idWell}) { const [page, setPage] = useState(1) const [range, setRange] = useState([]) const [pagination, setPagination] = useState(null) @@ -31,7 +28,7 @@ export default function Documents({selectedFileCategory}) { try { setShowLoader(true) - await fetch(`/api/files/${id}/${row.id}`, { + await fetch(`/api/files/${idWell}/${row.id}`, { headers: { Authorization: 'Bearer ' + localStorage['token'] } @@ -100,7 +97,7 @@ export default function Documents({selectedFileCategory}) { } await FileService.getFilesInfo( - `${id}`, + `${idWell}`, (page - 1) * pageSize, pageSize, selectedFileCategory, @@ -125,12 +122,12 @@ export default function Documents({selectedFileCategory}) { } ) } catch (ex) { - notify(`Не удалось загрузить файлы по скважине "${id}"`, 'error') + notify(`Не удалось загрузить файлы по скважине "${idWell}"`, 'error') console.log(ex) } } GetDocuments() - }, [id, range, page, selectedFileCategory, isTableUpdating]) + }, [idWell, range, page, selectedFileCategory, isTableUpdating]) return (
diff --git a/src/pages/FluidService.jsx b/src/pages/FluidService.jsx index 2022289..d75e422 100644 --- a/src/pages/FluidService.jsx +++ b/src/pages/FluidService.jsx @@ -1,4 +1,4 @@ -import Documents from "../components/Documents" +import Documents from "./Documents" export default function FluidService({selectedFileCategory}) { diff --git a/src/pages/LastData.jsx b/src/pages/LastData.jsx index ded281b..1d8549c 100644 --- a/src/pages/LastData.jsx +++ b/src/pages/LastData.jsx @@ -1,18 +1,14 @@ -import {Button, Modal, Checkbox } from "antd"; +import {Button, Modal } from "antd"; import {DrillingFluid} from "../components/modalWindows/DrillingFluid"; import {useState} from "react"; import {SludgeDiagram} from "../components/modalWindows/MudDiagram"; import {Nnb} from "../components/modalWindows/Nnb" -import Disposition from "../components/Disposition"; - -export default function LastData() { +export default function LastData(/*{idWell}*/) { const [tableVisible, setCementTableVisible] = useState(false) const [tableSludgeVisible, setTableSludgeVisible] = useState(false) const [tableNNBVisible, setTableNNBVisible] = useState(false) - const [dispositionVisible, setDispositionVisible] = useState(false) - //const [loader, setLoader] = useState(false) return ( <> @@ -68,31 +64,5 @@ export default function LastData() { > - - setDispositionVisible(false)} - onCancel={() => setDispositionVisible(false)} - width={850} - okText='Ок' - cancelText='Отмена' - footer={[ - Принять распоряжение, - , - - ]} - > - - ) } \ No newline at end of file diff --git a/src/pages/Main.jsx b/src/pages/Main.jsx index 4fbbac8..970bf77 100644 --- a/src/pages/Main.jsx +++ b/src/pages/Main.jsx @@ -8,7 +8,7 @@ export default function Main() { return ( - + diff --git a/src/components/MenuDocuments.jsx b/src/pages/MenuDocuments.jsx similarity index 92% rename from src/components/MenuDocuments.jsx rename to src/pages/MenuDocuments.jsx index 9c0d825..12380f3 100644 --- a/src/components/MenuDocuments.jsx +++ b/src/pages/MenuDocuments.jsx @@ -1,17 +1,16 @@ +import { useState, useEffect } from "react"; import {Layout, Menu} from "antd"; import {FolderOutlined} from "@ant-design/icons"; -import {Link, Route, Switch, useParams, useLocation} from "react-router-dom"; -import Documents from "../components/Documents"; -import LastData from '../pages/LastData' -import { useState, useEffect } from "react"; +import {Link, Route, Switch, useLocation} from "react-router-dom"; +import Documents from "./Documents"; +import LastData from './LastData' const { Content } = Layout -export default function MenuDocuments() { - let { id } = useParams() +export default function MenuDocuments({idWell}) { let currentPath = useLocation().pathname - const rootPath = `/well/${id}` + const rootPath = `/well/${idWell}` const [selectedElement, setSelectedElement] = useState('fluidService') diff --git a/src/pages/Smbo/EquipmentDetails.jsx b/src/pages/Smbo/EquipmentDetails.jsx index 12a50fa..15421a3 100644 --- a/src/pages/Smbo/EquipmentDetails.jsx +++ b/src/pages/Smbo/EquipmentDetails.jsx @@ -1,5 +1,5 @@ import {Row, Col} from 'antd' -import Documents from '../../components/Documents' +import Documents from '../Documents' import '../../styles/equipment_details.css' export default function EquipmentDetails({id, equipmentTimers, equipmentSensors}) { diff --git a/src/pages/TelemetryView/index.jsx b/src/pages/TelemetryView/index.jsx index 740fb84..5b6b112 100644 --- a/src/pages/TelemetryView/index.jsx +++ b/src/pages/TelemetryView/index.jsx @@ -138,7 +138,6 @@ const defaultChartInterval = '600' export default function TelemetryView({idWell}) { const [saubData, setSaubData] = useState([]) const [chartInterval, setChartInterval] = useState(defaultChartInterval) - const [loader, setLoader] = useState(false) const options = timePeriodCollection.map((line) => ) diff --git a/src/pages/Well.jsx b/src/pages/Well.jsx index b773354..d74f0be 100644 --- a/src/pages/Well.jsx +++ b/src/pages/Well.jsx @@ -1,20 +1,20 @@ import {Layout, Menu} from "antd"; import {FolderOutlined, FundViewOutlined} from "@ant-design/icons"; import {Link, Redirect, Route, Switch, useParams} from "react-router-dom"; -import Archive from "../pages/Archive"; +import TelemetryView from "./TelemetryView"; import Messages from "../pages/Messages"; import Report from "../pages/Report"; +import Archive from "../pages/Archive"; import Analysis from "../pages/Analysis"; import WellAnalysis from "../pages/WellAnalysis"; -import TelemetryView from "./TelemetryView"; -import MenuDocuments from "../components/MenuDocuments"; +import MenuDocuments from "./MenuDocuments"; import WellStat from "./WellStat" import Smbo from "./Smbo" const { Content } = Layout export default function Well() { - let { id: idWell } = useParams() + let { idWell } = useParams() const rootPath = `/well/${idWell}` const {SubMenu} = Menu @@ -86,11 +86,8 @@ export default function Well() { - - - - - + + @@ -101,11 +98,14 @@ export default function Well() { + + + - - + +