forked from ddrilling/asb_cloud_front
Скорректированно название HOC и удалены лишние экспорты
This commit is contained in:
parent
b7317a02d5
commit
811d48a47b
@ -12,7 +12,7 @@ import {
|
|||||||
import { LayoutPropsContext } from '@asb/context'
|
import { LayoutPropsContext } from '@asb/context'
|
||||||
import { UserMenu, UserMenuProps } from '@components/UserMenu'
|
import { UserMenu, UserMenuProps } from '@components/UserMenu'
|
||||||
import { WellTreeSelector, WellTreeSelectorProps } from '@components/selectors/WellTreeSelector'
|
import { WellTreeSelector, WellTreeSelectorProps } from '@components/selectors/WellTreeSelector'
|
||||||
import { isURLAvailable, wrapPrivateComponent } from '@utils'
|
import { isURLAvailable, withPermissions } from '@utils'
|
||||||
|
|
||||||
import SuspenseFallback from './SuspenseFallback'
|
import SuspenseFallback from './SuspenseFallback'
|
||||||
|
|
||||||
@ -131,6 +131,6 @@ const _LayoutPortal = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export const LayoutPortal = wrapPrivateComponent(_LayoutPortal, { requirements: ['Deposit.get'] })
|
export const LayoutPortal = withPermissions(_LayoutPortal, ['Deposit.get'])
|
||||||
|
|
||||||
export default LayoutPortal
|
export default LayoutPortal
|
||||||
|
@ -2,29 +2,14 @@ import { ReactNode } from 'react'
|
|||||||
import { Rule } from 'antd/lib/form'
|
import { Rule } from 'antd/lib/form'
|
||||||
import { ColumnProps } from 'antd/lib/table'
|
import { ColumnProps } from 'antd/lib/table'
|
||||||
|
|
||||||
export { makeDateColumn } from './date'
|
export * from './date'
|
||||||
export { makeTimeColumn } from './time'
|
export * from './time'
|
||||||
export {
|
export * from './numeric'
|
||||||
RegExpIsFloat,
|
export * from './plan_fact'
|
||||||
makeNumericRender,
|
export * from './select'
|
||||||
makeNumericColumn,
|
export * from './tag'
|
||||||
makeNumericColumnOptions,
|
export * from './text'
|
||||||
makeNumericColumnPlanFact,
|
export * from './timezone'
|
||||||
makeNumericStartEnd,
|
|
||||||
makeNumericMinMax,
|
|
||||||
} from './numeric'
|
|
||||||
export { makeColumnsPlanFact } from './plan_fact'
|
|
||||||
export { makeSelectColumn } from './select'
|
|
||||||
export { makeTagColumn, makeTagInput } from './tag'
|
|
||||||
export { makeFilterTextMatch, makeTextColumn } from './text'
|
|
||||||
export {
|
|
||||||
timezoneOptions,
|
|
||||||
TimezoneSelect,
|
|
||||||
makeTimezoneColumn,
|
|
||||||
makeTimezoneRenderer
|
|
||||||
} from './timezone'
|
|
||||||
|
|
||||||
export type { TagInputProps } from './tag'
|
|
||||||
|
|
||||||
export type DataType<T = any> = Record<string, T>
|
export type DataType<T = any> = Record<string, T>
|
||||||
export type RenderMethod<T = any> = (value: T, dataset?: DataType<T>, index?: number) => ReactNode
|
export type RenderMethod<T = any> = (value: T, dataset?: DataType<T>, index?: number) => ReactNode
|
||||||
|
@ -1,58 +1,24 @@
|
|||||||
export { makeDateSorter, makeNumericSorter, makeStringSorter, makeTimeSorter } from './sorters'
|
export * from './sorters'
|
||||||
export { EditableTable, makeTableAction } from './EditableTable'
|
export * from './EditableTable'
|
||||||
export { DatePickerWrapper } from './DatePickerWrapper'
|
export * from './DatePickerWrapper'
|
||||||
export { TimePickerWrapper } from './TimePickerWrapper'
|
export * from './TimePickerWrapper'
|
||||||
export { DateRangeWrapper } from './DateRangeWrapper'
|
export * from './DateRangeWrapper'
|
||||||
export { Table } from './Table'
|
export * from './Table'
|
||||||
export {
|
export * from './Columns'
|
||||||
RegExpIsFloat,
|
|
||||||
timezoneOptions,
|
|
||||||
TimezoneSelect,
|
|
||||||
makeDateColumn,
|
|
||||||
makeTimeColumn,
|
|
||||||
makeGroupColumn,
|
|
||||||
makeColumn,
|
|
||||||
makeColumnsPlanFact,
|
|
||||||
makeFilterTextMatch,
|
|
||||||
makeNumericRender,
|
|
||||||
makeNumericColumn,
|
|
||||||
makeNumericColumnOptions,
|
|
||||||
makeNumericColumnPlanFact,
|
|
||||||
makeNumericStartEnd,
|
|
||||||
makeNumericMinMax,
|
|
||||||
makeSelectColumn,
|
|
||||||
makeTagColumn,
|
|
||||||
makeTagInput,
|
|
||||||
makeTextColumn,
|
|
||||||
makeTimezoneColumn,
|
|
||||||
makeTimezoneRenderer,
|
|
||||||
} from './Columns'
|
|
||||||
|
|
||||||
export type {
|
|
||||||
DataType,
|
|
||||||
RenderMethod,
|
|
||||||
SorterMethod,
|
|
||||||
TagInputProps,
|
|
||||||
columnPropsOther,
|
|
||||||
} from './Columns'
|
|
||||||
export type { DateRangeWrapperProps } from './DateRangeWrapper'
|
|
||||||
export type { DatePickerWrapperProps } from './DatePickerWrapper'
|
|
||||||
export type { TimePickerWrapperProps } from './TimePickerWrapper'
|
|
||||||
export type { BaseTableColumn, TableColumns, TableContainer } from './Table'
|
|
||||||
|
|
||||||
export const defaultPagination = {
|
export const defaultPagination = {
|
||||||
defaultPageSize: 14,
|
defaultPageSize: 14,
|
||||||
showSizeChanger: true,
|
showSizeChanger: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
type PaginationContainer = {
|
export type PaginationContainer<T> = {
|
||||||
skip?: number
|
skip?: number
|
||||||
take?: number
|
take?: number
|
||||||
count?: number
|
count?: number
|
||||||
items?: any[] | null
|
items?: T[] | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export const makePaginationObject = (сontainer: PaginationContainer, ...other: any) => ({
|
export const makePaginationObject = <T, M extends object>(сontainer: PaginationContainer<T>, other: M) => ({
|
||||||
...other,
|
...other,
|
||||||
pageSize: сontainer.take,
|
pageSize: сontainer.take,
|
||||||
total: сontainer.count ?? сontainer.items?.length ?? 0,
|
total: сontainer.count ?? сontainer.items?.length ?? 0,
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
export * from './D3Chart'
|
export * from './D3Chart'
|
||||||
export type { D3ChartProps } from './D3Chart'
|
|
||||||
|
|
||||||
export * from './types'
|
export * from './types'
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
export type { PointerIconColors, PointerIconProps } from './PointerIcon'
|
export * from './PointerIcon'
|
||||||
export type { WellIconColors, WellIconProps, WellIconState } from './WellIcon'
|
export * from './WellIcon'
|
||||||
|
export * from './Loader'
|
||||||
export { PointerIcon } from './PointerIcon'
|
|
||||||
export { WellIcon } from './WellIcon'
|
|
||||||
export { Loader } from './Loader'
|
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
export type { PermissionViewProps } from './PermissionView'
|
export * from './PermissionView'
|
||||||
export type { TelemetryViewProps } from './TelemetryView'
|
export * from './TelemetryView'
|
||||||
export type { CompanyViewProps } from './CompanyView'
|
export * from './CompanyView'
|
||||||
export type { RoleViewProps } from './RoleView'
|
export * from './RoleView'
|
||||||
export type { UserViewProps } from './UserView'
|
export * from './UserView'
|
||||||
export type { WirelineViewProps } from './WirelineView'
|
export * from './WirelineView'
|
||||||
|
|
||||||
export { PermissionView } from './PermissionView'
|
|
||||||
export { TelemetryView, getTelemetryLabel } from './TelemetryView'
|
|
||||||
export { CompanyView } from './CompanyView'
|
|
||||||
export { RoleView } from './RoleView'
|
|
||||||
export { UserView } from './UserView'
|
|
||||||
export { WirelineView } from './WirelineView'
|
|
||||||
export * from './WellView'
|
export * from './WellView'
|
||||||
|
@ -1,5 +1,2 @@
|
|||||||
export { WidgetSettingsWindow } from './WidgetSettingsWindow'
|
export * from './WidgetSettingsWindow'
|
||||||
export { BaseWidget } from './BaseWidget'
|
export * from './BaseWidget'
|
||||||
|
|
||||||
export type { WidgetSettingsWindowProps } from './WidgetSettingsWindow'
|
|
||||||
export type { WidgetSettings, BaseWidgetProps } from './BaseWidget'
|
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
} from '@components/Table'
|
} from '@components/Table'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { AdminClusterService, AdminDepositService } from '@api'
|
import { AdminClusterService, AdminDepositService } from '@api'
|
||||||
import { arrayOrDefault, coordsFormat, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, coordsFormat, withPermissions } from '@utils'
|
||||||
import { min1 } from '@utils/validationRules'
|
import { min1 } from '@utils/validationRules'
|
||||||
|
|
||||||
const ClusterController = memo(() => {
|
const ClusterController = memo(() => {
|
||||||
@ -112,8 +112,4 @@ const ClusterController = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(ClusterController, {
|
export default withPermissions(ClusterController, ['AdminDeposit.get', 'AdminCluster.get'])
|
||||||
requirements: ['AdminDeposit.get', 'AdminCluster.get'],
|
|
||||||
title: 'Кусты',
|
|
||||||
route: 'cluster',
|
|
||||||
})
|
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
} from '@components/Table'
|
} from '@components/Table'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { AdminCompanyService, AdminCompanyTypeService } from '@api'
|
import { AdminCompanyService, AdminCompanyTypeService } from '@api'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, withPermissions } from '@utils'
|
||||||
import { min1 } from '@utils/validationRules'
|
import { min1 } from '@utils/validationRules'
|
||||||
|
|
||||||
const CompanyController = memo(() => {
|
const CompanyController = memo(() => {
|
||||||
@ -103,8 +103,4 @@ const CompanyController = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(CompanyController, {
|
export default withPermissions(CompanyController, ['AdminCompany.get', 'AdminCompanyType.get'])
|
||||||
requirements: ['AdminCompany.get', 'AdminCompanyType.get'],
|
|
||||||
title: 'Компании',
|
|
||||||
route: 'company',
|
|
||||||
})
|
|
||||||
|
@ -3,7 +3,7 @@ import { Input } from 'antd'
|
|||||||
|
|
||||||
import { EditableTable, makeColumn, makeStringSorter, defaultPagination } from '@components/Table'
|
import { EditableTable, makeColumn, makeStringSorter, defaultPagination } from '@components/Table'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, withPermissions } from '@utils'
|
||||||
import { min1 } from '@utils/validationRules'
|
import { min1 } from '@utils/validationRules'
|
||||||
import { AdminCompanyTypeService } from '@api'
|
import { AdminCompanyTypeService } from '@api'
|
||||||
|
|
||||||
@ -81,8 +81,4 @@ const CompanyTypeController = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(CompanyTypeController, {
|
export default withPermissions(CompanyTypeController, ['AdminCompanyType.get'])
|
||||||
requirements: ['AdminCompanyType.get'],
|
|
||||||
title: 'Типы компаний',
|
|
||||||
route: 'company_type',
|
|
||||||
})
|
|
||||||
|
@ -3,7 +3,7 @@ import { Input } from 'antd'
|
|||||||
|
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { EditableTable, makeColumn, defaultPagination, makeTimezoneColumn } from '@components/Table'
|
import { EditableTable, makeColumn, defaultPagination, makeTimezoneColumn } from '@components/Table'
|
||||||
import { arrayOrDefault, coordsFormat, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, coordsFormat, withPermissions } from '@utils'
|
||||||
import { min1 } from '@utils/validationRules'
|
import { min1 } from '@utils/validationRules'
|
||||||
import { AdminDepositService } from '@api'
|
import { AdminDepositService } from '@api'
|
||||||
|
|
||||||
@ -81,8 +81,4 @@ const DepositController = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(DepositController, {
|
export default withPermissions(DepositController, ['AdminDeposit.get'])
|
||||||
requirements: ['AdminDeposit.get'],
|
|
||||||
title: 'Месторождения',
|
|
||||||
route: 'deposit',
|
|
||||||
})
|
|
||||||
|
@ -3,7 +3,7 @@ import { Input } from 'antd'
|
|||||||
|
|
||||||
import { EditableTable, makeColumn, makeStringSorter } from '@components/Table'
|
import { EditableTable, makeColumn, makeStringSorter } from '@components/Table'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, withPermissions } from '@utils'
|
||||||
import { min1 } from '@utils/validationRules'
|
import { min1 } from '@utils/validationRules'
|
||||||
import { AdminPermissionService } from '@api'
|
import { AdminPermissionService } from '@api'
|
||||||
|
|
||||||
@ -88,8 +88,4 @@ const PermissionController = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(PermissionController, {
|
export default withPermissions(PermissionController, ['AdminPermission.get'])
|
||||||
requirements: ['AdminPermission.get'],
|
|
||||||
title: 'Разрешения',
|
|
||||||
route: 'permission',
|
|
||||||
})
|
|
||||||
|
@ -5,7 +5,7 @@ import { PermissionView, RoleView } from '@components/views'
|
|||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { EditableTable, makeTagColumn, makeTextColumn } from '@components/Table'
|
import { EditableTable, makeTagColumn, makeTextColumn } from '@components/Table'
|
||||||
import { AdminPermissionService, AdminUserRoleService } from '@api'
|
import { AdminPermissionService, AdminUserRoleService } from '@api'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, withPermissions } from '@utils'
|
||||||
import { min1 } from '@utils/validationRules'
|
import { min1 } from '@utils/validationRules'
|
||||||
|
|
||||||
const RoleController = memo(() => {
|
const RoleController = memo(() => {
|
||||||
@ -95,8 +95,4 @@ const RoleController = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(RoleController, {
|
export default withPermissions(RoleController, ['AdminPermission.get', 'AdminUserRole.get'])
|
||||||
requirements: ['AdminPermission.get', 'AdminUserRole.get'],
|
|
||||||
title: 'Роли',
|
|
||||||
route: 'role',
|
|
||||||
})
|
|
||||||
|
@ -8,7 +8,7 @@ import LoaderPortal from '@components/LoaderPortal'
|
|||||||
import { lables } from '@components/views/TelemetryView'
|
import { lables } from '@components/views/TelemetryView'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import TelemetrySelect from '@components/selectors/TelemetrySelect'
|
import TelemetrySelect from '@components/selectors/TelemetrySelect'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, withPermissions } from '@utils'
|
||||||
import { AdminTelemetryService } from '@api'
|
import { AdminTelemetryService } from '@api'
|
||||||
|
|
||||||
const { Item } = Descriptions
|
const { Item } = Descriptions
|
||||||
@ -134,9 +134,4 @@ const TelemetryMerger = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(TelemetryMerger, {
|
export default withPermissions(TelemetryMerger)
|
||||||
requirements: [],
|
|
||||||
title: 'Объединение',
|
|
||||||
route: 'merger',
|
|
||||||
key: 'merger',
|
|
||||||
})
|
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
} from '@components/Table'
|
} from '@components/Table'
|
||||||
import Poprompt from '@components/selectors/Poprompt'
|
import Poprompt from '@components/selectors/Poprompt'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, withPermissions } from '@utils'
|
||||||
import { AdminTelemetryService } from '@api'
|
import { AdminTelemetryService } from '@api'
|
||||||
|
|
||||||
const TelemetryController = memo(() => {
|
const TelemetryController = memo(() => {
|
||||||
@ -121,9 +121,4 @@ const TelemetryController = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(TelemetryController, {
|
export default withPermissions(TelemetryController)
|
||||||
requirements: [],
|
|
||||||
title: 'Просмотр',
|
|
||||||
route: 'viewer',
|
|
||||||
key: 'viewer',
|
|
||||||
})
|
|
||||||
|
@ -2,7 +2,7 @@ import { memo, useMemo } from 'react'
|
|||||||
import { Outlet } from 'react-router-dom'
|
import { Outlet } from 'react-router-dom'
|
||||||
|
|
||||||
import { RootPathContext, useRootPath } from '@asb/context'
|
import { RootPathContext, useRootPath } from '@asb/context'
|
||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
|
|
||||||
const Telemetry = memo(() => {
|
const Telemetry = memo(() => {
|
||||||
const root = useRootPath()
|
const root = useRootPath()
|
||||||
@ -15,9 +15,4 @@ const Telemetry = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Telemetry, {
|
export default withPermissions(Telemetry, ['AdminTelemetry.get'])
|
||||||
requirements: ['AdminTelemetry.get'],
|
|
||||||
title: 'Телеметрия',
|
|
||||||
key: 'telemetry',
|
|
||||||
route: 'telemetry/*',
|
|
||||||
})
|
|
||||||
|
@ -17,7 +17,7 @@ import { invokeWebApiWrapperAsync } from '@components/factory'
|
|||||||
import { AdminCompanyService, AdminUserRoleService, AdminUserService } from '@api'
|
import { AdminCompanyService, AdminUserRoleService, AdminUserService } from '@api'
|
||||||
import { createLoginRules, nameRules, phoneRules, emailRules } from '@utils/validationRules'
|
import { createLoginRules, nameRules, phoneRules, emailRules } from '@utils/validationRules'
|
||||||
import { makeTextOnFilter, makeTextFilters, makeArrayOnFilter } from '@utils/filters'
|
import { makeTextOnFilter, makeTextFilters, makeArrayOnFilter } from '@utils/filters'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, withPermissions } from '@utils'
|
||||||
|
|
||||||
import RoleTag from './RoleTag'
|
import RoleTag from './RoleTag'
|
||||||
|
|
||||||
@ -227,8 +227,4 @@ const UserController = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(UserController, {
|
export default withPermissions(UserController, ['AdminUser.get', 'AdminCompany.get', 'AdminUserRole.get'])
|
||||||
requirements: ['AdminUser.get', 'AdminCompany.get', 'AdminUserRole.get'],
|
|
||||||
title: 'Пользователи',
|
|
||||||
route: 'user',
|
|
||||||
})
|
|
||||||
|
@ -3,7 +3,7 @@ import { Input } from 'antd'
|
|||||||
|
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { defaultPagination, makeColumn, makeDateSorter, makeStringSorter, Table } from '@components/Table'
|
import { defaultPagination, makeColumn, makeDateSorter, makeStringSorter, Table } from '@components/Table'
|
||||||
import { arrayOrDefault, formatDate, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, formatDate, withPermissions } from '@utils'
|
||||||
import { RequestTrackerService } from '@api'
|
import { RequestTrackerService } from '@api'
|
||||||
|
|
||||||
const logRecordCount = 1000
|
const logRecordCount = 1000
|
||||||
@ -65,8 +65,4 @@ const VisitLog = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(VisitLog, {
|
export default withPermissions(VisitLog, ['RequestTracker.get'])
|
||||||
requirements: ['RequestTracker.get'],
|
|
||||||
title: 'Журнал посещений',
|
|
||||||
route: 'visit_log',
|
|
||||||
})
|
|
||||||
|
@ -21,7 +21,7 @@ import {
|
|||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { TelemetryView, CompanyView } from '@components/views'
|
import { TelemetryView, CompanyView } from '@components/views'
|
||||||
import TelemetrySelect from '@components/selectors/TelemetrySelect'
|
import TelemetrySelect from '@components/selectors/TelemetrySelect'
|
||||||
import { arrayOrDefault, coordsFormat, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, coordsFormat, withPermissions } from '@utils'
|
||||||
|
|
||||||
const wellTypes = [
|
const wellTypes = [
|
||||||
{ value: 1, label: 'Наклонно-направленная' },
|
{ value: 1, label: 'Наклонно-направленная' },
|
||||||
@ -160,8 +160,4 @@ const WellController = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(WellController, {
|
export default withPermissions(WellController, ['AdminCluster.get', 'AdminCompany.get', 'AdminTelemetry.get', 'AdminWell.get'])
|
||||||
requirements: ['AdminCluster.get', 'AdminCompany.get', 'AdminTelemetry.get', 'AdminWell.get'],
|
|
||||||
title: 'Скважины',
|
|
||||||
route: 'well',
|
|
||||||
})
|
|
||||||
|
@ -3,7 +3,7 @@ import { lazy, memo, useMemo } from 'react'
|
|||||||
|
|
||||||
import { RootPathContext, useLayoutProps, useRootPath } from '@asb/context'
|
import { RootPathContext, useLayoutProps, useRootPath } from '@asb/context'
|
||||||
import { MenuBreadcrumbItems } from '@components/MenuBreadcrumb'
|
import { MenuBreadcrumbItems } from '@components/MenuBreadcrumb'
|
||||||
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
|
import { NoAccessComponent, withPermissions } from '@utils'
|
||||||
|
|
||||||
import { AdminNavigationMenu, menuItems } from './AdminNavigationMenu'
|
import { AdminNavigationMenu, menuItems } from './AdminNavigationMenu'
|
||||||
|
|
||||||
@ -58,4 +58,4 @@ const AdminPanel = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(AdminPanel, { requirements: ['RequestTracker.get'] })
|
export default withPermissions(AdminPanel, ['RequestTracker.get'])
|
||||||
|
@ -22,7 +22,7 @@ import {
|
|||||||
calcAndUpdateStatsBySections,
|
calcAndUpdateStatsBySections,
|
||||||
isRawDate,
|
isRawDate,
|
||||||
makeFilterMinMaxFunction,
|
makeFilterMinMaxFunction,
|
||||||
wrapPrivateComponent
|
withPermissions
|
||||||
} from '@utils'
|
} from '@utils'
|
||||||
|
|
||||||
const Tvd = lazy(() => import('@pages/Well/WellOperations/Tvd'))
|
const Tvd = lazy(() => import('@pages/Well/WellOperations/Tvd'))
|
||||||
@ -219,8 +219,4 @@ const ClusterWells = memo(({ statsWells }) => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(ClusterWells, {
|
export default withPermissions(ClusterWells)
|
||||||
requirements: [],
|
|
||||||
title: 'Статистика по скважинам',
|
|
||||||
route: 'wells',
|
|
||||||
})
|
|
||||||
|
@ -4,7 +4,7 @@ import { useParams } from 'react-router-dom'
|
|||||||
import { useLayoutProps } from '@asb/context'
|
import { useLayoutProps } from '@asb/context'
|
||||||
import LoaderPortal from '@components/LoaderPortal'
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, withPermissions } from '@utils'
|
||||||
import { OperationStatService } from '@api'
|
import { OperationStatService } from '@api'
|
||||||
|
|
||||||
import ClusterWells from './ClusterWells'
|
import ClusterWells from './ClusterWells'
|
||||||
@ -40,9 +40,4 @@ const Cluster = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Cluster, {
|
export default withPermissions(Cluster, ['OperationStat.get'])
|
||||||
requirements: ['OperationStat.get'],
|
|
||||||
title: 'Анализ скважин куста',
|
|
||||||
route: 'cluster/:idCluster/*',
|
|
||||||
key: 'cluster',
|
|
||||||
})
|
|
||||||
|
@ -7,7 +7,7 @@ import { useLayoutProps } from '@asb/context'
|
|||||||
import { PointerIcon } from '@components/icons'
|
import { PointerIcon } from '@components/icons'
|
||||||
import LoaderPortal from '@components/LoaderPortal'
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { arrayOrDefault, limitValue, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, limitValue, withPermissions } from '@utils'
|
||||||
import { DepositService } from '@api'
|
import { DepositService } from '@api'
|
||||||
|
|
||||||
import '@styles/index.css'
|
import '@styles/index.css'
|
||||||
@ -113,9 +113,4 @@ const Deposit = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Deposit, {
|
export default withPermissions(Deposit, ['Cluster.get'])
|
||||||
requirements: ['Cluster.get'],
|
|
||||||
title: 'Месторождение',
|
|
||||||
route: 'deposit/*',
|
|
||||||
key: 'deposit',
|
|
||||||
})
|
|
||||||
|
@ -4,7 +4,7 @@ import { InfoCircleFilled, CloseCircleOutlined } from '@ant-design/icons'
|
|||||||
import { Button, Result, Typography } from 'antd'
|
import { Button, Result, Typography } from 'antd'
|
||||||
|
|
||||||
import { downloadFile, invokeWebApiWrapperAsync } from '@components/factory'
|
import { downloadFile, invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
import { FileService, WellService } from '@api'
|
import { FileService, WellService } from '@api'
|
||||||
|
|
||||||
const { Paragraph, Text } = Typography
|
const { Paragraph, Text } = Typography
|
||||||
@ -99,7 +99,4 @@ const FileDownload = memo(function FileDownload() {
|
|||||||
|
|
||||||
FileDownload.displayName = 'FileDownloadMemo'
|
FileDownload.displayName = 'FileDownloadMemo'
|
||||||
|
|
||||||
export default wrapPrivateComponent(FileDownload, {
|
export default withPermissions(FileDownload, ['File.get'])
|
||||||
requirements: ['File.get'],
|
|
||||||
route: 'file_download/:idWell/:idFile/*',
|
|
||||||
})
|
|
||||||
|
@ -7,7 +7,7 @@ import { invokeWebApiWrapperAsync } from '@components/factory'
|
|||||||
import { WellSelector } from '@components/selectors/WellSelector'
|
import { WellSelector } from '@components/selectors/WellSelector'
|
||||||
import { makeGroupColumn, makeNumericColumn, makeNumericRender, makeTextColumn, Table } from '@components/Table'
|
import { makeGroupColumn, makeNumericColumn, makeNumericRender, makeTextColumn, Table } from '@components/Table'
|
||||||
import { OperationStatService, WellOperationService } from '@api'
|
import { OperationStatService, WellOperationService } from '@api'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, withPermissions } from '@utils'
|
||||||
|
|
||||||
import '@styles/index.css'
|
import '@styles/index.css'
|
||||||
import '@styles/statistics.less'
|
import '@styles/statistics.less'
|
||||||
@ -242,8 +242,4 @@ const Statistics = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Statistics, {
|
export default withPermissions(Statistics)
|
||||||
requirements: [],
|
|
||||||
title: 'Оценка по ЦБ',
|
|
||||||
route: 'statistics',
|
|
||||||
})
|
|
||||||
|
@ -10,7 +10,7 @@ import { makeTextColumn, makeNumericColumnPlanFact, makeNumericColumn } from '@c
|
|||||||
import { WellCompositeService } from '@api'
|
import { WellCompositeService } from '@api'
|
||||||
import {
|
import {
|
||||||
hasPermission,
|
hasPermission,
|
||||||
wrapPrivateComponent,
|
withPermissions,
|
||||||
calcAndUpdateStatsBySections,
|
calcAndUpdateStatsBySections,
|
||||||
makeFilterMinMaxFunction,
|
makeFilterMinMaxFunction,
|
||||||
getOperations
|
getOperations
|
||||||
@ -267,8 +267,4 @@ const WellCompositeSections = memo(({ statsWells, selectedSections }) => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(WellCompositeSections, {
|
export default withPermissions(WellCompositeSections, ['WellComposite.get'])
|
||||||
requirements: ['WellComposite.get'],
|
|
||||||
title: 'Статистика по секциям',
|
|
||||||
route: 'sections',
|
|
||||||
})
|
|
||||||
|
@ -7,7 +7,7 @@ import LoaderPortal from '@components/LoaderPortal'
|
|||||||
import SuspenseFallback from '@components/SuspenseFallback'
|
import SuspenseFallback from '@components/SuspenseFallback'
|
||||||
import WellSelector from '@components/selectors/WellSelector'
|
import WellSelector from '@components/selectors/WellSelector'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { arrayOrDefault, NoAccessComponent, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, NoAccessComponent, withPermissions } from '@utils'
|
||||||
import { OperationStatService, WellCompositeService } from '@api'
|
import { OperationStatService, WellCompositeService } from '@api'
|
||||||
|
|
||||||
import WellCompositeSections from './WellCompositeSections'
|
import WellCompositeSections from './WellCompositeSections'
|
||||||
@ -76,4 +76,4 @@ const WellCompositeEditor = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(WellCompositeEditor, { requirements: ['OperationStat.get', 'WellComposite.get'] })
|
export default withPermissions(WellCompositeEditor, ['OperationStat.get', 'WellComposite.get'])
|
||||||
|
@ -2,7 +2,7 @@ import { memo, useMemo } from 'react'
|
|||||||
import { Outlet } from 'react-router-dom'
|
import { Outlet } from 'react-router-dom'
|
||||||
|
|
||||||
import { RootPathContext, useRootPath } from '@asb/context'
|
import { RootPathContext, useRootPath } from '@asb/context'
|
||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
|
|
||||||
const Analytics = memo(() => {
|
const Analytics = memo(() => {
|
||||||
const root = useRootPath()
|
const root = useRootPath()
|
||||||
@ -15,9 +15,4 @@ const Analytics = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Analytics, {
|
export default withPermissions(Analytics)
|
||||||
requirements: [],
|
|
||||||
title: 'Аналитика',
|
|
||||||
route: 'analytics/*',
|
|
||||||
key: 'analytics',
|
|
||||||
})
|
|
||||||
|
@ -2,7 +2,7 @@ import { Navigate, Route, Routes } from 'react-router-dom'
|
|||||||
import { memo, useMemo } from 'react'
|
import { memo, useMemo } from 'react'
|
||||||
|
|
||||||
import { RootPathContext, useRootPath } from '@asb/context'
|
import { RootPathContext, useRootPath } from '@asb/context'
|
||||||
import { wrapPrivateComponent, NoAccessComponent, hasPermission } from '@utils'
|
import { withPermissions, NoAccessComponent, hasPermission } from '@utils'
|
||||||
|
|
||||||
import DocumentsTemplate from './DocumentsTemplate'
|
import DocumentsTemplate from './DocumentsTemplate'
|
||||||
|
|
||||||
@ -48,9 +48,4 @@ const MenuDocuments = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(MenuDocuments, {
|
export default withPermissions(MenuDocuments, [ 'Deposit.get', 'File.get' ])
|
||||||
requirements: [ 'Deposit.get', 'File.get' ],
|
|
||||||
title: 'Документы',
|
|
||||||
route: 'document/*',
|
|
||||||
key: 'document',
|
|
||||||
})
|
|
||||||
|
@ -13,7 +13,7 @@ import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
|||||||
import { useWell } from '@asb/context'
|
import { useWell } from '@asb/context'
|
||||||
import LoaderPortal from '@components/LoaderPortal'
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
import { downloadFile, formatBytes, invokeWebApiWrapperAsync } from '@components/factory'
|
import { downloadFile, formatBytes, invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { arrayOrDefault, formatDate, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, formatDate, withPermissions } from '@utils'
|
||||||
import { DrillingProgramService } from '@api'
|
import { DrillingProgramService } from '@api'
|
||||||
|
|
||||||
import CategoryAdder from './CategoryAdder'
|
import CategoryAdder from './CategoryAdder'
|
||||||
@ -185,8 +185,4 @@ const DrillingProgram = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(DrillingProgram, {
|
export default withPermissions(DrillingProgram, [ 'DrillingProgram.get' ])
|
||||||
requirements: [ 'DrillingProgram.get' ],
|
|
||||||
title: 'Программа бурения',
|
|
||||||
route: 'drillingProgram',
|
|
||||||
})
|
|
||||||
|
@ -5,7 +5,7 @@ import { Button } from 'antd'
|
|||||||
import { useWell } from '@asb/context'
|
import { useWell } from '@asb/context'
|
||||||
import LoaderPortal from '@components/LoaderPortal'
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
import { MeasureService } from '@api'
|
import { MeasureService } from '@api'
|
||||||
|
|
||||||
import { MeasureTable } from './MeasureTable'
|
import { MeasureTable } from './MeasureTable'
|
||||||
@ -93,8 +93,4 @@ const Measure = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Measure, {
|
export default withPermissions(Measure, [ 'Measure.get' ])
|
||||||
requirements: [ 'Measure.get' ],
|
|
||||||
title: 'Измерения',
|
|
||||||
route: 'measure',
|
|
||||||
})
|
|
||||||
|
@ -7,7 +7,7 @@ import { useWell } from '@asb/context'
|
|||||||
import LoaderPortal from '@components/LoaderPortal'
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
import { DateRangeWrapper, Table, makeDateColumn, makeColumn } from '@components/Table'
|
import { DateRangeWrapper, Table, makeDateColumn, makeColumn } from '@components/Table'
|
||||||
import { download, invokeWebApiWrapperAsync, notify } from '@components/factory'
|
import { download, invokeWebApiWrapperAsync, notify } from '@components/factory'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, withPermissions } from '@utils'
|
||||||
import { DailyReportService } from '@api'
|
import { DailyReportService } from '@api'
|
||||||
|
|
||||||
import ReportEditor from './ReportEditor'
|
import ReportEditor from './ReportEditor'
|
||||||
@ -123,10 +123,4 @@ const DailyReport = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(DailyReport, {
|
export default withPermissions(DailyReport) //, ['DailyReport.get'])
|
||||||
requirements: [
|
|
||||||
// 'DailyReport.get',
|
|
||||||
],
|
|
||||||
title: 'Суточный рапорт',
|
|
||||||
route: 'daily_report',
|
|
||||||
})
|
|
||||||
|
@ -7,7 +7,7 @@ import { useWell } from '@asb/context'
|
|||||||
import { DateRangeWrapper } from 'components/Table'
|
import { DateRangeWrapper } from 'components/Table'
|
||||||
import { LoaderPortal } from '@components/LoaderPortal'
|
import { LoaderPortal } from '@components/LoaderPortal'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { formatDate, wrapPrivateComponent } from '@utils'
|
import { formatDate, withPermissions } from '@utils'
|
||||||
import { Subscribe } from '@services/signalr'
|
import { Subscribe } from '@services/signalr'
|
||||||
import { ReportService } from '@api'
|
import { ReportService } from '@api'
|
||||||
|
|
||||||
@ -175,8 +175,4 @@ const DiagramReport = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(DiagramReport, {
|
export default withPermissions(DiagramReport, [ 'Report.get' ])
|
||||||
requirements: [ 'Report.get' ],
|
|
||||||
title: 'Диаграмма',
|
|
||||||
route: 'diagram_report',
|
|
||||||
})
|
|
||||||
|
@ -2,7 +2,7 @@ import { Outlet } from 'react-router-dom'
|
|||||||
import { memo, useMemo } from 'react'
|
import { memo, useMemo } from 'react'
|
||||||
|
|
||||||
import { RootPathContext, useRootPath } from '@asb/context'
|
import { RootPathContext, useRootPath } from '@asb/context'
|
||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
|
|
||||||
const Reports = memo(() => {
|
const Reports = memo(() => {
|
||||||
const root = useRootPath()
|
const root = useRootPath()
|
||||||
@ -15,9 +15,4 @@ const Reports = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Reports, {
|
export default withPermissions(Reports)
|
||||||
requirements: [],
|
|
||||||
title: 'Рапорта',
|
|
||||||
route: 'reports/*',
|
|
||||||
key: 'reports',
|
|
||||||
})
|
|
||||||
|
@ -11,7 +11,7 @@ import LoaderPortal from '@components/LoaderPortal'
|
|||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { DatePickerWrapper, makeDateSorter } from '@components/Table'
|
import { DatePickerWrapper, makeDateSorter } from '@components/Table'
|
||||||
import { PeriodPicker, defaultPeriod } from '@components/selectors/PeriodPicker'
|
import { PeriodPicker, defaultPeriod } from '@components/selectors/PeriodPicker'
|
||||||
import { formatDate, range, wrapPrivateComponent } from '@utils'
|
import { formatDate, range, withPermissions } from '@utils'
|
||||||
import { TelemetryDataSaubService } from '@api'
|
import { TelemetryDataSaubService } from '@api'
|
||||||
|
|
||||||
import { makeChartGroups, normalizeData, yAxis } from '../TelemetryView'
|
import { makeChartGroups, normalizeData, yAxis } from '../TelemetryView'
|
||||||
@ -265,8 +265,4 @@ const Archive = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Archive, {
|
export default withPermissions(Archive, ['TelemetryDataSaub.get'])
|
||||||
requirements: ['TelemetryDataSaub.get'],
|
|
||||||
title: 'Архив',
|
|
||||||
route: 'archive',
|
|
||||||
})
|
|
||||||
|
@ -7,7 +7,7 @@ import { useWell, useRootPath } from '@asb/context'
|
|||||||
import LoaderPortal from '@components/LoaderPortal'
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { BaseWidget, WidgetSettingsWindow } from '@components/widgets'
|
import { BaseWidget, WidgetSettingsWindow } from '@components/widgets'
|
||||||
import { arrayOrDefault, wrapPrivateComponent, getJSON, setJSON, getTabname } from '@utils'
|
import { arrayOrDefault, withPermissions, getJSON, setJSON, getTabname } from '@utils'
|
||||||
import Subscribe from '@services/signalr'
|
import Subscribe from '@services/signalr'
|
||||||
import {
|
import {
|
||||||
WitsInfoService,
|
WitsInfoService,
|
||||||
@ -260,17 +260,12 @@ const DashboardNNB = memo(({ enableEditing = false }) => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(DashboardNNB, {
|
export default withPermissions(DashboardNNB, [
|
||||||
requirements: [
|
// 'WitsInfo',
|
||||||
// 'WitsInfo',
|
// 'WitsRecord1',
|
||||||
// 'WitsRecord1',
|
// 'WitsRecord7',
|
||||||
// 'WitsRecord7',
|
// 'WitsRecord8',
|
||||||
// 'WitsRecord8',
|
// 'WitsRecord50',
|
||||||
// 'WitsRecord50',
|
// 'WitsRecord60',
|
||||||
// 'WitsRecord60',
|
// 'WitsRecord61',
|
||||||
// 'WitsRecord61',
|
])
|
||||||
],
|
|
||||||
title: 'ННБ',
|
|
||||||
route: 'dashboard_nnb/*',
|
|
||||||
key: 'dashboard_nnb',
|
|
||||||
})
|
|
||||||
|
@ -8,7 +8,7 @@ import { useWell } from '@asb/context'
|
|||||||
import LoaderPortal from '@components/LoaderPortal'
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { makeColumn, makeDateColumn, makeNumericColumn, makeNumericSorter, makeTextColumn, Table } from '@components/Table'
|
import { makeColumn, makeDateColumn, makeNumericColumn, makeNumericSorter, makeTextColumn, Table } from '@components/Table'
|
||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
import { MessageService } from '@api'
|
import { MessageService } from '@api'
|
||||||
|
|
||||||
import '@styles/filter.less'
|
import '@styles/filter.less'
|
||||||
@ -147,8 +147,4 @@ const Messages = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Messages, {
|
export default withPermissions(Messages, ['Message.get'])
|
||||||
requirements: ['Message.get'],
|
|
||||||
title: 'Сообщения',
|
|
||||||
route: 'messages',
|
|
||||||
})
|
|
||||||
|
@ -7,7 +7,7 @@ import LoaderPortal from '@components/LoaderPortal'
|
|||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import D3HorizontalPercentChart from '@components/d3/D3HorizontalPercentChart'
|
import D3HorizontalPercentChart from '@components/d3/D3HorizontalPercentChart'
|
||||||
import { DateRangeWrapper, makeColumn, makeNumericColumn, makeNumericRender, makeTextColumn, Table } from '@components/Table'
|
import { DateRangeWrapper, makeColumn, makeNumericColumn, makeNumericRender, makeTextColumn, Table } from '@components/Table'
|
||||||
import { arrayOrDefault, range, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, range, withPermissions } from '@utils'
|
||||||
import { SubsystemOperationTimeService } from '@api'
|
import { SubsystemOperationTimeService } from '@api'
|
||||||
|
|
||||||
import '@styles/filter.less'
|
import '@styles/filter.less'
|
||||||
@ -121,9 +121,4 @@ export const OperationTime = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(OperationTime, {
|
export default withPermissions(OperationTime) //, ['SubsystemOperationTime.get'])
|
||||||
requirements: [], // SubsystemOperationTime.get
|
|
||||||
title: 'Наработка',
|
|
||||||
route: 'operation_time',
|
|
||||||
key: 'operation_time',
|
|
||||||
})
|
|
||||||
|
@ -7,7 +7,7 @@ import LoaderPortal from '@components/LoaderPortal'
|
|||||||
import { DateRangeWrapper } from '@components/Table'
|
import { DateRangeWrapper } from '@components/Table'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { unique } from '@utils/filters'
|
import { unique } from '@utils/filters'
|
||||||
import { getPermissions, arrayOrDefault, range, wrapPrivateComponent, pretify } from '@utils'
|
import { getPermissions, arrayOrDefault, range, withPermissions, pretify } from '@utils'
|
||||||
import { DetectedOperationService, DrillerService, TelemetryDataSaubService } from '@api'
|
import { DetectedOperationService, DrillerService, TelemetryDataSaubService } from '@api'
|
||||||
|
|
||||||
import DrillerList from './DrillerList'
|
import DrillerList from './DrillerList'
|
||||||
@ -161,4 +161,4 @@ const Operations = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Operations, { requirements: ['DetectedOperation.get', 'TelemetryDataSaub.get'] })
|
export default withPermissions(Operations, ['DetectedOperation.get', 'TelemetryDataSaub.get'])
|
||||||
|
@ -9,7 +9,7 @@ import LoaderPortal from '@components/LoaderPortal'
|
|||||||
import { Grid, GridItem } from '@components/Grid'
|
import { Grid, GridItem } from '@components/Grid'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { PeriodPicker, defaultPeriod } from '@components/selectors/PeriodPicker'
|
import { PeriodPicker, defaultPeriod } from '@components/selectors/PeriodPicker'
|
||||||
import { formatDate, hasPermission, wrapPrivateComponent } from '@utils'
|
import { formatDate, hasPermission, withPermissions } from '@utils'
|
||||||
import { Subscribe } from '@services/signalr'
|
import { Subscribe } from '@services/signalr'
|
||||||
import {
|
import {
|
||||||
DrillFlowChartService,
|
DrillFlowChartService,
|
||||||
@ -312,14 +312,10 @@ const TelemetryView = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(TelemetryView, {
|
export default withPermissions(TelemetryView, [
|
||||||
requirements: [
|
'DrillFlowChart.get',
|
||||||
'DrillFlowChart.get',
|
'OperationStat.get',
|
||||||
'OperationStat.get',
|
'TelemetryDataSaub.get',
|
||||||
'TelemetryDataSaub.get',
|
'TelemetryDataSpin.get',
|
||||||
'TelemetryDataSpin.get',
|
'Well.get',
|
||||||
'Well.get',
|
])
|
||||||
],
|
|
||||||
title: 'Мониторинг',
|
|
||||||
route: 'telemetry',
|
|
||||||
})
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { FundViewOutlined } from '@ant-design/icons'
|
|
||||||
import { Outlet } from 'react-router-dom'
|
import { Outlet } from 'react-router-dom'
|
||||||
import { memo, useMemo } from 'react'
|
import { memo, useMemo } from 'react'
|
||||||
|
|
||||||
import { RootPathContext, useRootPath } from '@asb/context'
|
import { RootPathContext, useRootPath } from '@asb/context'
|
||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
|
|
||||||
import '@styles/index.css'
|
import '@styles/index.css'
|
||||||
|
|
||||||
@ -18,10 +17,4 @@ const Telemetry = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Telemetry, {
|
export default withPermissions(Telemetry)
|
||||||
requirements: [],
|
|
||||||
icon: <FundViewOutlined />,
|
|
||||||
title: 'Телеметрия',
|
|
||||||
route: 'telemetry/*',
|
|
||||||
key: 'telemetry',
|
|
||||||
})
|
|
||||||
|
@ -9,7 +9,7 @@ import LoaderPortal from '@components/LoaderPortal'
|
|||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { makeColumn, makeDateColumn, makeTextColumn, Table } from '@components/Table'
|
import { makeColumn, makeDateColumn, makeTextColumn, Table } from '@components/Table'
|
||||||
import { WellFinalDocumentsService } from '@api'
|
import { WellFinalDocumentsService } from '@api'
|
||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
|
|
||||||
import WellCaseEditor from './WellCaseEditor'
|
import WellCaseEditor from './WellCaseEditor'
|
||||||
import { HistoryTable } from './HistoryTable'
|
import { HistoryTable } from './HistoryTable'
|
||||||
@ -102,9 +102,4 @@ const WellCase = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(WellCase, {
|
export default withPermissions(WellCase) //, ['WellFinalDocuments.get'])
|
||||||
title: 'Дело скважины',
|
|
||||||
route: 'well_case',
|
|
||||||
requirements: [],
|
|
||||||
// requirements: ['WellFinalDocuments.get'],
|
|
||||||
})
|
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
|
|
||||||
import WellOperationsEditor from './WellOperationsEditor'
|
import WellOperationsEditor from './WellOperationsEditor'
|
||||||
|
|
||||||
export const WellOperationsEditorFact = wrapPrivateComponent(
|
export const WellOperationsEditorFact = withPermissions(
|
||||||
() => <WellOperationsEditor idType={1} tableName={'well_operations_fact'}/>,
|
() => <WellOperationsEditor idType={1} tableName={'well_operations_fact'}/>,
|
||||||
{
|
[ 'WellOperation.get' ],
|
||||||
requirements: [ 'WellOperation.get' ],
|
|
||||||
title: 'Факт',
|
|
||||||
route: 'fact',
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
export default WellOperationsEditorFact
|
export default WellOperationsEditorFact
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
|
|
||||||
import WellOperationsEditor from './WellOperationsEditor'
|
import WellOperationsEditor from './WellOperationsEditor'
|
||||||
|
|
||||||
export const WellOperationsEditorPlan = wrapPrivateComponent(
|
export const WellOperationsEditorPlan = withPermissions(
|
||||||
() => <WellOperationsEditor idType={0} tableName={'well_operations_plan'}/>,
|
() => <WellOperationsEditor idType={0} tableName={'well_operations_plan'}/>,
|
||||||
{
|
[ 'WellOperation.get' ],
|
||||||
requirements: [ 'WellOperation.get' ],
|
|
||||||
title: 'План',
|
|
||||||
route: 'plan',
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
export default WellOperationsEditorPlan
|
export default WellOperationsEditorPlan
|
||||||
|
@ -8,7 +8,7 @@ import { useTopRightBlock, useWell } from '@asb/context'
|
|||||||
import { D3Chart } from '@components/d3'
|
import { D3Chart } from '@components/d3'
|
||||||
import LoaderPortal from '@components/LoaderPortal'
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { formatDate, fractionalSum, wrapPrivateComponent, getOperations, pretify } from '@utils'
|
import { formatDate, fractionalSum, withPermissions, getOperations, pretify } from '@utils'
|
||||||
|
|
||||||
import TLPie from './TLPie'
|
import TLPie from './TLPie'
|
||||||
import TLChart from './TLChart'
|
import TLChart from './TLChart'
|
||||||
@ -294,8 +294,4 @@ const Tvd = memo(({ well: givenWell, title, ...other }) => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Tvd, {
|
export default withPermissions(Tvd, ['OperationStat.get', 'DetectedOperation.get'])
|
||||||
requirements: ['OperationStat.get', 'DetectedOperation.get'],
|
|
||||||
title: 'TVD',
|
|
||||||
route: 'tvd',
|
|
||||||
})
|
|
||||||
|
@ -2,14 +2,7 @@ import { Outlet } from 'react-router-dom'
|
|||||||
import { memo, useMemo } from 'react'
|
import { memo, useMemo } from 'react'
|
||||||
|
|
||||||
import { RootPathContext, useRootPath } from '@asb/context'
|
import { RootPathContext, useRootPath } from '@asb/context'
|
||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
|
|
||||||
const properties = {
|
|
||||||
requirements: [],
|
|
||||||
title: 'Операции по скважине',
|
|
||||||
route: 'operations/*',
|
|
||||||
key: 'operations',
|
|
||||||
}
|
|
||||||
|
|
||||||
const WellOperations = memo(() => {
|
const WellOperations = memo(() => {
|
||||||
const root = useRootPath()
|
const root = useRootPath()
|
||||||
@ -22,4 +15,4 @@ const WellOperations = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(WellOperations, properties)
|
export default withPermissions(WellOperations)
|
||||||
|
@ -4,7 +4,7 @@ import { Navigate, Route, Routes, useLocation, useParams } from 'react-router-do
|
|||||||
import { WellContext, RootPathContext, useRootPath, useLayoutProps, TopRightBlockContext } from '@asb/context'
|
import { WellContext, RootPathContext, useRootPath, useLayoutProps, TopRightBlockContext } from '@asb/context'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { MenuBreadcrumbItems } from '@components/MenuBreadcrumb'
|
import { MenuBreadcrumbItems } from '@components/MenuBreadcrumb'
|
||||||
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
|
import { NoAccessComponent, withPermissions } from '@utils'
|
||||||
import { WellService } from '@api'
|
import { WellService } from '@api'
|
||||||
|
|
||||||
import { NavigationMenu, menuItems } from './NavigationMenu'
|
import { NavigationMenu, menuItems } from './NavigationMenu'
|
||||||
@ -138,9 +138,4 @@ const Well = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Well, {
|
export default withPermissions(Well)
|
||||||
requirements: [],
|
|
||||||
title: 'Скважина',
|
|
||||||
route: 'well/:idWell/*',
|
|
||||||
key: 'well',
|
|
||||||
})
|
|
||||||
|
@ -6,7 +6,7 @@ import { Card, Form, Input, Button } from 'antd'
|
|||||||
import LoaderPortal from '@components/LoaderPortal'
|
import LoaderPortal from '@components/LoaderPortal'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { loginRules, passwordRules } from '@utils/validationRules'
|
import { loginRules, passwordRules } from '@utils/validationRules'
|
||||||
import { setUser, wrapPrivateComponent } from '@utils'
|
import { setUser, withPermissions } from '@utils'
|
||||||
import { AuthService } from '@api'
|
import { AuthService } from '@api'
|
||||||
|
|
||||||
import '@styles/index.css'
|
import '@styles/index.css'
|
||||||
@ -59,8 +59,4 @@ const Login = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Login, {
|
export default withPermissions(Login)
|
||||||
requirements: [],
|
|
||||||
title: 'Вход в систему',
|
|
||||||
route: 'login',
|
|
||||||
})
|
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
passwordRules,
|
passwordRules,
|
||||||
phoneRules
|
phoneRules
|
||||||
} from '@utils/validationRules'
|
} from '@utils/validationRules'
|
||||||
import { wrapPrivateComponent } from '@utils'
|
import { withPermissions } from '@utils'
|
||||||
|
|
||||||
import Logo from '@images/Logo'
|
import Logo from '@images/Logo'
|
||||||
|
|
||||||
@ -92,8 +92,4 @@ export const Register = memo(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wrapPrivateComponent(Register, {
|
export default withPermissions(Register)
|
||||||
requirements: [],
|
|
||||||
title: 'Регистрация',
|
|
||||||
route: 'register',
|
|
||||||
})
|
|
||||||
|
@ -1,29 +1,12 @@
|
|||||||
export * from './arrayOrDefault'
|
export * from './arrayOrDefault'
|
||||||
|
|
||||||
export * from './datetime'
|
export * from './datetime'
|
||||||
export type { RawDate, TimezoneId, timeInS } from './datetime'
|
|
||||||
|
|
||||||
export * from './chart'
|
export * from './chart'
|
||||||
|
|
||||||
export * from './min_max_filter'
|
export * from './min_max_filter'
|
||||||
export type { KeyType } from './min_max_filter'
|
|
||||||
|
|
||||||
export * from './objects'
|
export * from './objects'
|
||||||
|
|
||||||
export * from './numbers'
|
export * from './numbers'
|
||||||
|
|
||||||
export * from './permissions'
|
export * from './permissions'
|
||||||
export type { Role, Permission, ServiceName, ServiceRequestType, PermissionRequest, PermissionRecord, PrivateProps } from './permissions'
|
|
||||||
|
|
||||||
export * from './saubOperations'
|
export * from './saubOperations'
|
||||||
export type { SaubData } from './saubOperations'
|
|
||||||
|
|
||||||
export * from './storage'
|
export * from './storage'
|
||||||
export type { StorageNames, DataDashboardNNB } from './storage'
|
|
||||||
|
|
||||||
export * from './string'
|
export * from './string'
|
||||||
|
|
||||||
export * from './svg'
|
export * from './svg'
|
||||||
|
|
||||||
export * from './table_settings'
|
export * from './table_settings'
|
||||||
export type { TableColumnSettings, TableSettings, TableSettingsStore } from './table_settings'
|
|
||||||
|
@ -87,17 +87,7 @@ export const publicPages: Readonly<string[]> = [
|
|||||||
'/register',
|
'/register',
|
||||||
]
|
]
|
||||||
|
|
||||||
export type PrivateProps = {
|
export type PrivateComponent<P extends object> = NamedExoticComponent<P>
|
||||||
key?: string
|
|
||||||
icon?: ReactNode
|
|
||||||
route?: string
|
|
||||||
title?: ReactNode
|
|
||||||
requirements?: string[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export type PrivateComponent<P extends object> = NamedExoticComponent<P> & PrivateProps & {
|
|
||||||
getKey: () => string
|
|
||||||
}
|
|
||||||
|
|
||||||
export const NoAccessComponent = memo(() => getUser().login ? (
|
export const NoAccessComponent = memo(() => getUser().login ? (
|
||||||
<AccessDenied /> // <Navigate to={'/access_denied'} replace />
|
<AccessDenied /> // <Navigate to={'/access_denied'} replace />
|
||||||
@ -105,18 +95,13 @@ export const NoAccessComponent = memo(() => getUser().login ? (
|
|||||||
<Navigate to={'/login'} replace />
|
<Navigate to={'/login'} replace />
|
||||||
))
|
))
|
||||||
|
|
||||||
export const wrapPrivateComponent = <P extends object>(
|
export const withPermissions = <P extends object>(
|
||||||
Component: NamedExoticComponent<P> | ((props: P) => ReactElement),
|
Component: NamedExoticComponent<P> | ((props: P) => ReactElement),
|
||||||
properties: PrivateProps = {},
|
requirements: Permission[] = [],
|
||||||
elseNode: JSX.Element = <NoAccessComponent />
|
elseNode: JSX.Element = <NoAccessComponent />
|
||||||
): PrivateComponent<P> => Object.assign(
|
): PrivateComponent<P> => Object.assign(memo<P>(function PrivateWrapper(props) {
|
||||||
memo<P>((props) => hasPermission(properties.requirements) ? <Component {...props} /> : elseNode),
|
return hasPermission(requirements) ? <Component {...props} /> : elseNode
|
||||||
{
|
}))
|
||||||
getKey() { return this.key ?? this.route ?? '' },
|
|
||||||
requirements: [],
|
|
||||||
...properties,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
export const getTabname = () => {
|
export const getTabname = () => {
|
||||||
const params = useParams()
|
const params = useParams()
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
export * from './cachedFetch'
|
export * from './cachedFetch'
|
||||||
|
|
||||||
export * from './functionalValue'
|
export * from './functionalValue'
|
||||||
export type { FunctionalValue } from './functionalValue'
|
|
||||||
|
|
||||||
export * from './usePartialProps'
|
export * from './usePartialProps'
|
||||||
|
|
||||||
export * from './useUserSettings'
|
export * from './useUserSettings'
|
||||||
|
Loading…
Reference in New Issue
Block a user