Skip to content

Commit 2948bac

Browse files
RI-7187 fix behavior after verification. popup was shown while loading was in progress (#4756)
1 parent 0d149d9 commit 2948bac

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

redisinsight/ui/src/pages/rdi/pipeline-management/components/source-pipeline-dialog/SourcePipelineModal.spec.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,20 @@ describe('SourcePipelineDialog', () => {
139139

140140
expect(screen.queryByTestId('file-source-pipeline-dialog')).not.toBeInTheDocument()
141141
})
142+
143+
it('should not show dialog when config is fetching', () => {
144+
const sendEventTelemetryMock = jest.fn()
145+
;(sendEventTelemetry as jest.Mock).mockImplementation(
146+
() => sendEventTelemetryMock,
147+
)
148+
;(rdiPipelineSelector as jest.Mock).mockReturnValue({
149+
...initialStateDefault.rdi.pipeline,
150+
loading: true,
151+
config: '',
152+
})
153+
154+
render(<SourcePipelineDialog />)
155+
156+
expect(screen.queryByTestId('file-source-pipeline-dialog')).not.toBeInTheDocument()
157+
})
142158
})

redisinsight/ui/src/pages/rdi/pipeline-management/components/source-pipeline-dialog/SourcePipelineModal.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState } from 'react'
1+
import React, { useState } from 'react'
22
import {
33
EuiIcon,
44
EuiModal,
@@ -40,8 +40,6 @@ export enum PipelineSourceOptions {
4040

4141
const SourcePipelineDialog = () => {
4242
const [isShowDownloadDialog, setIsShowDownloadDialog] = useState(false)
43-
const [hasRdiPipelineDeployed, setHasRdiPipelineDeployed] =
44-
useState(false)
4543

4644
const { rdiInstanceId } = useParams<{ rdiInstanceId: string }>()
4745

@@ -50,10 +48,6 @@ const SourcePipelineDialog = () => {
5048
const { loading: pipelineLoading, config: pipelineConfig } =
5149
useSelector(rdiPipelineSelector)
5250

53-
useEffect(() => {
54-
setHasRdiPipelineDeployed(!pipelineLoading && pipelineConfig?.length > 0)
55-
}, [pipelineConfig, pipelineLoading])
56-
5751
const dispatch = useDispatch()
5852

5953
const onSelect = (option: PipelineSourceOptions) => {
@@ -106,7 +100,7 @@ const SourcePipelineDialog = () => {
106100
)
107101
}
108102

109-
if (!isOpenDialog || hasRdiPipelineDeployed) {
103+
if (!isOpenDialog || pipelineConfig?.length > 0 || pipelineLoading) {
110104
return null
111105
}
112106

0 commit comments

Comments
 (0)