diff --git a/package-lock.json b/package-lock.json index eb6f624..1533101 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10473,8 +10473,7 @@ "dependencies": { "hosted-git-info": { "version": "2.8.8", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", - "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "resolved": "", "dev": true }, "normalize-package-data": { @@ -11657,6 +11656,11 @@ "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" }, + "pigeon-maps": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/pigeon-maps/-/pigeon-maps-0.19.7.tgz", + "integrity": "sha512-8yS5o7lr3mr5674Cfkxrk3EqPiV6WjGBrpVKNn6/40bTdH5qq2NNXK2Iu0fQcDRRZ6mTtXHX0tJAO1tp8ZKBNg==" + }, "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", @@ -11797,9 +11801,9 @@ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" }, "postcss": { - "version": "7.0.35", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.35.tgz", - "integrity": "sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==", + "version": "7.0.36", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.36.tgz", + "integrity": "sha512-BebJSIUMwJHRH0HAQoxN4u1CN86glsrwsW0q7T+/m44eXOUAxSNdHRkNZPYz5vVUbg17hFgOQDE7fZk7li3pZw==", "requires": { "chalk": "^2.4.2", "source-map": "^0.6.1", @@ -14137,9 +14141,9 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" }, "resolve-url-loader": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/resolve-url-loader/-/resolve-url-loader-3.1.2.tgz", - "integrity": "sha512-QEb4A76c8Mi7I3xNKXlRKQSlLBwjUV/ULFMP+G7n3/7tJZ8MG5wsZ3ucxP1Jz8Vevn6fnJsxDx9cIls+utGzPQ==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/resolve-url-loader/-/resolve-url-loader-3.1.4.tgz", + "integrity": "sha512-D3sQ04o0eeQEySLrcz4DsX3saHfsr8/N6tfhblxgZKXxMT2Louargg12oGNfoTRLV09GXhVUe5/qgA5vdgNigg==", "requires": { "adjust-sourcemap-loader": "3.0.0", "camelcase": "5.3.1", @@ -14147,7 +14151,7 @@ "convert-source-map": "1.7.0", "es6-iterator": "2.0.3", "loader-utils": "1.2.3", - "postcss": "7.0.21", + "postcss": "7.0.36", "rework": "1.0.1", "rework-visit": "1.0.0", "source-map": "0.6.1" @@ -14181,28 +14185,10 @@ "json5": "^1.0.1" } }, - "postcss": { - "version": "7.0.21", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.21.tgz", - "integrity": "sha512-uIFtJElxJo29QC753JzhidoAhvp/e/Exezkdhfmt8AymWT6/5B7W1WmponYWkHk2eg6sONyTch0A3nkMPun3SQ==", - "requires": { - "chalk": "^2.4.2", - "source-map": "^0.6.1", - "supports-color": "^6.1.0" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" - }, - "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", - "requires": { - "has-flag": "^3.0.0" - } } } }, @@ -15905,9 +15891,9 @@ } }, "trim-newlines": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.0.tgz", - "integrity": "sha512-C4+gOpvmxaSMKuEf9Qc134F1ZuOHVXKRbtEflf4NTtuuJDEIJ9p5PXsalL8SkeRw+qit1Mo+yuvMPAKwWg/1hA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", "dev": true }, "tryer": { @@ -16862,8 +16848,7 @@ }, "ssri": { "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz", - "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", + "resolved": "", "requires": { "figgy-pudding": "^3.5.1" } @@ -17804,9 +17789,9 @@ } }, "ws": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", - "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==" + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", + "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==" }, "xml-name-validator": { "version": "3.0.0", diff --git a/package.json b/package.json index 5d3a0a0..709c113 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "react_test": "react-scripts test", "eject": "react-scripts eject" }, - "proxy": "http://192.168.1.70:5000", + "proxy": "http://127.0.0.1:5000", "eslintConfig": { "extends": [ "react-app", diff --git a/src/images/las.png b/src/images/las.png new file mode 100644 index 0000000..1348d4b Binary files /dev/null and b/src/images/las.png differ diff --git a/src/images/logoSmaill.svg b/src/images/logoSmall.svg similarity index 100% rename from src/images/logoSmaill.svg rename to src/images/logoSmall.svg diff --git a/src/images/pdf.png b/src/images/pdf.png new file mode 100644 index 0000000..e47094f Binary files /dev/null and b/src/images/pdf.png differ diff --git a/src/images/pointer.svg b/src/images/pointer.svg new file mode 100644 index 0000000..62cc064 --- /dev/null +++ b/src/images/pointer.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/images/xlsx.png b/src/images/xlsx.png new file mode 100644 index 0000000..8e68f30 Binary files /dev/null and b/src/images/xlsx.png differ diff --git a/src/pages/Cluster.jsx b/src/pages/Cluster.jsx new file mode 100644 index 0000000..d8743b3 --- /dev/null +++ b/src/pages/Cluster.jsx @@ -0,0 +1,8 @@ +import {useParams} from "react-router-dom"; + +export default function Cluster() { + + let { id } = useParams() + + return(
Куст {id}
) +} \ No newline at end of file diff --git a/src/pages/Deposit.jsx b/src/pages/Deposit.jsx new file mode 100644 index 0000000..17b7c9c --- /dev/null +++ b/src/pages/Deposit.jsx @@ -0,0 +1,69 @@ +import { Map, Overlay } from "pigeon-maps" +import pointer from '../images/pointer.svg' +import {Link} from "react-router-dom"; +import LoaderPortal from '../components/LoaderPortal' +import { useState, useEffect } from "react"; +import {ClusterService} from '../services/api' + +const calcViewParams = (clusters) => { + if (clusters.length === 0) + return {center:[60.81226, 70.0562], zoom: 5} + + const center = clusters.reduce((sum, cluster) => { + sum[0] += (cluster.latitude / clusters.length) + sum[1] += (cluster.longitude / clusters.length) + return sum + }, [0, 0]) + + const maxDeg = clusters.reduce((max, cluster) => { + const dLatitude = Math.abs(center[0] - cluster.latitude) + const dLongitude = Math.abs(center[1] - cluster.longitude) + const d = dLatitude > dLongitude ? dLatitude : dLongitude + return d > max ? d : max + }, 0) + + return {center, zoom: maxDeg*25} +} + +export default function Deposit() { + const [clustersData, setClustersData] = useState([]) + const [showLoader, setShowLoader] = useState(false) + + const updateClusters = async()=>{ + setShowLoader(true) + try{ + const data = await ClusterService.getClusters() + setClustersData(data) + }catch{ + //ignore + } + setShowLoader(false) + } + + useEffect(()=>{updateClusters()}, []) + + const viewParams = calcViewParams(clustersData) + + return ( + + + {clustersData.map(cluster => + + + + + {cluster.name} + + + )} + + + ); +} diff --git a/src/pages/Main.jsx b/src/pages/Main.jsx index adf515f..cd5246b 100644 --- a/src/pages/Main.jsx +++ b/src/pages/Main.jsx @@ -1,25 +1,31 @@ -import Wells from './Wells' -import Well from "../components/Well"; +import Deposit from './Deposit' +import Cluster from './Cluster' +import Well from "./Well"; import LayoutPortal from './LayoutPortal' import {Redirect, Route, Switch} from "react-router-dom"; export default function Main() { - return ( - - - - - - - - - - - - - - - + return ( + + + + + + + + + + + + + + + + + + + + ) } diff --git a/src/components/Well.jsx b/src/pages/Well.jsx similarity index 88% rename from src/components/Well.jsx rename to src/pages/Well.jsx index 64e6ecc..5dfadd7 100644 --- a/src/components/Well.jsx +++ b/src/pages/Well.jsx @@ -1,12 +1,12 @@ 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"; +import Files from "./Files"; +import Archive from "./Archive"; +import Messages from "./Messages"; +import Report from "./Report"; +import Analysis from "./Analysis"; +import TelemetryView from "./TelemetryView"; const { Content } = Layout diff --git a/src/pages/Wells.jsx b/src/pages/Wells.jsx deleted file mode 100644 index 4bf4e9a..0000000 --- a/src/pages/Wells.jsx +++ /dev/null @@ -1,65 +0,0 @@ -import { useState, useEffect } from 'react' -import { WellService } from '../services/api' -import LoaderPortal from '../components/LoaderPortal' -import { Table } from 'antd' // TreeSelect -import { useHistory } from 'react-router-dom' -import notify from '../components/notify' - -const columns = [ - { - title: 'Месторождение', - dataIndex: 'deposit', - key: 'deposit', - }, - { - title: 'Куст', - dataIndex: 'cluster', - key: 'cluster', - }, - { - title: 'Скважина', - dataIndex: 'caption', - key: 'caption', - }, - { - title: 'Данные', - dataIndex: 'lastData', - key: 'lastData', - }, -]; - -export default function Wells(props){ - const [wells, setWells] = useState([]) - const [loader, setLoader] = useState(false) - const history = useHistory() - - const updateWellsList = async () => { - setLoader(true) - try{ - let newWells = (await WellService.getWells()).map(w =>{return {key:w.id, ...w}}) - console.log(newWells) - setWells( newWells ) - } - catch(e){ - notify('Не удалось загрузить список скважин', 'error') - console.error(`${e}`); - } - setLoader(false) - } - - useEffect(()=>updateWellsList(), []) - - return(<> -

Скважины

- - { - return { - onClick: event => {history.push(`/well/${record.id}/`)}, - }; - }}/> - - ) -} \ No newline at end of file