forked from ddrilling/asb_cloud_front
Добавлена страница VisitLog с неработающими сортировками
This commit is contained in:
parent
df0fe53049
commit
efc7ae5e17
44
src/pages/AdminPanel/VisitLog.jsx
Normal file
44
src/pages/AdminPanel/VisitLog.jsx
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import moment from 'moment'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
||||||
|
import LoaderPortal from '../../components/LoaderPortal'
|
||||||
|
import { makeColumn, makeDateSorter, makeStringSorter, Table } from '../../components/Table'
|
||||||
|
import { RequerstTrackerService } from '../../services/api'
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
makeColumn('Логин', 'login', { sorter: makeStringSorter('login') }),
|
||||||
|
makeColumn('IP', 'ip', { sorter: makeStringSorter('ip') }),
|
||||||
|
makeColumn('Дата посещения', 'lastDate', {
|
||||||
|
render: (date) => moment(date).format('DD MMM YYYY, HH:mm:ss'),
|
||||||
|
sorter: makeDateSorter('lastDate'),
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
|
||||||
|
export const VisitLog = () => {
|
||||||
|
const [logData, setLogData] = useState([])
|
||||||
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => invokeWebApiWrapperAsync(
|
||||||
|
async () => {
|
||||||
|
const logData = await RequerstTrackerService.getUsersStat(1000)
|
||||||
|
|
||||||
|
setLogData(logData)
|
||||||
|
},
|
||||||
|
setIsLoading,
|
||||||
|
`Не удалось загрузить список последних посещений пользователей`
|
||||||
|
), [])
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LoaderPortal show={isLoading}>
|
||||||
|
<Table
|
||||||
|
size={'small'}
|
||||||
|
bordered
|
||||||
|
columns={columns}
|
||||||
|
dataSource={logData}
|
||||||
|
/>
|
||||||
|
</LoaderPortal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default VisitLog
|
@ -9,6 +9,7 @@ const DepositController = React.lazy(() => import('./DepositController'))
|
|||||||
const UserController = React.lazy(() => import('./UserController'))
|
const UserController = React.lazy(() => import('./UserController'))
|
||||||
const WellController = React.lazy(() => import('./WellController'))
|
const WellController = React.lazy(() => import('./WellController'))
|
||||||
const RoleController = React.lazy(() => import('./RoleController'))
|
const RoleController = React.lazy(() => import('./RoleController'))
|
||||||
|
const VisitLog = React.lazy(() => import('./VisitLog'))
|
||||||
|
|
||||||
export const AdminPanel = () => {
|
export const AdminPanel = () => {
|
||||||
const { tab } = useParams()
|
const { tab } = useParams()
|
||||||
@ -35,6 +36,9 @@ export const AdminPanel = () => {
|
|||||||
<PrivateMenuItem key={'role'} permission={'role_editor'}>
|
<PrivateMenuItem key={'role'} permission={'role_editor'}>
|
||||||
<Link to={`${rootPath}/role`}>Права</Link>
|
<Link to={`${rootPath}/role`}>Права</Link>
|
||||||
</PrivateMenuItem>
|
</PrivateMenuItem>
|
||||||
|
<PrivateMenuItem key={'visit_log'} permission={'visit_log'}>
|
||||||
|
<Link to={`${rootPath}/visit_log`}>Журнал посещений</Link>
|
||||||
|
</PrivateMenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|
||||||
<Layout>
|
<Layout>
|
||||||
@ -47,6 +51,7 @@ export const AdminPanel = () => {
|
|||||||
<PrivateRoute permission={ 'user_editor'} path={`${rootPath}/user` } component={ UserController} />
|
<PrivateRoute permission={ 'user_editor'} path={`${rootPath}/user` } component={ UserController} />
|
||||||
<PrivateRoute permission={'company_editor'} path={`${rootPath}/company` } component={CompanyController} />
|
<PrivateRoute permission={'company_editor'} path={`${rootPath}/company` } component={CompanyController} />
|
||||||
<PrivateRoute permission={ 'role_editor'} path={`${rootPath}/role` } component={ RoleController} />
|
<PrivateRoute permission={ 'role_editor'} path={`${rootPath}/role` } component={ RoleController} />
|
||||||
|
<PrivateRoute permission={ 'visit_log'} path={`${rootPath}/visit_log`} component={ VisitLog} />
|
||||||
<Route path={'/'}>
|
<Route path={'/'}>
|
||||||
<Redirect to={`${rootPath}/deposit`}/>
|
<Redirect to={`${rootPath}/deposit`}/>
|
||||||
</Route>
|
</Route>
|
||||||
|
Loading…
Reference in New Issue
Block a user