Skip to content

Commit a19c75f

Browse files
authored
Merge pull request #4177 from RedisInsight/fe/bugfix/RI-6265_update-list-of-databases
#RI-6377, #RI-6378 - defect fixing
2 parents a800f1a + f487340 commit a19c75f

File tree

4 files changed

+58
-70
lines changed

4 files changed

+58
-70
lines changed

redisinsight/ui/src/pages/home/components/connection-url/ConnectionUrl.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const getPayload = (connectionUrl: string, returnOnError = false) => {
3535
if (!details && returnOnError) return null
3636

3737
return {
38-
name: details?.hostname || 'localhost:6379',
39-
host: details?.host || 'localhost',
38+
name: details?.hostname || '127.0.0.1:6379',
39+
host: details?.host || '127.0.0.1',
4040
port: details?.port || 6379,
4141
username: details?.username || undefined,
4242
password: details?.password || undefined,
@@ -129,7 +129,7 @@ const ConnectionUrl = (props: Props) => {
129129
value={formik.values.connectionURL}
130130
onChange={formik.handleChange}
131131
fullWidth
132-
placeholder="redis://localhost:6379"
132+
placeholder="redis://127.0.0.1:6379"
133133
resize="none"
134134
style={{ height: 88 }}
135135
data-testid="connection-url"

redisinsight/ui/src/pages/home/components/database-panel-dialog/DatabasePanelDialog.tsx

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -83,41 +83,42 @@ const DatabasePanelDialog = (props: Props) => {
8383
}
8484
}, [editMode])
8585

86+
useEffect(() => {
87+
if (!isOpen) {
88+
// clear state after closing dialog
89+
setConnectionType(null)
90+
if (connectionType === AddDbType.manual) return
91+
92+
switch (connectionType) {
93+
case AddDbType.cloud: {
94+
dispatch(resetDataRedisCluster())
95+
dispatch(resetDataSentinel())
96+
break
97+
}
98+
99+
case AddDbType.sentinel: {
100+
dispatch(resetDataRedisCloud())
101+
dispatch(resetDataRedisCluster())
102+
break
103+
}
104+
105+
case AddDbType.software: {
106+
dispatch(resetDataRedisCloud())
107+
dispatch(resetDataSentinel())
108+
break
109+
}
110+
default:
111+
break
112+
}
113+
}
114+
}, [isOpen, connectionType])
115+
86116
const changeConnectionType = (connectionType: AddDbType, db: any) => {
87117
dispatch(setUrlHandlingInitialState())
88118
setInitialValues(db)
89119
setConnectionType(connectionType)
90120
}
91121

92-
const handleClose = () => {
93-
setConnectionType(null)
94-
onClose?.()
95-
96-
if (connectionType === AddDbType.manual) return
97-
98-
switch (connectionType) {
99-
case AddDbType.cloud: {
100-
dispatch(resetDataRedisCluster())
101-
dispatch(resetDataSentinel())
102-
break
103-
}
104-
105-
case AddDbType.sentinel: {
106-
dispatch(resetDataRedisCloud())
107-
dispatch(resetDataRedisCluster())
108-
break
109-
}
110-
111-
case AddDbType.software: {
112-
dispatch(resetDataRedisCloud())
113-
dispatch(resetDataSentinel())
114-
break
115-
}
116-
default:
117-
break
118-
}
119-
}
120-
121122
const handleClickBack = () => {
122123
setConnectionType(null)
123124
}
@@ -127,29 +128,21 @@ const DatabasePanelDialog = (props: Props) => {
127128
{connectionType === null && (
128129
<ConnectionUrlForm
129130
onSelectOption={changeConnectionType}
130-
onClose={handleClose}
131131
/>
132132
)}
133133
{connectionType === AddDbType.manual && (
134134
<ManualConnectionWrapper
135135
{...props}
136136
initialValues={initialValues}
137-
onClose={handleClose}
138137
onClickBack={handleClickBack}
139138
/>
140139
)}
141140
{connectionType === AddDbType.cloud && (
142-
<CloudConnectionFormWrapper {...props} onClose={handleClose} />
143-
)}
144-
{connectionType === AddDbType.import && (
145-
<ImportDatabase onClose={handleClose} />
146-
)}
147-
{connectionType === AddDbType.sentinel && (
148-
<SentinelConnectionWrapper {...props} onClose={handleClose} />
149-
)}
150-
{connectionType === AddDbType.software && (
151-
<ClusterConnectionFormWrapper {...props} onClose={handleClose} />
141+
<CloudConnectionFormWrapper {...props} />
152142
)}
143+
{connectionType === AddDbType.import && (<ImportDatabase onClose={onClose} />)}
144+
{connectionType === AddDbType.sentinel && (<SentinelConnectionWrapper {...props} />)}
145+
{connectionType === AddDbType.software && (<ClusterConnectionFormWrapper {...props} />)}
153146
</>
154147
)
155148

@@ -179,7 +172,7 @@ const DatabasePanelDialog = (props: Props) => {
179172
return (
180173
<FormDialog
181174
isOpen={isOpen}
182-
onClose={handleClose}
175+
onClose={onClose}
183176
header={modalHeader ?? (<EuiTitle size="s"><h4>Add Database</h4></EuiTitle>)}
184177
footer={<div id="footerDatabaseForm" />}
185178
>

redisinsight/ui/src/pages/home/components/form/Messages.tsx

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import React from 'react'
2-
import { EuiLink, EuiText } from '@elastic/eui'
2+
import { EuiText } from '@elastic/eui'
3+
import cx from 'classnames'
34
import { APPLICATION_NAME } from 'uiSrc/constants'
45

56
import { getUtmExternalLink } from 'uiSrc/utils/links'
7+
import { ExternalLink } from 'uiSrc/components'
68
import styles from '../styles.module.scss'
79

810
const MessageCloudApiKeys = () => (
911
<EuiText color="subdued" size="s" className={styles.message} data-testid="summary">
1012
{'Enter Redis Cloud API keys to discover and add databases. API keys can be enabled by following the steps mentioned in the '}
11-
<EuiLink
12-
color="text"
13-
className={styles.link}
14-
external={false}
15-
target="_blank"
13+
14+
<ExternalLink
15+
className={cx(styles.link, styles.external)}
1616
href="https://docs.redis.com/latest/rc/api/get-started/enable-the-api/"
1717
>
1818
documentation.
19-
</EuiLink>
19+
</ExternalLink>
2020
</EuiText>
2121
)
2222

@@ -26,15 +26,12 @@ const MessageStandalone = () => (
2626
{' '}
2727
{APPLICATION_NAME}
2828
. &nbsp;
29-
<EuiLink
30-
color="text"
29+
<ExternalLink
30+
className={cx(styles.link, styles.external)}
3131
href={getUtmExternalLink('https://redis.io/docs/latest/develop/connect/insight#connection-management', { campaign: 'redisinsight' })}
32-
className={styles.link}
33-
external={false}
34-
target="_blank"
3532
>
3633
Learn more here.
37-
</EuiLink>
34+
</ExternalLink>
3835
</EuiText>
3936
)
4037

@@ -45,15 +42,12 @@ const MessageSentinel = () => (
4542
{' '}
4643
{APPLICATION_NAME}
4744
. &nbsp;
48-
<EuiLink
49-
color="text"
45+
<ExternalLink
46+
className={cx(styles.link, styles.external)}
5047
href={getUtmExternalLink('https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/', { campaign: 'redisinsight' })}
51-
className={styles.link}
52-
external={false}
53-
target="_blank"
5448
>
5549
Learn more here.
56-
</EuiLink>
50+
</ExternalLink>
5751
</EuiText>
5852
)
5953

@@ -64,15 +58,12 @@ const MessageEnterpriceSoftware = () => (
6458
{' '}
6559
{APPLICATION_NAME}
6660
. &nbsp;
67-
<EuiLink
68-
color="text"
61+
<ExternalLink
62+
className={cx(styles.link, styles.external)}
6963
href={getUtmExternalLink('https://redis.io/redis-enterprise-software/overview/', { campaign: 'redisinsight' })}
70-
className={styles.link}
71-
external={false}
72-
target="_blank"
7364
>
7465
Learn more here.
75-
</EuiLink>
66+
</ExternalLink>
7667
</EuiText>
7768
)
7869

redisinsight/ui/src/pages/home/components/styles.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@
143143
&:hover {
144144
text-decoration: none !important;
145145
}
146+
147+
&.external:global(.euiLink) {
148+
color: var(--externalLinkColor) !important;
149+
}
146150
}
147151

148152
.fullWidth {

0 commit comments

Comments
 (0)