forked from ddrilling/asb_cloud_front
Добавлена страница VisitLog с неработающими сортировками
This commit is contained in:
parent
df0fe53049
commit
efc7ae5e17
@ -2,15 +2,15 @@ import { ReactNode } from 'react'
|
|||||||
import { InputNumber, Select, Table as RawTable } from 'antd'
|
import { InputNumber, Select, Table as RawTable } from 'antd'
|
||||||
import { OptionsType } from 'rc-select/lib/interface'
|
import { OptionsType } from 'rc-select/lib/interface'
|
||||||
import { tryAddKeys } from './EditableTable'
|
import { tryAddKeys } from './EditableTable'
|
||||||
import { makeNumericSorter, makeStringSorter} from './sorters'
|
import { makeNumericSorter, makeStringSorter } from './sorters'
|
||||||
import { Rule } from 'rc-field-form/lib/interface'
|
import { Rule } from 'rc-field-form/lib/interface'
|
||||||
export { makeDateSorter, makeNumericSorter, makeStringSorter} from './sorters'
|
export { makeDateSorter, makeNumericSorter, makeStringSorter } from './sorters'
|
||||||
export { EditableTable, makeActionHandler } from './EditableTable'
|
export { EditableTable, makeActionHandler } from './EditableTable'
|
||||||
export { DatePickerWrapper } from './DatePickerWrapper'
|
export { DatePickerWrapper } from './DatePickerWrapper'
|
||||||
export { SelectFromDictionary } from './SelectFromDictionary'
|
export { SelectFromDictionary } from './SelectFromDictionary'
|
||||||
|
|
||||||
export const RegExpIsFloat = /^[-+]?\d+\.?\d*$/
|
export const RegExpIsFloat = /^[-+]?\d+\.?\d*$/
|
||||||
export const formatDate='YYYY.MM.DD HH:mm'
|
export const formatDate = 'YYYY.MM.DD HH:mm'
|
||||||
|
|
||||||
export const makeNumericRender = (fixed?: number) => (value: any, row: object): ReactNode => {
|
export const makeNumericRender = (fixed?: number) => (value: any, row: object): ReactNode => {
|
||||||
let val = '-'
|
let val = '-'
|
||||||
|
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,18 +36,22 @@ 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>
|
||||||
<Layout.Content className={'site-layout-background'}>
|
<Layout.Content className={'site-layout-background'}>
|
||||||
<Suspense fallback={<div>Loading...</div>}>
|
<Suspense fallback={<div>Loading...</div>}>
|
||||||
<Switch>
|
<Switch>
|
||||||
<PrivateRoute permission={'deposit_editor'} path={`${rootPath}/deposit`} component={DepositController} />
|
<PrivateRoute permission={'deposit_editor'} path={`${rootPath}/deposit` } component={DepositController} />
|
||||||
<PrivateRoute permission={'cluster_editor'} path={`${rootPath}/cluster`} component={ClusterController} />
|
<PrivateRoute permission={'cluster_editor'} path={`${rootPath}/cluster` } component={ClusterController} />
|
||||||
<PrivateRoute permission={ 'well_editor'} path={`${rootPath}/well` } component={ WellController} />
|
<PrivateRoute permission={ 'well_editor'} path={`${rootPath}/well` } component={ WellController} />
|
||||||
<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