MSP-3205 add navigate to newConfig
This commit is contained in:
1 parent
52b1001628
commit
a5dd9a4060
2 files changed
+9
-5
No files matched your search
@@ -17,6 +17,8 @@ import './active-configurations-table.scss'
|
|||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import CanEdit from '@components/CanEdit'
|
import CanEdit from '@components/CanEdit'
|
||||||
import { dateFormats } from '@constants/date.ts'
|
import { dateFormats } from '@constants/date.ts'
|
||||||
|
import { routePaths } from '@routes/routePaths.ts'
|
||||||
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
|
|
||||||
|
|
||||||
const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> =
|
const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> =
|
||||||
@@ -24,7 +26,8 @@ const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> =
|
|||||||
isActiveTable = false,
|
isActiveTable = false,
|
||||||
handleShowConfig,
|
handleShowConfig,
|
||||||
handleShowCompareModal,
|
handleShowCompareModal,
|
||||||
data
|
data,
|
||||||
|
currentModule = {}
|
||||||
}) => {
|
}) => {
|
||||||
const [editKeyConfig, setEditKeyConfig] = useState<string>('')
|
const [editKeyConfig, setEditKeyConfig] = useState<string>('')
|
||||||
const [tempEditValues, setTempEditValues] = useState<any>()
|
const [tempEditValues, setTempEditValues] = useState<any>()
|
||||||
@@ -32,7 +35,8 @@ const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> =
|
|||||||
const [createUpdateConfig] = configApi.useCreateUpdateConfigMutation()
|
const [createUpdateConfig] = configApi.useCreateUpdateConfigMutation()
|
||||||
const [markConfigAsActive] = configApi.useMarkConfigAsActiveMutation()
|
const [markConfigAsActive] = configApi.useMarkConfigAsActiveMutation()
|
||||||
const [deleteConfig] = configApi.useDeleteConfigMutation()
|
const [deleteConfig] = configApi.useDeleteConfigMutation()
|
||||||
|
const navigate = useNavigate()
|
||||||
|
const {id: moduleId} = useParams()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputRefs.current[editKeyConfig]) {
|
if (inputRefs.current[editKeyConfig]) {
|
||||||
@@ -198,9 +202,7 @@ const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> =
|
|||||||
{!isActiveTable && <CanEdit>
|
{!isActiveTable && <CanEdit>
|
||||||
<Button
|
<Button
|
||||||
className="configurations__buttons__new-config-brn"
|
className="configurations__buttons__new-config-brn"
|
||||||
onClick={() => {
|
onClick={() => navigate(`/${moduleId}/${routePaths.configEditor}/new`, {state: currentModule})}
|
||||||
// TODO создание новой конфигурации
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Создать
|
Создать
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ const Configurations = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<ActiveConfigurationsTable
|
<ActiveConfigurationsTable
|
||||||
|
currentModule={currentModule}
|
||||||
isActiveTable
|
isActiveTable
|
||||||
data={isError ? [] : activeConfigs}
|
data={isError ? [] : activeConfigs}
|
||||||
handleShowConfig={(config) => {
|
handleShowConfig={(config) => {
|
||||||
@@ -113,6 +114,7 @@ const Configurations = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ActiveConfigurationsTable
|
<ActiveConfigurationsTable
|
||||||
|
currentModule={currentModule}
|
||||||
data={isError ? [] : inactiveConfigs}
|
data={isError ? [] : inactiveConfigs}
|
||||||
handleShowConfig={(config) => {
|
handleShowConfig={(config) => {
|
||||||
setCurrentConfig(config)
|
setCurrentConfig(config)
|
||||||
|
|||||||
Reference in new issue
Block a user