Меморизация дополнена

This commit is contained in:
Александр Сироткин 2022-02-10 15:49:39 +05:00
parent de8a0f6203
commit 90d95c9964
8 changed files with 27 additions and 27 deletions

View File

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { memo, useEffect, useState } from 'react'
import {
EditableTable,
@ -17,7 +17,7 @@ import { hasPermission } from '@utils/permissions'
import { coordsFixed } from './DepositController'
export const ClusterController = () => {
export const ClusterController = memo(() => {
const [deposits, setDeposits] = useState([])
const [clusters, setClusters] = useState([])
const [showLoader, setShowLoader] = useState(false)
@ -82,6 +82,6 @@ export const ClusterController = () => {
/>
</LoaderPortal>
)
}
})
export default ClusterController

View File

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { memo, useEffect, useState } from 'react'
import {
EditableTable,
@ -16,7 +16,7 @@ import { min1 } from '@utils/validationRules'
import { hasPermission } from '@utils/permissions'
export const CompanyController = () => {
export const CompanyController = memo(() => {
const [columns, setColumns] = useState([])
const [companies, setCompanies] = useState([])
const [showLoader, setShowLoader] = useState(false)
@ -79,6 +79,6 @@ export const CompanyController = () => {
/>
</LoaderPortal>
)
}
})
export default CompanyController

View File

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { memo, useEffect, useState } from 'react'
import {
EditableTable,
@ -12,7 +12,7 @@ import { invokeWebApiWrapperAsync } from '@components/factory'
import { AdminCompanyTypeService } from '@api'
import { arrayOrDefault } from '@utils'
import { min1 } from '@utils/validationRules'
import { hasPermission } from '@asb/utils/permissions'
import { hasPermission } from '@utils/permissions'
const columns = [
makeColumn('Название', 'caption', {
@ -23,7 +23,7 @@ const columns = [
}),
]
export const CompanyTypeController = () => {
export const CompanyTypeController = memo(() => {
const [companyTypes, setCompanyTypes] = useState([])
const [showLoader, setShowLoader] = useState(false)
@ -60,6 +60,6 @@ export const CompanyTypeController = () => {
/>
</LoaderPortal>
)
}
})
export default CompanyTypeController

View File

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { memo, useEffect, useState } from 'react'
import LoaderPortal from '@components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '@components/factory'
@ -16,7 +16,7 @@ const depositColumns = [
makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFixed })
]
export const DepositController = () => {
export const DepositController = memo(() => {
const [deposits, setDeposits] = useState([])
const [showLoader, setShowLoader] = useState(false)
@ -53,6 +53,6 @@ export const DepositController = () => {
/>
</LoaderPortal>
)
}
})
export default DepositController

View File

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { memo, useEffect, useState } from 'react'
import {
EditableTable,
@ -26,7 +26,7 @@ const columns = [
}),
]
export const PermissionController = () => {
export const PermissionController = memo(() => {
const [showLoader, setShowLoader] = useState(false)
const [permissions, setPermissions] = useState([])
@ -63,6 +63,6 @@ export const PermissionController = () => {
/>
</LoaderPortal>
)
}
})
export default PermissionController

View File

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { memo, useEffect, useState } from 'react'
import {
defaultPagination,
@ -29,7 +29,7 @@ const columns = [
makeTextColumn('Версия Спин Мастер', 'spinPlcVersion'),
]
export const TelemetryController = () => {
export const TelemetryController = memo(() => {
const [telemetryData, setTelemetryData] = useState([])
const [isLoading, setIsLoading] = useState(false)
@ -59,6 +59,6 @@ export const TelemetryController = () => {
/>
</LoaderPortal>
)
}
})
export default TelemetryController

View File

@ -1,6 +1,6 @@
import { Button, Tag } from 'antd'
import { UserSwitchOutlined } from '@ant-design/icons'
import { useEffect, useState } from 'react'
import { memo, useEffect, useState } from 'react'
import {
EditableTable,
@ -17,14 +17,14 @@ import { ChangePassword } from '@components/ChangePassword'
import { invokeWebApiWrapperAsync } from '@components/factory'
import { AdminCompanyService, AdminUserRoleService, AdminUserService } from '@api'
import { createLoginRules, nameRules, phoneRules, emailRules } from '@utils/validationRules'
import { makeTextOnFilter, makeTextFilters, makeObjectOnFilter, makeArrayOnFilter } from '@utils/table'
import { makeTextOnFilter, makeTextFilters, makeArrayOnFilter } from '@utils/table'
import { hasPermission } from '@utils/permissions'
import { arrayOrDefault } from '@utils'
import RoleTag from './RoleTag'
export const UserController = () => {
export const UserController = memo(() => {
const [users, setUsers] = useState([])
const [showLoader, setShowLoader] = useState(false)
const [columns, setColumns] = useState([])
@ -174,6 +174,6 @@ export const UserController = () => {
/>
</>
)
}
})
export default UserController

View File

@ -1,6 +1,6 @@
import { useEffect, useState } from 'react'
import { Button } from 'antd'
import { CopyOutlined } from '@ant-design/icons'
import { memo, useEffect, useState } from 'react'
import {
AdminClusterService,
@ -21,20 +21,20 @@ import {
import LoaderPortal from '@components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '@components/factory'
import { TelemetryView, CompanyView } from '@components/views'
import { hasPermission } from '@utils/permissions'
import { arrayOrDefault } from '@utils'
import { coordsFixed } from '../DepositController'
import TelemetrySelect from './TelemetrySelect'
import '@styles/admin.css'
import { hasPermission } from '@asb/utils/permissions'
const wellTypes = [
{ value: 1, label: 'Наклонно-направленная' },
{ value: 2, label: 'Горизонтальная' },
]
export const WellController = () => {
export const WellController = memo(() => {
const [columns, setColumns] = useState([])
const [wells, setWells] = useState([])
const [showLoader, setShowLoader] = useState(false)
@ -135,6 +135,6 @@ export const WellController = () => {
/>
</LoaderPortal>
)
}
})
export default WellController