Skip to content

Commit 1655711

Browse files
authored
RI-7681: [NEW UI] Add DB form (#5120)
* edit text casing * change modal title from M to L * increase button sizes * remove unused style, add spacing * remove unneeded styles and add wrapper styled component for scrollable body * style the connection url, remove some styles on the way * remove hard coded unneeded textarea height * add padding on the scrollable wrapper; remove some unneded styles * Refactor and move horizontal rule * remove rocket svg and its usages * use different redis cloud icon * move shield and redis software to icon registry and refactor connectivity options * removing the size from the icon button as it follows the one set to the button anyway * make title one liner - change badge color * remove bunch of unused styles * remove unneeded styles for the tooltip anchor and replace with flex item * revert values interface :) * move the custom horizontal rule to styles.ts file
1 parent 2723218 commit 1655711

File tree

19 files changed

+107
-263
lines changed

19 files changed

+107
-263
lines changed

redisinsight/ui/src/assets/img/icons/rocket.svg

Lines changed: 0 additions & 37 deletions
This file was deleted.

redisinsight/ui/src/assets/img/oauth/rocket.svg

Lines changed: 0 additions & 10 deletions
This file was deleted.

redisinsight/ui/src/assets/img/rdi/rocket.svg

Lines changed: 0 additions & 6 deletions
This file was deleted.

