Skip to content

Commit 0d78a9d

Browse files
Merge pull request #2549 from RedisInsight/build/bugfix/RI-4723_Open_RI_from_SM
#RI-4916, #RI-4917, #RI-4918, #RI-4920, #RI-4921
2 parents 919c882 + 5591bc4 commit 0d78a9d

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

redisinsight/ui/src/components/global-url-handler/GlobalUrlHandler.spec.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ describe('GlobalUrlHandler', () => {
8787

8888
expect(store.getActions()).toEqual([
8989
setUrlProperties(urlProperties),
90+
setFromUrl(null),
9091
setUrlHandlingInitialState(),
9192
addInfiniteNotification(INFINITE_MESSAGES.AUTO_CREATING_DATABASE())
9293
])
@@ -117,6 +118,7 @@ describe('GlobalUrlHandler', () => {
117118

118119
const expectedActions = [
119120
setUrlProperties(urlProperties),
121+
setFromUrl(null),
120122
setUrlDbConnection({
121123
action: UrlHandlingActions.Connect,
122124
dbConnection: {
@@ -127,7 +129,7 @@ describe('GlobalUrlHandler', () => {
127129
tls: false,
128130
username: undefined
129131
}
130-
})
132+
}),
131133
]
132134

133135
expect(store.getActions().slice(0, expectedActions.length)).toEqual(expectedActions)
@@ -160,6 +162,7 @@ describe('GlobalUrlHandler', () => {
160162

161163
const expectedActions = [
162164
setUrlProperties(urlProperties),
165+
setFromUrl(null),
163166
setUrlDbConnection({
164167
action: UrlHandlingActions.Connect,
165168
dbConnection: {

redisinsight/ui/src/components/global-url-handler/GlobalUrlHandler.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const GlobalUrlHandler = () => {
3737
// @ts-ignore
3838
const urlProperties = Object.fromEntries(fromParams) || {}
3939
dispatch(setUrlProperties(urlProperties))
40+
dispatch(setFromUrl(null))
4041

4142
const pathname = actionUrl.hostname + actionUrl.pathname
4243
if (pathname?.replace(/^(\/\/?)/g, '') === UrlHandlingActions.Connect) {
@@ -94,8 +95,6 @@ const GlobalUrlHandler = () => {
9495

9596
const url = new ConnectionString(redisUrl)
9697

97-
console.log(url)
98-
9998
/* If a protocol exists, it should be a redis protocol */
10099
if (url.protocol && !REDIS_URI_SCHEMES.includes(url.protocol)) return
101100

redisinsight/ui/src/pages/home/HomePage.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ import { resetDataSentinel, sentinelSelector } from 'uiSrc/slices/instances/sent
2424
import { appAnalyticsInfoSelector } from 'uiSrc/slices/app/info'
2525
import { fetchContentAction as fetchCreateRedisButtonsAction } from 'uiSrc/slices/content/create-redis-buttons'
2626
import { sendEventTelemetry, sendPageViewTelemetry, TelemetryEvent, TelemetryPageView } from 'uiSrc/telemetry'
27+
import { appRedirectionSelector, setUrlHandlingInitialState } from 'uiSrc/slices/app/url-handling'
28+
import { UrlHandlingActions } from 'uiSrc/slices/interfaces/urlHandling'
2729
import AddDatabaseContainer, { AddDbType } from './components/AddDatabases/AddDatabasesContainer'
2830
import DatabasesList from './components/DatabasesListComponent/DatabasesListWrapper'
2931
import WelcomeComponent from './components/WelcomeComponent/WelcomeComponent'
3032
import HomeHeader from './components/HomeHeader'
3133

3234
import './styles.scss'
3335
import styles from './styles.module.scss'
34-
import { appRedirectionSelector, setUrlHandlingInitialState } from 'uiSrc/slices/app/url-handling'
35-
import { UrlHandlingActions } from 'uiSrc/slices/interfaces/urlHandling'
3636

3737
const HomePage = () => {
3838
const [width, setWidth] = useState(0)
@@ -81,12 +81,6 @@ const HomePage = () => {
8181
})
8282
}, [])
8383

84-
useEffect(() => {
85-
if (action === UrlHandlingActions.Connect) {
86-
setAddDialogIsOpen(true)
87-
}
88-
}, [action])
89-
9084
useEffect(() => {
9185
if (isDeletedInstance) {
9286
dispatch(fetchInstancesAction())
@@ -120,6 +114,12 @@ const HomePage = () => {
120114
}
121115
}, [clusterCredentials, cloudCredentials, sentinelInstance])
122116

117+
useEffect(() => {
118+
if (action === UrlHandlingActions.Connect) {
119+
setAddDialogIsOpen(true)
120+
}
121+
}, [action, dbConnection])
122+
123123
useEffect(() => {
124124
const isDialogOpen = !!instances.length && (addDialogIsOpen || editDialogIsOpen)
125125

@@ -311,6 +311,7 @@ const HomePage = () => {
311311
editMode={false}
312312
width={width}
313313
isResizablePanel
314+
urlHandlingAction={action}
314315
initialValues={dbConnection ?? null}
315316
editedInstance={sentinelInstance ?? null}
316317
onClose={handleClose}

redisinsight/ui/src/pages/home/components/AddDatabases/AddDatabasesContainer.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { Instance, InstanceType } from 'uiSrc/slices/interfaces'
1919
import { sentinelSelector, resetDataSentinel } from 'uiSrc/slices/instances/sentinel'
2020

2121
import { UrlHandlingActions } from 'uiSrc/slices/interfaces/urlHandling'
22+
import { appRedirectionSelector } from 'uiSrc/slices/app/url-handling'
2223
import InstanceConnections from './InstanceConnections/InstanceConnections'
2324
import InstanceFormWrapper from '../AddInstanceForm/InstanceFormWrapper'
2425
import ClusterConnectionFormWrapper from '../ClusterConnection/ClusterConnectionFormWrapper'
@@ -63,6 +64,7 @@ const AddDatabasesContainer = React.memo((props: Props) => {
6364
const { credentials: clusterCredentials } = useSelector(clusterSelector)
6465
const { credentials: cloudCredentials } = useSelector(cloudSelector)
6566
const { data: sentinelMasters } = useSelector(sentinelSelector)
67+
const { action, dbConnection } = useSelector(appRedirectionSelector)
6668

6769
const dispatch = useDispatch()
6870

@@ -84,6 +86,12 @@ const AddDatabasesContainer = React.memo((props: Props) => {
8486
}
8587
}, [])
8688

89+
useEffect(() => {
90+
if (action === UrlHandlingActions.Connect) {
91+
setConnectionType(AddDbType.manual)
92+
}
93+
}, [action, dbConnection])
94+
8795
useEffect(() =>
8896
// ComponentWillUnmount
8997
() => {

0 commit comments

Comments
 (0)