forked from ddrilling/asb_cloud_front
maket sage0
This commit is contained in:
parent
ef8bca20a4
commit
d4d51941d7
65
package-lock.json
generated
65
package-lock.json
generated
@ -1873,6 +1873,28 @@
|
|||||||
"integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==",
|
"integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@microsoft/signalr": {
|
||||||
|
"version": "5.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-5.0.5.tgz",
|
||||||
|
"integrity": "sha512-1aIr9LfuVHkJA6YHvJ9+V2GPUOlVtH94babg4LmBHk3tO7bI9YDHz3axYsp/GI5MVMqCKg/7BzEorr6zs/w2XA==",
|
||||||
|
"requires": {
|
||||||
|
"abort-controller": "^3.0.0",
|
||||||
|
"eventsource": "^1.0.7",
|
||||||
|
"fetch-cookie": "^0.7.3",
|
||||||
|
"node-fetch": "^2.6.0",
|
||||||
|
"ws": "^6.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ws": {
|
||||||
|
"version": "6.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||||
|
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
||||||
|
"requires": {
|
||||||
|
"async-limiter": "~1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@nodelib/fs.scandir": {
|
"@nodelib/fs.scandir": {
|
||||||
"version": "2.1.4",
|
"version": "2.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz",
|
||||||
@ -2768,6 +2790,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz",
|
||||||
"integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q=="
|
"integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q=="
|
||||||
},
|
},
|
||||||
|
"abort-controller": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||||
|
"requires": {
|
||||||
|
"event-target-shim": "^5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"accepts": {
|
"accepts": {
|
||||||
"version": "1.3.7",
|
"version": "1.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||||
@ -5677,6 +5707,11 @@
|
|||||||
"next-tick": "~1.0.0"
|
"next-tick": "~1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"es6-denodeify": {
|
||||||
|
"version": "0.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/es6-denodeify/-/es6-denodeify-0.1.5.tgz",
|
||||||
|
"integrity": "sha1-MdTV/pxVA+ElRgQ5MQ4WoqPznB8="
|
||||||
|
},
|
||||||
"es6-iterator": {
|
"es6-iterator": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
|
||||||
@ -6338,6 +6373,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
|
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
|
||||||
},
|
},
|
||||||
|
"event-target-shim": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
|
||||||
|
},
|
||||||
"eventemitter3": {
|
"eventemitter3": {
|
||||||
"version": "4.0.7",
|
"version": "4.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||||
@ -6687,6 +6727,26 @@
|
|||||||
"bser": "2.1.1"
|
"bser": "2.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fetch-cookie": {
|
||||||
|
"version": "0.7.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.7.3.tgz",
|
||||||
|
"integrity": "sha512-rZPkLnI8x5V+zYAiz8QonAHsTb4BY+iFowFBI1RFn0zrO343AVp9X7/yUj/9wL6Ef/8fLls8b/vGtzUvmyAUGA==",
|
||||||
|
"requires": {
|
||||||
|
"es6-denodeify": "^0.1.1",
|
||||||
|
"tough-cookie": "^2.3.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tough-cookie": {
|
||||||
|
"version": "2.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||||
|
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||||
|
"requires": {
|
||||||
|
"psl": "^1.1.28",
|
||||||
|
"punycode": "^2.1.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"figgy-pudding": {
|
"figgy-pudding": {
|
||||||
"version": "3.5.2",
|
"version": "3.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz",
|
||||||
@ -10814,6 +10874,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node-fetch": {
|
||||||
|
"version": "2.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||||
|
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||||
|
},
|
||||||
"node-forge": {
|
"node-forge": {
|
||||||
"version": "0.10.0",
|
"version": "0.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@craco/craco": "^6.1.1",
|
"@craco/craco": "^6.1.1",
|
||||||
|
"@microsoft/signalr": "^5.0.5",
|
||||||
"@testing-library/jest-dom": "^5.11.10",
|
"@testing-library/jest-dom": "^5.11.10",
|
||||||
"@testing-library/react": "^11.2.6",
|
"@testing-library/react": "^11.2.6",
|
||||||
"@testing-library/user-event": "^12.8.3",
|
"@testing-library/user-event": "^12.8.3",
|
||||||
|
@ -21,7 +21,7 @@ function PrivateRoute({ children, ...rest }) {
|
|||||||
render={({ location }) =>
|
render={({ location }) =>
|
||||||
token
|
token
|
||||||
? (children)
|
? (children)
|
||||||
: (<Redirect to={{pathname: "/login",state: { from: location }}}/>)
|
: (<Redirect to={{pathname: "/login", state: { from: location }}}/>)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
5
src/context/Context.js
Normal file
5
src/context/Context.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import {createContext} from 'react'
|
||||||
|
|
||||||
|
const Context = createContext()
|
||||||
|
|
||||||
|
export default Context
|
@ -27,7 +27,7 @@ export default function Login() {
|
|||||||
|
|
||||||
const logoIcon = <img src={logo} alt="АСБ" className="logo"/>
|
const logoIcon = <img src={logo} alt="АСБ" className="logo"/>
|
||||||
|
|
||||||
let handleSubmit = async (formData) =>{
|
let handleLogin = async (formData) =>{
|
||||||
setLoader(true)
|
setLoader(true)
|
||||||
try{
|
try{
|
||||||
let user = await login(formData)
|
let user = await login(formData)
|
||||||
@ -44,7 +44,7 @@ export default function Login() {
|
|||||||
return (
|
return (
|
||||||
<div className='login_page shadow'>
|
<div className='login_page shadow'>
|
||||||
<Card title="Система мониторинга" className='shadow' bordered={true} style={{ width: 350 }} extra={logoIcon}>
|
<Card title="Система мониторинга" className='shadow' bordered={true} style={{ width: 350 }} extra={logoIcon}>
|
||||||
<Form onFinish={handleSubmit}>
|
<Form onFinish={handleLogin}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="login"
|
name="login"
|
||||||
rules={[{ required: true, message: 'Пожалуйста введите имя!' }]}>
|
rules={[{ required: true, message: 'Пожалуйста введите имя!' }]}>
|
||||||
|
@ -4,6 +4,7 @@ import logo from '../images/logo_32.png'
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { Switch, Route, Redirect, Link} from "react-router-dom"
|
import { Switch, Route, Redirect, Link} from "react-router-dom"
|
||||||
import Wells from './Wells'
|
import Wells from './Wells'
|
||||||
|
import Well from './Well'
|
||||||
import Files from './Files'
|
import Files from './Files'
|
||||||
|
|
||||||
const { Header, Content, Sider } = Layout
|
const { Header, Content, Sider } = Layout
|
||||||
@ -12,7 +13,7 @@ export default function Main(){
|
|||||||
const [sidebarVisible, setSidebarVisible] = useState(true)
|
const [sidebarVisible, setSidebarVisible] = useState(true)
|
||||||
const login = localStorage['login']
|
const login = localStorage['login']
|
||||||
|
|
||||||
let handlerExit = ()=>{
|
let handleLogout = () => {
|
||||||
localStorage.removeItem('login')
|
localStorage.removeItem('login')
|
||||||
localStorage.removeItem('token')
|
localStorage.removeItem('token')
|
||||||
}
|
}
|
||||||
@ -23,7 +24,7 @@ export default function Main(){
|
|||||||
<Button icon={<MenuOutlined />} onClick={()=>setSidebarVisible(!sidebarVisible)}/>
|
<Button icon={<MenuOutlined />} onClick={()=>setSidebarVisible(!sidebarVisible)}/>
|
||||||
<img src={logo} alt="АСБ" className="logo"/>
|
<img src={logo} alt="АСБ" className="logo"/>
|
||||||
<h1 className="title">Мониторинг</h1>
|
<h1 className="title">Мониторинг</h1>
|
||||||
<Link to="/login" onClick={handlerExit}>
|
<Link to="/login" onClick={handleLogout}>
|
||||||
<Button icon={<UserOutlined/>}>
|
<Button icon={<UserOutlined/>}>
|
||||||
({login}) Выход
|
({login}) Выход
|
||||||
</Button>
|
</Button>
|
||||||
@ -55,7 +56,7 @@ export default function Main(){
|
|||||||
<Files />
|
<Files />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/well/:id">
|
<Route path="/well/:id">
|
||||||
<Wells/>
|
<Well/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/well">
|
<Route path="/well">
|
||||||
<Wells />
|
<Wells />
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
import {useParams} from 'react-router-dom'
|
||||||
|
|
||||||
export default function Well(props){
|
export default function Well(props){
|
||||||
return(<div>Well id: {props.id}</div>)
|
let { id } = useParams();
|
||||||
|
return(<div>Well id: {id}</div>)
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { WellService, OpenAPI } from '../services/api'
|
import { WellService } from '../services/api'
|
||||||
import Loader from '../components/Loader'
|
import Loader from '../components/Loader'
|
||||||
import { Table } from 'antd';
|
import { Table } from 'antd';
|
||||||
import { useHistory } from 'react-router-dom'
|
import { useHistory } from 'react-router-dom'
|
||||||
@ -35,6 +35,7 @@ export default function Wells(props){
|
|||||||
let updateWellsList = async () => {
|
let updateWellsList = async () => {
|
||||||
setLoader(true)
|
setLoader(true)
|
||||||
try{
|
try{
|
||||||
|
|
||||||
setWells( await WellService.get())
|
setWells( await WellService.get())
|
||||||
}
|
}
|
||||||
catch(e){
|
catch(e){
|
||||||
@ -52,7 +53,7 @@ export default function Wells(props){
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
onRow={(record, rowIndex) => {
|
onRow={(record, rowIndex) => {
|
||||||
return {
|
return {
|
||||||
onClick: event => {history.push(`wells/${record.id}`)},
|
onClick: event => {history.push(`well/${record.id}`)},
|
||||||
};
|
};
|
||||||
}}/>
|
}}/>
|
||||||
{loader&&<Loader/>}
|
{loader&&<Loader/>}
|
||||||
|
Loading…
Reference in New Issue
Block a user