This commit is contained in:
KharchenkoVV 2021-05-25 14:22:15 +05:00
commit a48ac64b85
8 changed files with 21385 additions and 132 deletions

4
.gitignore vendored
View File

@ -21,3 +21,7 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# .idea
.idea
.idea/*

21311
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,72 @@
import {Layout, Menu} from "antd";
import {FolderOutlined, FundViewOutlined} from "@ant-design/icons";
import {Link, Redirect, Route, Switch, useParams} from "react-router-dom";
import Files from "../pages/Files";
import Archive from "../pages/Archive";
import Messages from "../pages/Messages";
import Report from "../pages/Report";
import Analysis from "../pages/Analysis";
import TelemetryView from "../pages/TelemetryView";
const { Content } = Layout
export const Well = (props) => {
export default function Well() {
let { id } = useParams()
return(<div></div>)
return (<>
<Layout>
<Menu
mode="horizontal"
selectable={false}
style={{height: '100%', borderRight: 0}}
>
<Menu.Item key="1" icon={<FundViewOutlined/>}>
<Link to='telemetry'>Мониторинг</Link>
</Menu.Item>
<Menu.Item key="2" icon={<FolderOutlined/>}>
<Link to='message'>Сообщения</Link>
</Menu.Item>
<Menu.Item key="3" icon={<FolderOutlined/>}>
<Link to='report'>Рапорт</Link>
</Menu.Item>
<Menu.Item key="4" icon={<FolderOutlined/>}>
<Link to='analysis'>Анализ</Link>
</Menu.Item>
<Menu.Item key="5" icon={<FolderOutlined/>}>
<Link to='file'>Файлы</Link>
</Menu.Item>
<Menu.Item key="6" icon={<FolderOutlined/>}>
<Link to='archive'>Архив</Link>
</Menu.Item>
</Menu>
<Layout>
<Content className="site-layout-background sheet">
<Switch>
<Route path="/well/:id/file">
<Files/>
</Route>
<Route path="/well/:id/archive">
<Archive/>
</Route>
<Route path="/well/:id/message">
<Messages/>
</Route>
<Route path="/well/:id/report">
<Report/>
</Route>
<Route path="/well/:id/analysis">
<Analysis/>
</Route>
<Route path="/well/:id/telemetry">
<TelemetryView/>
</Route>
<Route path="/">
<Redirect to={{pathname: `/well/${id}/telemetry`}}/>
</Route>
</Switch>
</Content>
</Layout>
</Layout>
</>)
}

View File

@ -57,7 +57,7 @@ export default function WellTreeSelector(props) {
const onSelect = (value) => {
if (value)
history.push(`/well/${value}`);
history.push(`/well/${value}/`);
console.log(value)
}

View File

@ -1,92 +1,33 @@
import { Layout, Menu, } from 'antd' // Button,
import { FundViewOutlined, FolderOutlined } from '@ant-design/icons' // UserOutlined, MenuOutlined,
import { useState } from 'react'
import { Switch, Route, Redirect, Link} from "react-router-dom"
import { Layout, } from 'antd'
import Wells from './Wells'
import TelemetryView from './TelemetryView'
import Files from './Files'
import Archive from './Archive'
import Messages from './Messages'
import Report from './Report'
import Analysis from './Analysis'
import PageHeader from './Header'
import Well from "../components/Well";
import {Redirect, Route, Switch} from "react-router-dom";
const { Content, Sider } = Layout
const { Content } = Layout
export default function Main(){
const [sidebarVisible] = useState(true) // setSidebarVisible
// const login = localStorage['login']
// let handleLogout = () => {
// localStorage.removeItem('login')
// localStorage.removeItem('token')
// }
return(
<Layout>
<Content>
<PageHeader />
<Layout>
{sidebarVisible &&
<Sider width={200} className="site-layout-background">
<Menu
mode="inline"
defaultSelectedKeys={['1']}
defaultOpenKeys={['sub1']}
style={{ height: '100%', borderRight: 0 }}
>
<Menu.Item key="1" icon= {<FundViewOutlined />}>
<Link to="/well">Мониторинг</Link>
</Menu.Item>
<Menu.Item key="2" icon= {<FolderOutlined />}>
<Link to="/archive">Архив</Link>
</Menu.Item>
<Menu.Item key="3" icon= {<FolderOutlined />}>
<Link to="/messages">Сообщения</Link>
</Menu.Item>
<Menu.Item key="4" icon= {<FolderOutlined />}>
<Link to="/report">Рапорт</Link>
</Menu.Item>
<Menu.Item key="5" icon= {<FolderOutlined />}>
<Link to="/analysis">Анализ</Link>
</Menu.Item>
<Menu.Item key="6" icon= {<FolderOutlined />}>
<Link to="/file">Файлы</Link>
</Menu.Item>
</Menu>
</Sider>
}
<Layout>
<Content className="site-layout-background sheet">
<Content className="site-layout-background sheet"
style={{ marginTop: '0',
paddingTop: '0'}}>
<Switch>
<Route path="/file">
<Files />
</Route>
<Route path="/archive">
<Archive />
</Route>
<Route path="/well/:id/messages">
<Messages />
</Route>
<Route path="/report">
<Report />
</Route>
<Route path="/analysis">
<Analysis />
</Route>
<Route path="/well/:id">
<TelemetryView/>
<Route path="/well/:id/">
<Well/>
</Route>
<Route path="/well">
<Wells/>
</Route>
<Route path="/">
<Redirect to={{pathname: "/well"}}/>
<Redirect to={{pathname: `/well`}}/>
</Route>
</Switch>
</Content>
</Layout>
</Layout>
</Layout>
</Content>
);
}

View File

@ -53,12 +53,6 @@ export default function Messages(props) {
const [messages, setMessages] = useState([])
const [loader] = useState(false)
// const handleMessages = (messages) => {
// if (messages) {
// messages.map(m => { return { key: m.id, ...m } })
// }
// }
const handleReceiveMessages = (messages) => {
if (messages) {
setMessages(messages.items)
@ -75,21 +69,6 @@ export default function Messages(props) {
}
}, [id]);
// let updateMessagesTable = async () => {
// setLoader(true)
// try {
// let newMessages = await MessageService.getMessage(1, 0, 32, [], '2020-01-01T00:00:00', '2025-01-01T00:00:00')
// setMessages(newMessages.items)
// } catch (e) {
// console.error(`${e.message}`);
// }
// setLoader(false)
// }
// useEffect(() => {
// updateMessagesTable()
// }, [])
return (
<>
<h2>Сообщения</h2>

View File

@ -160,7 +160,7 @@ export default function TelemetryView(props) {
const handleReceiveMessages = (messages) => {
if (messages) {
setMessages(messages.items.splice(0, 3))
setMessages(messages.items.splice(0, 4))
}
}

View File

@ -59,7 +59,7 @@ const groupBy = (table, ...keys) => {
export default function Wells(props){
const [wells, setWells] = useState([])
const [wellsTree, setWellsTree] = useState([]) // wellsTree,
const [setWellsTree] = useState([]) // wellsTree,
const [loader, setLoader] = useState(false)
const history = useHistory()
@ -87,7 +87,7 @@ export default function Wells(props){
columns={columns}
onRow={(record) => {
return {
onClick: event => {history.push(`well/${record.id}`)},
onClick: event => {history.push(`/well/${record.id}/`)},
};
}}/>
{loader&&<Loader/>}