Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8dc9f70
adjust some spacings and alignment around the dividers in the lower s…
dantovska Oct 30, 2025
cbe6aae
increase footer button sizes
dantovska Oct 30, 2025
ef046b1
replace the hard coded asterisk with required; add space between forms
dantovska Oct 30, 2025
9c9197c
replace the Arrow Left icon <- with Chevron icon <
dantovska Oct 30, 2025
13cb109
add the info icon
dantovska Oct 30, 2025
30afe0c
attempt to fix the double scroll layout issue
dantovska Oct 31, 2025
fea8c35
remove unused divider class
dantovska Oct 31, 2025
290f2d0
fix margin for tls details
dantovska Oct 31, 2025
6dea3b7
fix spacing around security items
dantovska Oct 31, 2025
497d9b9
adjust decompression and formatters tab spacing
dantovska Oct 31, 2025
a54287e
adjust spacings and required fields in ssh and tls details
dantovska Oct 31, 2025
74a938c
adjust spacings in the edit db connectivity settings
dantovska Oct 31, 2025
28bb562
decrease spacer below private key / pass radio
dantovska Oct 31, 2025
c8ce74d
adjust spacings and dividers to reduce space and not cause extra scrolls
dantovska Nov 3, 2025
9902f3a
use text for the label to make the format match the designs
dantovska Nov 3, 2025
50230f4
decrease some spacings
dantovska Nov 3, 2025
6f67f58
remove the "should not exceed constraint"
dantovska Nov 3, 2025
43c0c9a
wrap the checkbox in form field
dantovska Nov 3, 2025
2aa4766
add styles to modal content to spread through the whole content conta…
dantovska Nov 3, 2025
274308e
revert accidentally commited default formatter settings
dantovska Nov 3, 2025
81d3dd2
fix tests
dantovska Nov 3, 2025
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
18 changes: 13 additions & 5 deletions redisinsight/ui/src/components/base/forms/FormField.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import React, { ComponentProps } from 'react'
import { FormField as RedisFormField, TooltipProvider } from '@redis-ui/components'
import {
FormField as RedisFormField,
TooltipProvider,
} from '@redis-ui/components'
import { InfoIconProps } from '@redis-ui/components/dist/Label/components/InfoIcon/InfoIcon.types'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure about this import. It reaches into dist folder???


export type { InfoIconProps }

export type RedisFormFieldProps = ComponentProps<typeof RedisFormField> & {
infoIconProps?: any
infoIconProps?: InfoIconProps
}

export function FormField(props: RedisFormFieldProps) {
// eslint-disable-next-line react/destructuring-assignment
if (props.infoIconProps) {
return <TooltipProvider>
<RedisFormField {...props} />
</TooltipProvider>
return (
<TooltipProvider>
<RedisFormField {...props} />
</TooltipProvider>
)
}
return <RedisFormField {...props} />
}
15 changes: 15 additions & 0 deletions redisinsight/ui/src/components/form-dialog/FormDialog.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import styled from 'styled-components'
import { Modal } from 'uiSrc/components/base/display/modal'

export const StyledFormDialogContent = styled(Modal.Content.Compose)`
width: 900px !important;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you try removing !important? It is usually not needed with styled components

height: 700px !important;
max-width: calc(100vw - 120px) !important;
max-height: calc(100vh - 120px) !important;
// Flex the modal content to fill the whole available space
> [data-role='dialog-hub'] {
flex: 1;
}
`
10 changes: 5 additions & 5 deletions redisinsight/ui/src/components/form-dialog/FormDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'
import cx from 'classnames'

import { Nullable } from 'uiSrc/utils'
import { CancelIcon } from 'uiSrc/components/base/icons'
import { Modal } from 'uiSrc/components/base/display'
import styles from './styles.module.scss'

import { StyledFormDialogContent } from './FormDialog.styles'