redisinsight/ui/src/components/base/forms/buttons/Button.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ export const BaseButton = ({
3535
icon={icon}
3636
iconSide={iconSide}
3737
loading={loading}
38-
size={btnSize}
3938
/>
4039
{children}
4140
<ButtonIcon
4241
buttonSide="right"
4342
icon={icon}
4443
iconSide={iconSide}
4544
loading={loading}
46-
size={btnSize}
4745
/>
4846
</Button>
4947
)

redisinsight/ui/src/components/base/icons/iconRegistry.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import RedisDbBlueSvg from 'uiSrc/assets/img/icons/redis_db_blue.svg?react'
3636
import RedisLogoFullSvg from 'uiSrc/assets/img/logo.svg?react'
3737
import RedisLogoSvg from 'uiSrc/assets/img/logo_small.svg?react'
3838
import ResetSvg from 'uiSrc/assets/img/rdi/reset.svg?react'
39-
import RocketSvg from 'uiSrc/assets/img/rdi/rocket.svg?react'
4039
import ShrinkSvg from 'uiSrc/assets/img/icons/shrink.svg?react'
4140
import SilentModeSvg from 'uiSrc/assets/img/icons/silent_mode.svg?react'
4241
import SnoozeSvg from 'uiSrc/assets/img/icons/snooze.svg?react'
@@ -130,12 +129,9 @@ import PipelineStatisticsSvg from 'uiSrc/assets/img/sidebar/pipeline_statistics.
130129
import PubSubSvg from 'uiSrc/assets/img/sidebar/pubsub.svg?react'
131130
import SlowLogSvg from 'uiSrc/assets/img/sidebar/slowlog.svg?react'
132131
import WorkbenchSvg from 'uiSrc/assets/img/sidebar/workbench.svg?react'
133-
// Missing SVGs and not used/legacy:
134-
// import BrowserActiveSvg from 'uiSrc/assets/img/sidebar/browser_active.svg?react'
135-
// import PipelineStatisticsActiveSvg from 'uiSrc/assets/img/sidebar/pipeline_statistics_active.svg?react'
136-
// import PubSubActiveSvg from 'uiSrc/assets/img/sidebar/pubsub_active.svg?react'
137-
// import SlowLogActiveSvg from 'uiSrc/assets/img/sidebar/slowlog_active.svg?react'
138-
// import WorkbenchActiveSvg from 'uiSrc/assets/img/sidebar/workbench_active.svg?react'
132+
133+
import ShieldSvg from 'uiSrc/assets/img/shield.svg?react'
134+
import RedisSoftwareSvg from 'uiSrc/assets/img/redis-software.svg?react'
139135

140136
import { Icon, IconProps } from './Icon'
141137

@@ -208,7 +204,6 @@ export const RedisDbBlueIcon = createIconComponent(RedisDbBlueSvg)
208204
export const RedisLogo = createIconComponent(RedisLogoSvg)
209205
export const RedisLogoFullIcon = createIconComponent(RedisLogoFullSvg)
210206
export const RiResetIcon = createIconComponent(ResetSvg)
211-
export const RiRocketIcon = createIconComponent(RocketSvg)
212207
export const RiStarsIcon = createIconComponent(StarsSvg)
213208
export const RiStopIcon = createIconComponent(StopIconSvg)
214209
export const RiUserIcon = createIconComponent(UserSvg)
@@ -308,10 +303,6 @@ export const PipelineStatisticsIcon = createIconComponent(PipelineStatisticsSvg)
308303
export const PubSubIcon = createIconComponent(PubSubSvg)
309304
export const SlowLogIcon = createIconComponent(SlowLogSvg)
310305
export const WorkbenchIcon = createIconComponent(WorkbenchSvg)
311-
// export const BrowserActiveIcon = createIconComponent(BrowserActiveSvg)
312-
// export const PipelineStatisticsActiveIcon = createIconComponent(
313-
// PipelineStatisticsActiveSvg,
314-
// )
315-
// export const PubSubActiveIcon = createIconComponent(PubSubActiveSvg)
316-
// export const SlowLogActiveIcon = createIconComponent(SlowLogActiveSvg)
317-
// export const WorkbenchActiveIcon = createIconComponent(WorkbenchActiveSvg)
306+
307+
export const ShieldIcon = createIconComponent(ShieldSvg)
308+
export const RedisSoftwareIcon = createIconComponent(RedisSoftwareSvg)

redisinsight/ui/src/components/side-panels/panels/enablement-area/EnablementArea/components/InternalPage/InternalPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { debounce } from 'lodash'
55
import { useLocation, useParams } from 'react-router-dom'
66
import { useSelector } from 'react-redux'
77

8-
import { ChevronLeftIcon } from 'uiSrc/components/base/icons'
8+
import { ChevronLeftIcon, RocketIcon } from 'uiSrc/components/base/icons'
99
import { ExternalLink, HorizontalRule, LoadingContent } from 'uiSrc/components'
1010
import { RiPopover } from 'uiSrc/components/base'
1111
import { IEnablementAreaItem } from 'uiSrc/slices/interfaces'
@@ -16,7 +16,6 @@ import {
1616
} from 'uiSrc/telemetry'
1717
import { getTutorialCapability, Nullable } from 'uiSrc/utils'
1818

19-
import RocketIcon from 'uiSrc/assets/img/icons/rocket.svg?react'
2019
import { appContextCapability } from 'uiSrc/slices/app/context'
2120
import {
2221
isShowCapabilityTutorialPopover,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import styled from 'styled-components'
2+
3+
export const CustomHorizontalRule = styled.div`
4+
margin: 12px 0;
5+
width: 100%;
6+
text-align: center;
7+
position: relative;
8+
9+
&:before,
10+
&:after {
11+
content: '';
12+
display: block;
13+
width: 47%;
14+
height: 1px;
15+
background: ${({ theme }: { theme: Theme }) =>
16+
theme.semantic.color.background.neutral500};
17+
position: absolute;
18+
top: 50%;
19+
}
20+
21+
&:after {
22+
right: 0;
23+
}
24+
`

redisinsight/ui/src/pages/home/components/add-database-screen/AddDatabaseScreen.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { useFormik } from 'formik'
33
import { useDispatch, useSelector } from 'react-redux'
44
import { useHistory } from 'react-router'
55
import { toNumber } from 'lodash'
6-
import { Nullable, parseRedisUrl } from 'uiSrc/utils'
76

7+
import { Nullable, parseRedisUrl } from 'uiSrc/utils'
88
import { AddDbType, DEFAULT_TIMEOUT } from 'uiSrc/pages/home/constants'
99
import { Instance } from 'uiSrc/slices/interfaces'
1010
import {
@@ -25,8 +25,7 @@ import { RiTooltip } from 'uiSrc/components'
2525
import ConnectivityOptions from './components/connectivity-options'
2626
import ConnectionUrl from './components/connection-url'
2727
import { Values } from './constants'
28-
29-
import styles from './styles.module.scss'
28+
import { CustomHorizontalRule } from './AddDatabaseScreen.styles'
3029

3130
export interface Props {
3231
onSelectOption: (type: AddDbType, db: Nullable<Record<string, any>>) => void
@@ -103,7 +102,7 @@ const AddDatabaseScreen = (props: Props) => {
103102
})
104103

105104
return (
106-
<div className="eui-yScroll">
105+
<div>
107106
<form onSubmit={formik.handleSubmit} data-testid="form">
108107
<Row responsive>
109108
<FlexItem grow>
@@ -113,8 +112,8 @@ const AddDatabaseScreen = (props: Props) => {
113112
/>
114113
</FlexItem>
115114
</Row>
116-
117-
<Row responsive justify="between" style={{ padding: 4 }}>
115+
<Spacer size="xxl" />
116+
<Row responsive justify="between" align="center">
118117
<FlexItem>
119118
<RiTooltip
120119
position="top"
@@ -130,19 +129,19 @@ const AddDatabaseScreen = (props: Props) => {
130129
loading={isLoading}
131130
data-testid="btn-test-connection"
132131
>
133-
Test Connection
132+
Test connection
134133
</EmptyButton>
135134
</RiTooltip>
136135
</FlexItem>
137136
<FlexItem>
138137
<Row responsive gap="l">
139138
<FlexItem>
140139
<SecondaryButton
141-
size="small"
140+
size="medium"
142141
onClick={() => handleProceedForm(AddDbType.manual)}
143142
data-testid="btn-connection-settings"
144143
>
145-
Connection Settings
144+
Connection settings
146145
</SecondaryButton>
147146
</FlexItem>
148147
<FlexItem>
@@ -152,13 +151,13 @@ const AddDatabaseScreen = (props: Props) => {
152151
content={isInvalid ? <span>{ConnectionUrlError}</span> : null}
153152
>
154153
<PrimaryButton
155-
size="small"
154+
size="medium"
156155
type="submit"
157156
disabled={!!isInvalid}
158157
icon={isInvalid ? InfoIcon : undefined}
159158
data-testid="btn-submit"
160159
>
161-
Add Database
160+
Add database
162161
</PrimaryButton>
163162
</RiTooltip>
164163
</FlexItem>
@@ -167,7 +166,7 @@ const AddDatabaseScreen = (props: Props) => {
167166
</Row>
168167
</form>
169168
<Spacer />
170-
<div className={styles.hr}>Or</div>
169+
<CustomHorizontalRule>Or</CustomHorizontalRule>
171170
<Spacer />
172171
<ConnectivityOptions
173172
onClickOption={handleProceedForm}

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import React from 'react'
2+
import styled from 'styled-components'
23

34
import { FormField } from 'uiSrc/components/base/forms/FormField'
45
import { TextArea } from 'uiSrc/components/base/inputs'
56
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
67
import { RiTooltip } from 'uiSrc/components'
7-
import styles from './styles.module.scss'
8+
import { FlexGroup, FlexItem } from 'uiSrc/components/base/layout/flex'
9+
import { Text } from 'uiSrc/components/base/text'
10+
11+
const PointerIcon = styled(RiIcon)`
12+
cursor: pointer;
13+
`
814

915
export interface Props {
1016
value: string
@@ -14,8 +20,8 @@ export interface Props {
1420
const ConnectionUrl = ({ value, onChange }: Props) => (
1521
<FormField
1622
label={
17-
<div className={styles.connectionUrlInfo}>
18-
<div>Connection URL</div>
23+
<FlexGroup gap="s" align="center">
24+
<Text>Connection URL</Text>
1925
<RiTooltip
2026
title="The following connection URLs are supported:"
2127
className="homePage_tooltip"
@@ -37,9 +43,11 @@ const ConnectionUrl = ({ value, onChange }: Props) => (
3743
</ul>
3844
}
3945
>
40-
<RiIcon type="InfoIcon" style={{ cursor: 'pointer' }} />
46+
<FlexItem>
47+
<PointerIcon type="InfoIcon" />
48+
</FlexItem>
4149
</RiTooltip>
42-
</div>
50+
</FlexGroup>
4351
}
4452
>
4553
<TextArea
@@ -48,7 +56,6 @@ const ConnectionUrl = ({ value, onChange }: Props) => (
4856
value={value}
4957
onChangeCapture={onChange}
5058
placeholder="redis://[email protected]:6379"
51-
style={{ height: 88 }}
5259
data-testid="connection-url"
5360
/>
5461
</FormField>

redisinsight/ui/src/pages/home/components/add-database-screen/components/connection-url/styles.module.scss

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)