Skip to content

Commit 072b349

Browse files
authored
RI-7681: Make info section fixed + apply scrolling properly (#5175)
* add the wrapper components used for all forms regarding add / edit database forms * add db: apply scrollable wrapper * cloud connection form: apply scrollable wrapper and remove unused style * cluster connection form: apply scrollable wrapper and content wrapper * import db: apply scrollable wrapper * all edit / clone forms: apply scrollable + content wrapper * sentinel form: apply wrappers * MAIN form panel - apply the fixed wrapper and scroll only remains in the wanted scrollable area
1 parent f158004 commit 072b349

File tree

11 files changed

+67
-65
lines changed

11 files changed

+67
-65
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import ConnectionUrl from './components/connection-url'
2727
import { Values } from './constants'
2828
import { CustomHorizontalRule } from './AddDatabaseScreen.styles'
2929

30+
import { ScrollableWrapper } from '../styles.module'
31+
3032
export interface Props {
3133
onSelectOption: (type: AddDbType, db: Nullable<Record<string, any>>) => void
3234
onClose?: () => void
@@ -102,7 +104,7 @@ const AddDatabaseScreen = (props: Props) => {
102104
})
103105

104106
return (
105-
<div>
107+
<ScrollableWrapper>
106108
<form onSubmit={formik.handleSubmit} data-testid="form">
107109
<Row responsive>
108110
<FlexItem grow>
@@ -170,7 +172,7 @@ const AddDatabaseScreen = (props: Props) => {
170172
onClickOption={handleProceedForm}
171173
onClose={onClose}
172174
/>
173-
</div>
175+
</ScrollableWrapper>
174176
)
175177
}
176178

redisinsight/ui/src/pages/home/components/cloud-connection/cloud-connection-form/CloudConnectionForm.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { RiRadioGroup } from 'uiSrc/components/base/forms/radio-group/RadioGroup
2828
import { TextInput } from 'uiSrc/components/base/inputs'
2929
import { ICloudConnectionSubmit } from '../CloudConnectionFormWrapper'
3030

31-
import styles from '../styles.module.scss'
31+
import { ScrollableWrapper } from '../../styles.module'
3232

3333
export interface Props {
3434
accessKey: string
@@ -179,7 +179,7 @@ const CloudConnectionForm = (props: Props) => {
179179
}
180180

181181
const CloudApiForm = (
182-
<div className={styles.cloudApi} data-testid="add-db_cloud-api">
182+
<div data-testid="add-db_cloud-api">
183183
<MessageCloudApiKeys />
184184
<Spacer />
185185
<WindowEvent event="keydown" handler={onKeyDown} />
@@ -227,7 +227,7 @@ const CloudConnectionForm = (props: Props) => {
227227
)
228228

229229
return (
230-
<div className="getStartedForm eui-yScroll">
230+
<ScrollableWrapper>
231231
<FeatureFlagComponent name={FeatureFlags.cloudSso}>
232232
<Col gap="l">
233233
<FlexItem grow>
@@ -252,7 +252,7 @@ const CloudConnectionForm = (props: Props) => {
252252
/>
253253
)}
254254
{type === CloudConnectionOptions.ApiKeys && CloudApiForm}
255-
</div>
255+
</ScrollableWrapper>
256256
)
257257
}
258258

redisinsight/ui/src/pages/home/components/cloud-connection/styles.module.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
.cloudApi {
2-
:global(.euiTextColor),
3-
:global(.euiLink) {
4-
color: currentColor !important;
5-
}
6-
}
7-
81
.link {
92
text-decoration: underline !important;
103

redisinsight/ui/src/pages/home/components/cluster-connection/ClusterConnectionFormWrapper.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { useModalHeader } from 'uiSrc/contexts/ModalTitleProvider'
1616
import { Title } from 'uiSrc/components/base/text/Title'
1717
import ClusterConnectionForm from './cluster-connection-form/ClusterConnectionForm'
1818

19+
import { ContentWrapper } from '../styles.module'
20+
1921
export interface Props {
2022
onClose?: () => void
2123
}
@@ -58,7 +60,8 @@ const ClusterConnectionFormWrapper = ({ onClose }: Props) => {
5860

5961
const formSubmit = (values: ICredentialsRedisCluster) => {
6062
sendEventTelemetry({
61-
event: TelemetryEvent.CONFIG_DATABASES_REDIS_SOFTWARE_AUTODISCOVERY_SUBMITTED,
63+
event:
64+
TelemetryEvent.CONFIG_DATABASES_REDIS_SOFTWARE_AUTODISCOVERY_SUBMITTED,
6265
})
6366

6467
dispatch(fetchInstancesRedisCluster(values, onSuccess))
@@ -77,7 +80,7 @@ const ClusterConnectionFormWrapper = ({ onClose }: Props) => {
7780
)
7881

7982
return (
80-
<div ref={formRef}>
83+
<ContentWrapper as="div" ref={formRef}>
8184
<ClusterConnectionForm
8285
host={credentials?.host ?? ''}
8386
port={credentials?.port?.toString() ?? ''}
@@ -89,7 +92,7 @@ const ClusterConnectionFormWrapper = ({ onClose }: Props) => {
8992
onSubmit={formSubmit}
9093
loading={loading}
9194
/>
92-
</div>
95+
</ContentWrapper>
9396
)
9497
}
9598

redisinsight/ui/src/pages/home/components/cluster-connection/cluster-connection-form/ClusterConnectionForm.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import {
2929
import { RiTooltip } from 'uiSrc/components'
3030
import { HostInfoTooltipContent } from '../../host-info-tooltip-content/HostInfoTooltipContent'
3131

32+
import { ScrollableWrapper } from '../../styles.module'
33+
3234
export interface Props {
3335
host: string
3436
port: string
@@ -187,10 +189,9 @@ const ClusterConnectionForm = (props: Props) => {
187189
}
188190

189191
return (
190-
<div className="getStartedForm eui-yScroll" data-testid="add-db_cluster">
192+
<ScrollableWrapper data-testid="add-db_cluster">
191193
<MessageEnterpriceSoftware />
192194
<br />
193-
194195
<form>
195196
<WindowEvent event="keydown" handler={onKeyDown} />
196197

@@ -266,7 +267,7 @@ const ClusterConnectionForm = (props: Props) => {
266267
</Col>
267268
</form>
268269
<Footer />
269-
</div>
270+
</ScrollableWrapper>
270271
)
271272
}
272273

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import React, { useEffect, useState } from 'react'
22
import { useDispatch, useSelector } from 'react-redux'
3-
import styled from 'styled-components'
4-
import { Theme } from '@redis-ui/styles'
5-
63

74
import { Nullable } from 'uiSrc/utils'
85
import { UrlHandlingActions } from 'uiSrc/slices/interfaces/urlHandling'
@@ -40,10 +37,7 @@ import { ChevronLeftIcon } from 'uiSrc/components/base/icons'
4037
import { FooterDatabaseForm } from 'uiSrc/components/form-dialog/FooterDatabaseForm'
4138
import { Title } from 'uiSrc/components/base/text'
4239

43-
const ScrollableWrapper = styled.div`
44-
height: 100%;
45-
overflow: scroll;
46-
`
40+
import { FixedWrapper } from '../styles.module'
4741

4842
export interface Props {
4943
editMode: boolean
@@ -198,13 +192,13 @@ const DatabasePanelDialog = (props: Props) => {
198192
header={modalHeader ?? <Title size="L">Add database</Title>}
199193
footer={<FooterDatabaseForm />}
200194
>
201-
<ScrollableWrapper>
195+
<FixedWrapper>
202196
<ModalHeaderProvider
203197
value={{ modalHeader, setModalHeader: handleSetModalHeader }}
204198
>
205199
{Form()}
206200
</ModalHeaderProvider>
207-
</ScrollableWrapper>
201+
</FixedWrapper>
208202
</FormDialog>
209203
)
210204
}

redisinsight/ui/src/pages/home/components/import-database/ImportDatabase.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
2525
import ResultsLog from './components/ResultsLog'
2626

2727
import styles from './styles.module.scss'
28+
import { ScrollableWrapper } from '../styles.module'
2829

2930
export interface Props {
3031
onClose: () => void
@@ -167,7 +168,7 @@ const ImportDatabase = (props: Props) => {
167168

168169
return (
169170
<>
170-
<div className={styles.formWrapper} data-testid="add-db_import">
171+
<ScrollableWrapper data-testid="add-db_import">
171172
<Col>
172173
<FlexItem grow>
173174
{isShowForm && (
@@ -234,7 +235,7 @@ const ImportDatabase = (props: Props) => {
234235
</FlexItem>
235236
</Row>
236237
)}
237-
</div>
238+
</ScrollableWrapper>
238239
<Footer />
239240
</>
240241
)

redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/ManualConnectionForm.tsx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import React, { useEffect, useRef, useState } from 'react'
44
import ReactDOM from 'react-dom'
55
import { useDispatch, useSelector } from 'react-redux'
66

7-
import cx from 'classnames'
87
import * as keys from 'uiSrc/constants/keys'
98
import { resetInstanceUpdateAction } from 'uiSrc/slices/instances/instances'
109
import { ConnectionType } from 'uiSrc/slices/interfaces'
@@ -34,7 +33,7 @@ import CloneConnection from './components/CloneConnection'
3433
import FooterActions from './components/FooterActions'
3534
import { AddConnection, EditConnection, EditSentinelConnection } from './forms'
3635

37-
import styles from './styles.module.scss'
36+
import { ScrollableWrapper, ContentWrapper } from '../../styles.module'
3837

3938
export interface Props {
4039
formFields: DbConnectionInfo
@@ -233,21 +232,18 @@ const ManualConnectionForm = (props: Props) => {
233232
)
234233

235234
return (
236-
<div
237-
className={styles.container}
238-
data-testid="add-db_manual"
239-
>
235+
<ContentWrapper data-testid="add-db_manual">
240236
{isEditMode &&
241237
!isCloneMode &&
242238
server?.buildType !== BuildType.RedisStack && (
243239
<CloneConnection id={id} setIsCloneMode={setIsCloneMode} />
244240
)}
245-
<div className={cx('getStartedForm', styles.content)} ref={formRef}>
241+
<ContentWrapper as="div" ref={formRef}>
246242
{!isEditMode && !isFromCloud && (
247243
<>
248244
<Tabs />
249245
<Spacer />
250-
<div className="eui-yScroll">
246+
<ScrollableWrapper>
251247
<AddConnection
252248
activeTab={activeTab}
253249
formik={formik}
@@ -257,7 +253,7 @@ const ManualConnectionForm = (props: Props) => {
257253
caCertificates={caCertificates}
258254
buildType={buildType}
259255
/>
260-
</div>
256+
</ScrollableWrapper>
261257
</>
262258
)}
263259
{(isEditMode || isCloneMode || isFromCloud) &&
@@ -280,7 +276,7 @@ const ManualConnectionForm = (props: Props) => {
280276
)}
281277
<Tabs />
282278
<Spacer />
283-
<div className="eui-yScroll">
279+
<ScrollableWrapper>
284280
<EditConnection
285281
activeTab={activeTab}
286282
isCloneMode={isCloneMode}
@@ -293,7 +289,7 @@ const ManualConnectionForm = (props: Props) => {
293289
caCertificates={caCertificates}
294290
buildType={buildType}
295291
/>
296-
</div>
292+
</ScrollableWrapper>
297293
</>
298294
)}
299295
{(isEditMode || isCloneMode) &&
@@ -313,7 +309,7 @@ const ManualConnectionForm = (props: Props) => {
313309
)}
314310
<Tabs />
315311
<Spacer />
316-
<div className="eui-yScroll">
312+
<ScrollableWrapper>
317313
<EditSentinelConnection
318314
activeTab={activeTab}
319315
isCloneMode={isCloneMode}
@@ -324,12 +320,12 @@ const ManualConnectionForm = (props: Props) => {
324320
caCertificates={caCertificates}
325321
db={db}
326322
/>
327-
</div>
323+
</ScrollableWrapper>
328324
</>
329325
)}
330-
</div>
326+
</ContentWrapper>
331327
<Footer />
332-
</div>
328+
</ContentWrapper>
333329
)
334330
}
335331

redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/styles.module.scss

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

redisinsight/ui/src/pages/home/components/sentinel-connection/sentinel-connection-form/SentinelConnectionForm.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import {
2222
import { RiTooltip } from 'uiSrc/components'
2323
import { Row } from 'uiSrc/components/base/layout/flex'
2424

25+
import { ContentWrapper, ScrollableWrapper } from '../../styles.module'
26+
2527
export interface Props {
2628
loading: boolean
2729
initialValues: DbConnectionInfo
@@ -132,12 +134,8 @@ const SentinelConnectionForm = (props: Props) => {
132134
}
133135

134136
return (
135-
<div
136-
className="relative"
137-
data-testid="add-db_sentinel"
138-
style={{ height: '100%' }}
139-
>
140-
<div className="getStartedForm eui-yScroll" ref={formRef}>
137+
<ContentWrapper data-testid="add-db_sentinel">
138+
<ScrollableWrapper as="div" ref={formRef}>
141139
<MessageSentinel />
142140
<br />
143141
<form
@@ -163,9 +161,9 @@ const SentinelConnectionForm = (props: Props) => {
163161
caCertificates={caCertificates}
164162
/>
165163
</form>
166-
</div>
164+
</ScrollableWrapper>
167165
<Footer />
168-
</div>
166+
</ContentWrapper>
169167
)
170168
}
171169

0 commit comments

Comments
 (0)