2022-06-09 17:51:41 +05:00
|
|
|
import { BrowserRouter as Router, Navigate, Route, Routes } from 'react-router-dom'
|
2022-10-13 14:00:17 +05:00
|
|
|
import { lazy, memo, Suspense } from 'react'
|
2022-01-12 20:49:30 +05:00
|
|
|
import locale from 'antd/lib/locale/ru_RU'
|
2022-10-13 14:00:17 +05:00
|
|
|
import { ConfigProvider } from 'antd'
|
2022-01-12 20:49:30 +05:00
|
|
|
|
2022-06-09 17:51:41 +05:00
|
|
|
import { RootPathContext } from '@asb/context'
|
2022-10-13 14:00:17 +05:00
|
|
|
import { UserOutlet } from '@components/outlets'
|
|
|
|
import SuspenseFallback from '@components/SuspenseFallback'
|
2022-06-09 17:51:41 +05:00
|
|
|
import { getUserToken, NoAccessComponent } from '@utils'
|
2022-04-29 18:38:49 +05:00
|
|
|
import { OpenAPI } from '@api'
|
2021-03-31 15:54:02 +05:00
|
|
|
|
2022-10-13 16:35:19 +05:00
|
|
|
import '@styles/include/antd_theme.less'
|
|
|
|
import '@styles/App.less'
|
2022-01-12 20:49:30 +05:00
|
|
|
|
2022-10-13 14:00:17 +05:00
|
|
|
const Login = lazy(() => import('@pages/public/Login'))
|
|
|
|
const Register = lazy(() => import('@pages/public/Register'))
|
|
|
|
const FileDownload = lazy(() => import('@pages/FileDownload'))
|
|
|
|
|
|
|
|
const AdminPanel = lazy(() => import('@pages/AdminPanel'))
|
|
|
|
const Deposit = lazy(() => import('@pages/Deposit'))
|
|
|
|
const Cluster = lazy(() => import('@pages/Cluster'))
|
|
|
|
const Well = lazy(() => import('@pages/Well'))
|
|
|
|
|
2022-10-13 16:35:19 +05:00
|
|
|
const Measure = lazy(() => import('@pages/Measure'))
|
|
|
|
const Reports = lazy(() => import('@pages/Reports'))
|
|
|
|
const WellCase = lazy(() => import('@pages/WellCase'))
|
|
|
|
const Analytics = lazy(() => import('@pages/Analytics'))
|
|
|
|
const Documents = lazy(() => import('@pages/Documents'))
|
|
|
|
const Telemetry = lazy(() => import('@pages/Telemetry'))
|
|
|
|
const WellOperations = lazy(() => import('@pages/WellOperations'))
|
|
|
|
const DrillingProgram = lazy(() => import('@pages/DrillingProgram'))
|
|
|
|
|
|
|
|
const Tvd = lazy(() => import('@pages/WellOperations/Tvd'))
|
|
|
|
const WellDrillParams = lazy(() => import('@pages/WellOperations/WellDrillParams'))
|
|
|
|
const DrillProcessFlow = lazy(() => import('@pages/WellOperations/DrillProcessFlow'))
|
|
|
|
const WellSectionsStat = lazy(() => import('@pages/WellOperations/WellSectionsStat'))
|
|
|
|
const WellOperationsEditorFact = lazy(() => import('@pages/WellOperations/OperationEditor/Fact'))
|
|
|
|
const WellOperationsEditorPlan = lazy(() => import('@pages/WellOperations/OperationEditor/Plan'))
|
|
|
|
|
|
|
|
const Archive = lazy(() => import('@pages/Telemetry/Archive'))
|
|
|
|
const Messages = lazy(() => import('@pages/Telemetry/Messages'))
|
|
|
|
const Operations = lazy(() => import('@pages/Telemetry/Operations'))
|
|
|
|
const DashboardNNB = lazy(() => import('@pages/Telemetry/DashboardNNB'))
|
|
|
|
const TelemetryView = lazy(() => import('@pages/Telemetry/TelemetryView'))
|
|
|
|
const OperationTime = lazy(() => import('@pages/Telemetry/OperationTime'))
|
|
|
|
|
|
|
|
const DailyReport = lazy(() => import('@pages/Reports/DailyReport'))
|
|
|
|
const DiagramReport = lazy(() => import('@pages/Reports/DiagramReport'))
|
|
|
|
|
|
|
|
const Statistics = lazy(() => import('@pages/Analytics/Statistics'))
|
|
|
|
const WellCompositeEditor = lazy(() => import('@pages/Analytics/WellCompositeEditor'))
|
2022-01-12 20:49:30 +05:00
|
|
|
|
2021-07-26 14:40:35 +05:00
|
|
|
//OpenAPI.BASE = 'http://localhost:3000'
|
2022-04-29 18:38:49 +05:00
|
|
|
OpenAPI.TOKEN = async () => getUserToken() ?? ''
|
2022-10-13 14:00:17 +05:00
|
|
|
OpenAPI.HEADERS = { 'Content-Type': 'application/json' }
|
2021-04-02 17:22:34 +05:00
|
|
|
|
2022-02-25 16:57:08 +05:00
|
|
|
export const App = memo(() => (
|
2021-08-17 13:01:13 +05:00
|
|
|
<ConfigProvider locale={locale}>
|
2022-06-09 17:51:41 +05:00
|
|
|
<RootPathContext.Provider value={''}>
|
2022-10-13 14:00:17 +05:00
|
|
|
<Suspense fallback={<SuspenseFallback style={{ minHeight: '100vh' }} />}>
|
|
|
|
<Router>
|
|
|
|
<Routes>
|
|
|
|
<Route index element={<Navigate to={'deposit'} replace />} />
|
|
|
|
<Route path={'*'} element={<NoAccessComponent />} />
|
|
|
|
|
|
|
|
{/* Public pages */}
|
|
|
|
<Route path={'/login'} element={<Login />} />
|
|
|
|
<Route path={'/register'} element={<Register />} />
|
|
|
|
|
|
|
|
{/* User pages */}
|
|
|
|
<Route element={<UserOutlet />}>
|
|
|
|
{/* Admin pages */}
|
|
|
|
<Route path={'/admin/*'} element={<AdminPanel />} />
|
|
|
|
|
|
|
|
{/* Client pages */}
|
|
|
|
<Route path={'/file_download/:idWell/:idFile/*'} element={<FileDownload />} />
|
|
|
|
<Route path={'/deposit/*'} element={<Deposit />} />
|
|
|
|
<Route path={'/cluster/:idCluster'} element={<Cluster />} />
|
2022-10-13 16:35:19 +05:00
|
|
|
<Route path={'/well/:idWell/*'} element={<Well />}>
|
|
|
|
<Route index element={<Navigate to={'telemetry'} replace />} />
|
|
|
|
<Route path={'*'} element={<NoAccessComponent />} />
|
|
|
|
|
|
|
|
<Route path={'telemetry/*'} element={<Telemetry />}>
|
|
|
|
<Route index element={<Navigate to={'telemetry'} replace />} />
|
|
|
|
<Route path={'*'} element={<NoAccessComponent />} />
|
|
|
|
|
|
|
|
<Route path={'telemetry'} element={<TelemetryView />} />
|
|
|
|
<Route path={'messages'} element={<Messages />} />
|
|
|
|
<Route path={'archive'} element={<Archive />} />
|
|
|
|
<Route path={'dashboard_nnb'} element={<DashboardNNB />} />
|
|
|
|
<Route path={'operations'} element={<Operations />} />
|
|
|
|
<Route path={'operation_time'} element={<OperationTime />} />
|
|
|
|
</Route>
|
|
|
|
<Route path={'reports/*'} element={<Reports />}>
|
|
|
|
<Route index element={<Navigate to={'diagram_report'} replace />} />
|
|
|
|
<Route path={'*'} element={<NoAccessComponent />} />
|
|
|
|
|
|
|
|
<Route path={'diagram_report'} element={<DiagramReport />} />
|
|
|
|
<Route path={'daily_report'} element={<DailyReport />} />
|
|
|
|
</Route>
|
|
|
|
<Route path={'analytics/*'} element={<Analytics />}>
|
|
|
|
<Route index element={<Navigate to={'composite'} replace />} />
|
|
|
|
<Route path={'*'} element={<NoAccessComponent />} />
|
|
|
|
|
|
|
|
<Route path={'composite/*'} element={<WellCompositeEditor />} />
|
|
|
|
<Route path={'statistics'} element={<Statistics />} />
|
|
|
|
</Route>
|
|
|
|
<Route path={'operations/*'} element={<WellOperations />}>
|
|
|
|
<Route index element={<Navigate to={'tvd'} replace />} />
|
|
|
|
<Route path={'*'} element={<NoAccessComponent />} />
|
|
|
|
|
|
|
|
<Route path={'tvd'} element={<Tvd />} />
|
|
|
|
<Route path={'sections'} element={<WellSectionsStat />} />
|
|
|
|
<Route path={'plan'} element={<WellOperationsEditorPlan />} />
|
|
|
|
<Route path={'fact'} element={<WellOperationsEditorFact />} />
|
|
|
|
<Route path={'drillProcessFlow'} element={<DrillProcessFlow />} />
|
|
|
|
<Route path={'params'} element={<WellDrillParams />} />
|
|
|
|
</Route>
|
|
|
|
<Route path={'document/*'} element={<Documents />} />
|
|
|
|
<Route path={'measure/*'} element={<Measure />} />
|
|
|
|
<Route path={'drillingProgram'} element={<DrillingProgram />} />
|
|
|
|
<Route path={'well_case'} element={<WellCase />} />
|
|
|
|
</Route>
|
2022-10-13 14:00:17 +05:00
|
|
|
</Route>
|
|
|
|
</Routes>
|
|
|
|
</Router>
|
|
|
|
</Suspense>
|
2022-06-09 17:51:41 +05:00
|
|
|
</RootPathContext.Provider>
|
2021-08-17 13:01:13 +05:00
|
|
|
</ConfigProvider>
|
2022-02-25 16:57:08 +05:00
|
|
|
))
|
2022-01-12 20:49:30 +05:00
|
|
|
|
|
|
|
export default App
|