Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import ConnectionUrl from './components/connection-url'
import { Values } from './constants'
import { CustomHorizontalRule } from './AddDatabaseScreen.styles'

import { ScrollableWrapper } from '../styles.module'

export interface Props {
onSelectOption: (type: AddDbType, db: Nullable<Record<string, any>>) => void
onClose?: () => void
Expand Down Expand Up @@ -102,7 +104,7 @@ const AddDatabaseScreen = (props: Props) => {
})

return (
<div>
<ScrollableWrapper>
<form onSubmit={formik.handleSubmit} data-testid="form">
<Row responsive>
<FlexItem grow>
Expand Down Expand Up @@ -170,7 +172,7 @@ const AddDatabaseScreen = (props: Props) => {
onClickOption={handleProceedForm}
onClose={onClose}
/>
</div>
</ScrollableWrapper>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { RiRadioGroup } from 'uiSrc/components/base/forms/radio-group/RadioGroup
import { TextInput } from 'uiSrc/components/base/inputs'
import { ICloudConnectionSubmit } from '../CloudConnectionFormWrapper'

import styles from '../styles.module.scss'
import { ScrollableWrapper } from '../../styles.module'

export interface Props {
accessKey: string
Expand Down Expand Up @@ -179,7 +179,7 @@ const CloudConnectionForm = (props: Props) => {
}

const CloudApiForm = (
<div className={styles.cloudApi} data-testid="add-db_cloud-api">
<div data-testid="add-db_cloud-api">
<MessageCloudApiKeys />
<Spacer />
<WindowEvent event="keydown" handler={onKeyDown} />
Expand Down Expand Up @@ -227,7 +227,7 @@ const CloudConnectionForm = (props: Props) => {
)

return (
<div className="getStartedForm eui-yScroll">
<ScrollableWrapper>
<FeatureFlagComponent name={FeatureFlags.cloudSso}>
<Col gap="l">
<FlexItem grow>
Expand All @@ -252,7 +252,7 @@ const CloudConnectionForm = (props: Props) => {
/>
)}
{type === CloudConnectionOptions.ApiKeys && CloudApiForm}
</div>
</ScrollableWrapper>
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
.cloudApi {
:global(.euiTextColor),
:global(.euiLink) {
color: currentColor !important;
}
}

.link {
text-decoration: underline !important;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { useModalHeader } from 'uiSrc/contexts/ModalTitleProvider'
import { Title } from 'uiSrc/components/base/text/Title'
import ClusterConnectionForm from './cluster-connection-form/ClusterConnectionForm'

import { ContentWrapper } from '../styles.module'

export interface Props {
onClose?: () => void
}
Expand Down Expand Up @@ -58,7 +60,8 @@ const ClusterConnectionFormWrapper = ({ onClose }: Props) => {

const formSubmit = (values: ICredentialsRedisCluster) => {
sendEventTelemetry({
event: TelemetryEvent.CONFIG_DATABASES_REDIS_SOFTWARE_AUTODISCOVERY_SUBMITTED,
event:
TelemetryEvent.CONFIG_DATABASES_REDIS_SOFTWARE_AUTODISCOVERY_SUBMITTED,
})

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

return (
<div ref={formRef}>
<ContentWrapper as="div" ref={formRef}>
<ClusterConnectionForm
host={credentials?.host ?? ''}
port={credentials?.port?.toString() ?? ''}
Expand All @@ -89,7 +92,7 @@ const ClusterConnectionFormWrapper = ({ onClose }: Props) => {
onSubmit={formSubmit}
loading={loading}
/>
</div>
</ContentWrapper>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import {
import { RiTooltip } from 'uiSrc/components'
import { HostInfoTooltipContent } from '../../host-info-tooltip-content/HostInfoTooltipContent'

import { ScrollableWrapper } from '../../styles.module'

export interface Props {
host: string
port: string
Expand Down Expand Up @@ -187,10 +189,9 @@ const ClusterConnectionForm = (props: Props) => {
}

return (
<div className="getStartedForm eui-yScroll" data-testid="add-db_cluster">
<ScrollableWrapper data-testid="add-db_cluster">
<MessageEnterpriceSoftware />
<br />

<form>
<WindowEvent event="keydown" handler={onKeyDown} />

Expand Down Expand Up @@ -266,7 +267,7 @@ const ClusterConnectionForm = (props: Props) => {
</Col>
</form>
<Footer />
</div>
</ScrollableWrapper>
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import React, { useEffect, useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import styled from 'styled-components'
import { Theme } from '@redis-ui/styles'


import { Nullable } from 'uiSrc/utils'
import { UrlHandlingActions } from 'uiSrc/slices/interfaces/urlHandling'
Expand Down Expand Up @@ -40,10 +37,7 @@ import { ChevronLeftIcon } from 'uiSrc/components/base/icons'
import { FooterDatabaseForm } from 'uiSrc/components/form-dialog/FooterDatabaseForm'
import { Title } from 'uiSrc/components/base/text'

const ScrollableWrapper = styled.div`
height: 100%;
overflow: scroll;
`
import { FixedWrapper } from '../styles.module'

export interface Props {
editMode: boolean
Expand Down Expand Up @@ -198,13 +192,13 @@ const DatabasePanelDialog = (props: Props) => {
header={modalHeader ?? <Title size="L">Add database</Title>}
footer={<FooterDatabaseForm />}
>
<ScrollableWrapper>
<FixedWrapper>
<ModalHeaderProvider
value={{ modalHeader, setModalHeader: handleSetModalHeader }}
>
{Form()}
</ModalHeaderProvider>
</ScrollableWrapper>
</FixedWrapper>
</FormDialog>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
import ResultsLog from './components/ResultsLog'

import styles from './styles.module.scss'
import { ScrollableWrapper } from '../styles.module'

export interface Props {
onClose: () => void
Expand Down Expand Up @@ -167,7 +168,7 @@ const ImportDatabase = (props: Props) => {

return (
<>
<div className={styles.formWrapper} data-testid="add-db_import">
<ScrollableWrapper data-testid="add-db_import">
<Col>
<FlexItem grow>
{isShowForm && (
Expand Down Expand Up @@ -234,7 +235,7 @@ const ImportDatabase = (props: Props) => {
</FlexItem>
</Row>
)}
</div>
</ScrollableWrapper>
<Footer />
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React, { useEffect, useRef, useState } from 'react'
import ReactDOM from 'react-dom'
import { useDispatch, useSelector } from 'react-redux'

import cx from 'classnames'
import * as keys from 'uiSrc/constants/keys'
import { resetInstanceUpdateAction } from 'uiSrc/slices/instances/instances'
import { ConnectionType } from 'uiSrc/slices/interfaces'
Expand Down Expand Up @@ -34,7 +33,7 @@ import CloneConnection from './components/CloneConnection'
import FooterActions from './components/FooterActions'
import { AddConnection, EditConnection, EditSentinelConnection } from './forms'

import styles from './styles.module.scss'
import { ScrollableWrapper, ContentWrapper } from '../../styles.module'

export interface Props {
formFields: DbConnectionInfo
Expand Down Expand Up @@ -233,21 +232,18 @@ const ManualConnectionForm = (props: Props) => {
)

return (
<div
className={styles.container}
data-testid="add-db_manual"
>
<ContentWrapper data-testid="add-db_manual">
{isEditMode &&
!isCloneMode &&
server?.buildType !== BuildType.RedisStack && (
<CloneConnection id={id} setIsCloneMode={setIsCloneMode} />
)}
<div className={cx('getStartedForm', styles.content)} ref={formRef}>
<ContentWrapper as="div" ref={formRef}>
{!isEditMode && !isFromCloud && (
<>
<Tabs />
<Spacer />
<div className="eui-yScroll">
<ScrollableWrapper>
<AddConnection
activeTab={activeTab}
formik={formik}
Expand All @@ -257,7 +253,7 @@ const ManualConnectionForm = (props: Props) => {
caCertificates={caCertificates}
buildType={buildType}
/>
</div>
</ScrollableWrapper>
</>
)}
{(isEditMode || isCloneMode || isFromCloud) &&
Expand All @@ -280,7 +276,7 @@ const ManualConnectionForm = (props: Props) => {
)}
<Tabs />
<Spacer />
<div className="eui-yScroll">
<ScrollableWrapper>
<EditConnection
activeTab={activeTab}
isCloneMode={isCloneMode}
Expand All @@ -293,7 +289,7 @@ const ManualConnectionForm = (props: Props) => {
caCertificates={caCertificates}
buildType={buildType}
/>
</div>
</ScrollableWrapper>
</>
)}
{(isEditMode || isCloneMode) &&
Expand All @@ -313,7 +309,7 @@ const ManualConnectionForm = (props: Props) => {
)}
<Tabs />
<Spacer />
<div className="eui-yScroll">
<ScrollableWrapper>
<EditSentinelConnection
activeTab={activeTab}
isCloneMode={isCloneMode}
Expand All @@ -324,12 +320,12 @@ const ManualConnectionForm = (props: Props) => {
caCertificates={caCertificates}
db={db}
/>
</div>
</ScrollableWrapper>
</>
)}
</div>
</ContentWrapper>
<Footer />
</div>
</ContentWrapper>
)
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
import { RiTooltip } from 'uiSrc/components'
import { Row } from 'uiSrc/components/base/layout/flex'

import { ContentWrapper, ScrollableWrapper } from '../../styles.module'

export interface Props {
loading: boolean
initialValues: DbConnectionInfo
Expand Down Expand Up @@ -132,12 +134,8 @@ const SentinelConnectionForm = (props: Props) => {
}

return (
<div
className="relative"
data-testid="add-db_sentinel"
style={{ height: '100%' }}
>
<div className="getStartedForm eui-yScroll" ref={formRef}>
<ContentWrapper data-testid="add-db_sentinel">
<ScrollableWrapper as="div" ref={formRef}>
<MessageSentinel />
<br />
<form
Expand All @@ -163,9 +161,9 @@ const SentinelConnectionForm = (props: Props) => {
caCertificates={caCertificates}
/>
</form>
</div>
</ScrollableWrapper>
<Footer />
</div>
</ContentWrapper>
)
}

Expand Down
26 changes: 26 additions & 0 deletions redisinsight/ui/src/pages/home/components/styles.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import styled from 'styled-components'

export const FixedWrapper = styled.div`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip: You can use FlexGroup or Col instead of a regular div, so you don't have to define the flex properties on your own.

PS: The same note applies for the other classes bellow, as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Using FlexGroup or Col add a lot of different styles with them, which I try to avoid and make it simple due to the sensitive scenario with the scrolling, that is why I decided to go with this approach.

height: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
min-height: 0;
`

export const ScrollableWrapper = styled.div<
React.HTMLAttributes<HTMLDivElement>
>`
flex: 1;
overflow-y: auto;
overflow-x: hidden;
scrollbar-width: thin;
min-height: 0;
`

export const ContentWrapper = styled.div<React.HTMLAttributes<HTMLDivElement>>`
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
`
Loading