export interface Props {
isOpen: boolean
Expand All @@ -22,16 +22,16 @@ const FormDialog = (props: Props) => {

return (
<Modal.Compose open={isOpen}>
<Modal.Content.Compose
<StyledFormDialogContent
persistent
className={cx(styles.modal, className)}
className={className}
onCancel={onClose}
>
<Modal.Content.Close icon={CancelIcon} onClick={onClose} />
<Modal.Content.Header.Title>{header}</Modal.Content.Header.Title>
<Modal.Content.Body content={children} />
<Modal.Content.Footer.Compose>{footer}</Modal.Content.Footer.Compose>
</Modal.Content.Compose>
</StyledFormDialogContent>
</Modal.Compose>
)
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { ModalHeaderProvider } from 'uiSrc/contexts/ModalTitleProvider'
import ClusterConnectionFormWrapper from 'uiSrc/pages/home/components/cluster-connection'
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
import { IconButton } from 'uiSrc/components/base/forms/buttons'
import { ArrowLeftIcon } from 'uiSrc/components/base/icons'
import { ChevronLeftIcon } from 'uiSrc/components/base/icons'
import { FooterDatabaseForm } from 'uiSrc/components/form-dialog/FooterDatabaseForm'
import { Title } from 'uiSrc/components/base/text'

Expand Down Expand Up @@ -178,7 +178,7 @@ const DatabasePanelDialog = (props: Props) => {
<FlexItem>
<IconButton
onClick={handleClickBack}
icon={ArrowLeftIcon}
icon={ChevronLeftIcon}
aria-label="back"
data-testid="back-btn"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ describe('DatabaseForm', () => {
it('should render with correct field labels', () => {
renderComponent()

expect(screen.getByText('Database Alias*')).toBeInTheDocument()
expect(screen.getByText('Host*')).toBeInTheDocument()
expect(screen.getByText('Port*')).toBeInTheDocument()
expect(screen.getByText('Database Alias')).toBeInTheDocument()
expect(screen.getByText('Host')).toBeInTheDocument()
expect(screen.getByText('Port')).toBeInTheDocument()
expect(screen.getByText('Username')).toBeInTheDocument()
expect(screen.getByText('Password')).toBeInTheDocument()
expect(screen.getByText('Timeout (s)')).toBeInTheDocument()
Expand Down
106 changes: 48 additions & 58 deletions redisinsight/ui/src/pages/home/components/form/DatabaseForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ import {
selectOnFocus,
validateField,
} from 'uiSrc/utils'
import { RiTooltip } from 'uiSrc/components'
import { DbConnectionInfo } from 'uiSrc/pages/home/interfaces'
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
import { FormField } from 'uiSrc/components/base/forms/FormField'
import { NumericInput, PasswordInput, TextInput } from 'uiSrc/components/base/inputs'
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
import { Col, FlexItem, Row } from 'uiSrc/components/base/layout/flex'
import { FormField, InfoIconProps } from 'uiSrc/components/base/forms/FormField'
import {
NumericInput,
PasswordInput,
TextInput,
} from 'uiSrc/components/base/inputs'
import { Text } from 'uiSrc/components/base/text'
import { Spacer } from 'uiSrc/components/base/layout'

interface IShowFields {
alias: boolean
Expand All @@ -26,6 +30,38 @@ interface IShowFields {
timeout: boolean
}

const infoIcon: InfoIconProps = {
content: (
<div className="homePage_tooltip">
Copy link
Collaborator

Choose a reason for hiding this comment

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

if this class actually does something, it is better to extract a component and not use the class

<div>
<Text variant="semiBold">
Pasting a connection URL auto fills the database details.
</Text>
<Spacer size="s" />
<Text variant="semiBold">
The following connection URLs are supported:
</Text>
</div>
<ul className="homePage_toolTipUl">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same

<li>
<span className="dot" />
redis://[[username]:[password]]@host:port
</li>
<li>
<span className="dot" />
rediss://[[username]:[password]]@host:port
</li>
<li>
<span className="dot" />
host:port
</li>
</ul>
</div>
),
placement: 'right',
maxWidth: '100%',
}

export interface Props {
formik: FormikProps<DbConnectionInfo>
onHostNamePaste: (content: string) => boolean
Expand All @@ -45,52 +81,16 @@ const DatabaseForm = (props: Props) => {

const { server } = useSelector(appInfoSelector)

const AppendHostName = () => (
<RiTooltip
title={
<div>
<p>
<b>Pasting a connection URL auto fills the database details.</b>
</p>
<p style={{ margin: 0, paddingTop: '10px' }}>
The following connection URLs are supported:
</p>
</div>
}
className="homePage_tooltip"
anchorClassName="inputAppendIcon"
position="right"
content={
<ul className="homePage_toolTipUl">
<li>
<span className="dot" />
redis://[[username]:[password]]@host:port
</li>
<li>
<span className="dot" />
rediss://[[username]:[password]]@host:port
</li>
<li>
<span className="dot" />
host:port
</li>
</ul>
}
>
<RiIcon type="InfoIcon" style={{ cursor: 'pointer' }} />
</RiTooltip>
)

const isShowPort =
server?.buildType !== BuildType.RedisStack && showFields.port
const isFieldDisabled = (name: string) => readyOnlyFields.includes(name)

return (
<>
<Col gap="l">
{showFields.alias && (
<Row gap="m">
<FlexItem grow>
<FormField label="Database Alias*">
<FormField label="Database alias" required>
<TextInput
name="name"
id="name"
Expand All @@ -106,15 +106,11 @@ const DatabaseForm = (props: Props) => {
</FlexItem>
</Row>
)}

{(showFields.host || isShowPort) && (
<Row gap="m">
{showFields.host && (
<FlexItem grow={4}>
<FormField
label="Host*"
additionalText={<AppendHostName />}
>
<FormField label="Host" required infoIconProps={infoIcon}>
<TextInput
autoFocus={autoFocus}
name="ip"
Expand All @@ -124,11 +120,8 @@ const DatabaseForm = (props: Props) => {
maxLength={200}
placeholder="Enter Hostname / IP address / Connection URL"
value={formik.values.host ?? ''}
onChange={value => {
formik.setFieldValue(
'host',
validateField(value.trim()),
)
onChange={(value) => {
formik.setFieldValue('host', validateField(value.trim()))
}}
onPaste={(event: React.ClipboardEvent<HTMLInputElement>) =>
handlePasteHostName(onHostNamePaste, event)
Expand All @@ -141,10 +134,7 @@ const DatabaseForm = (props: Props) => {
)}
{isShowPort && (
<FlexItem grow={2}>
<FormField
label="Port*"
additionalText={`Should not exceed ${MAX_PORT_NUMBER}.`}
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we just discard the info text?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I discussed this with @ViktarStarastsenka - seems like since we have the constraint there is no need for this.

>
<FormField label="Port" required>
<NumericInput
autoValidate
name="port"
Expand Down Expand Up @@ -228,7 +218,7 @@ const DatabaseForm = (props: Props) => {
<FlexItem grow />
</Row>
)}
</>
</Col>
)
}

Expand Down
42 changes: 19 additions & 23 deletions redisinsight/ui/src/pages/home/components/form/DbCompressor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import { KeyValueCompressor } from 'uiSrc/constants'
import { DbConnectionInfo } from 'uiSrc/pages/home/interfaces'
import { NONE } from 'uiSrc/pages/home/constants'
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
import { Spacer } from 'uiSrc/components/base/layout/spacer'
import { Checkbox } from 'uiSrc/components/base/forms/checkbox/Checkbox'
import { FormField } from 'uiSrc/components/base/forms/FormField'
import { RiSelect } from 'uiSrc/components/base/forms/select/RiSelect'
import { Text } from 'uiSrc/components/base/text/Text'
import { useGenerateId } from 'uiSrc/components/base/utils/hooks/generate-id'

export interface Props {
formik: FormikProps<DbConnectionInfo>
}
Expand Down Expand Up @@ -69,7 +68,7 @@ const DbCompressor = (props: Props) => {
<Checkbox
id={id}
name="showCompressor"
label="Enable Automatic Data Decompression"
label={<Text>Enable Automatic Data Decompression</Text>}
checked={!!formik.values.showCompressor}
onChange={handleChangeDbCompressorCheckbox}
data-testid="showCompressor"
Expand All @@ -79,26 +78,23 @@ const DbCompressor = (props: Props) => {
</Row>

{formik.values.showCompressor && (
<>
<Spacer />
<Row gap="m">
<FlexItem grow>
<FormField label="Decompression format">
<RiSelect
name="compressor"
placeholder="Decompression format"
value={formik.values.compressor ?? NONE}
options={optionsCompressor}
onChange={(value) => {
formik.setFieldValue('compressor', value || NONE)
}}
data-testid="select-compressor"
/>
</FormField>
</FlexItem>
<FlexItem grow />
</Row>
</>
<Row gap="m">
<FlexItem grow>
<FormField label="Decompression format">
<RiSelect
name="compressor"
placeholder="Decompression format"
value={formik.values.compressor ?? NONE}
options={optionsCompressor}
onChange={(value) => {
formik.setFieldValue('compressor', value || NONE)
}}
data-testid="select-compressor"
/>
</FormField>
</FlexItem>
<FlexItem grow />
</Row>
)}
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const DbIndex = (props: Props) => {
<Checkbox
id={id}
name="showDb"
labelSize="M"
label="Select Logical Database"
checked={!!formik.values.showDb}
onChange={handleChangeDbIndexCheckbox}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import { Checkbox } from 'uiSrc/components/base/forms/checkbox/Checkbox'
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
import { RiTooltip } from 'uiSrc/components'
import { useGenerateId } from 'uiSrc/components/base/utils/hooks/generate-id'
import { Text } from 'uiSrc/components/base/text/Text'

export interface Props {
formik: FormikProps<DbConnectionInfo>
}

const ForceStandaloneLabel = () => (
<>
<span>Force Standalone Connection</span>
<Row align="center" gap="s">
<Text>Force Standalone Connection</Text>
<RiTooltip
className="homePage_tooltip"
position="right"
Expand All @@ -26,15 +27,11 @@ const ForceStandaloneLabel = () => (
</p>
}
>
<RiIcon
type="InfoIcon"
style={{
cursor: 'pointer',
marginLeft: '5px',
}}
/>
<FlexItem>
<RiIcon type="InfoIcon" style={{ cursor: 'pointer' }} />
</FlexItem>
</RiTooltip>
</>
</Row>
)
const ForceStandalone = (props: Props) => {
const { formik } = props
Expand Down
Loading
Loading