forked from ddrilling/asb_cloud_front
* Исправлено использование DrillFlowChart
* Добавлен переход на страницу входа для неавторизированных пользователей (вместо AccessDenied) * Исправлено отображение ссылок в UserMenu
This commit is contained in:
parent
ddecbadfc6
commit
81961a92d0
@ -33,14 +33,14 @@ export const UserMenu = memo<UserMenuProps>(({ isAdmin, ...other }) => {
|
|||||||
{...other}
|
{...other}
|
||||||
placement={'bottomRight'}
|
placement={'bottomRight'}
|
||||||
overlay={(
|
overlay={(
|
||||||
<PrivateMenu style={{ textAlign: 'right' }}>
|
<PrivateMenu mode={'vertical'} style={{ textAlign: 'right' }}>
|
||||||
{isAdmin ? (
|
{isAdmin ? (
|
||||||
<PrivateMenu.Link visible key={'/'} path={'/'} title={'Вернуться на сайт'} />
|
<PrivateMenu.Link visible key={'/'} path={'/'} title={'Вернуться на сайт'} />
|
||||||
) : (
|
) : (
|
||||||
<PrivateMenu.Link key={'admin'} path={'/admin'} title={'Панель администратора'} content={AdminPanel}/>
|
<PrivateMenu.Link path={'/admin'} content={AdminPanel} />
|
||||||
)}
|
)}
|
||||||
<PrivateMenu.Link visible onClick={onChangePasswordClick} title={'Сменить пароль'} />
|
<PrivateMenu.Link visible key={'change_password'} onClick={onChangePasswordClick} title={'Сменить пароль'} />
|
||||||
<PrivateMenu.Link visible path={'/login'} onClick={removeUser} title={'Выход'} />
|
<PrivateMenu.Link visible key={'login'} path={'/login'} onClick={removeUser} title={'Выход'} />
|
||||||
</PrivateMenu>
|
</PrivateMenu>
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
@ -333,7 +333,7 @@ const TelemetryView = memo(() => {
|
|||||||
)
|
)
|
||||||
invokeWebApiWrapperAsync(
|
invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
const flowChart = await DrillFlowChartService.get(idWell)
|
const flowChart = await DrillFlowChartService.getByIdWell(idWell)
|
||||||
const dataSaub = await TelemetryDataSaubService.getData(idWell, null, chartInterval)
|
const dataSaub = await TelemetryDataSaubService.getData(idWell, null, chartInterval)
|
||||||
const dataSpin = await TelemetryDataSpinService.getData(idWell, null, chartInterval)
|
const dataSpin = await TelemetryDataSpinService.getData(idWell, null, chartInterval)
|
||||||
setFlowChartData(flowChart ?? [])
|
setFlowChartData(flowChart ?? [])
|
||||||
|
@ -25,7 +25,7 @@ export const DrillProcessFlow = memo(() => {
|
|||||||
|
|
||||||
const updateFlows = () => invokeWebApiWrapperAsync(
|
const updateFlows = () => invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
const flows = await DrillFlowChartService.get(idWell)
|
const flows = await DrillFlowChartService.getByIdWell(idWell)
|
||||||
setFlows(arrayOrDefault(flows))
|
setFlows(arrayOrDefault(flows))
|
||||||
},
|
},
|
||||||
setShowLoader,
|
setShowLoader,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { memo, NamedExoticComponent, ReactElement, ReactNode, useMemo } from 'react'
|
import { memo, NamedExoticComponent, ReactElement, ReactNode, useMemo } from 'react'
|
||||||
import { useParams } from 'react-router-dom'
|
import { Navigate, useParams } from 'react-router-dom'
|
||||||
|
|
||||||
import { getUserLogin, getUserPermissions, getUserRoles } from '@utils'
|
import { getUserLogin, getUserPermissions, getUserRoles } from '@utils'
|
||||||
import { isDev } from '@utils'
|
import { isDev } from '@utils'
|
||||||
@ -109,9 +109,10 @@ export type PrivateComponent<P extends object> = NamedExoticComponent<P> & Priva
|
|||||||
getKey: () => string
|
getKey: () => string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NoAccessComponent = memo(() => (
|
export const NoAccessComponent = memo(() => getUserLogin() ? (
|
||||||
<AccessDenied />
|
<AccessDenied /> // <Navigate to={'/access_denied'} replace />
|
||||||
// <Navigate to={'/access_denied'} replace />
|
) : (
|
||||||
|
<Navigate to={'/login'} replace />
|
||||||
))
|
))
|
||||||
|
|
||||||
export const wrapPrivateComponent = <P extends object>(
|
export const wrapPrivateComponent = <P extends object>(
|
||||||
|
Loading…
Reference in New Issue
Block a user