Skip to content

Commit 3095574

Browse files
authored
RI-7681: Polish Add Cluster DB form (#5158)
* remove no longer needed padding as it is handled in the FormDialog * polish the add cluster db modal form * remove size medium from buttons as it is default
1 parent b758429 commit 3095574

File tree

5 files changed

+72
-88
lines changed

5 files changed

+72
-88
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ const AddDatabaseScreen = (props: Props) => {
137137
<Row responsive gap="l">
138138
<FlexItem>
139139
<SecondaryButton
140-
size="medium"
141140
onClick={() => handleProceedForm(AddDbType.manual)}
142141
data-testid="btn-connection-settings"
143142
>
@@ -151,7 +150,6 @@ const AddDatabaseScreen = (props: Props) => {
151150
content={isInvalid ? <span>{ConnectionUrlError}</span> : null}
152151
>
153152
<PrimaryButton
154-
size="medium"
155153
type="submit"
156154
disabled={!!isInvalid}
157155
icon={isInvalid ? InfoIcon : undefined}

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

Lines changed: 72 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import validationErrors from 'uiSrc/constants/validationErrors'
1010
import { ICredentialsRedisCluster } from 'uiSrc/slices/interfaces'
1111

1212
import { MessageEnterpriceSoftware } from 'uiSrc/pages/home/components/form/Messages'
13-
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
13+
import { Col, FlexItem, Row } from 'uiSrc/components/base/layout/flex'
1414
import { WindowEvent } from 'uiSrc/components/base/utils/WindowEvent'
1515
import {
1616
PrimaryButton,
@@ -134,12 +134,7 @@ const ClusterConnectionForm = (props: Props) => {
134134
}
135135

136136
const CancelButton = ({ onClick }: { onClick: () => void }) => (
137-
<SecondaryButton
138-
size="s"
139-
className="btn-cancel"
140-
onClick={onClick}
141-
style={{ marginRight: 12 }}
142-
>
137+
<SecondaryButton className="btn-cancel" onClick={onClick}>
143138
Cancel
144139
</SecondaryButton>
145140
)
@@ -162,7 +157,6 @@ const ClusterConnectionForm = (props: Props) => {
162157
}
163158
>
164159
<PrimaryButton
165-
size="s"
166160
type="submit"
167161
onClick={onClick}
168162
disabled={submitIsDisabled}
@@ -179,13 +173,13 @@ const ClusterConnectionForm = (props: Props) => {
179173
const footerEl = document.getElementById('footerDatabaseForm')
180174
if (footerEl) {
181175
return ReactDOM.createPortal(
182-
<div className="footerAddDatabase">
176+
<Row justify="end" gap="m">
183177
{onClose && <CancelButton onClick={onClose} />}
184178
<SubmitButton
185179
onClick={formik.submitForm}
186180
submitIsDisabled={!submitIsEnable()}
187181
/>
188-
</div>,
182+
</Row>,
189183
footerEl,
190184
)
191185
}
@@ -199,80 +193,77 @@ const ClusterConnectionForm = (props: Props) => {
199193

200194
<form>
201195
<WindowEvent event="keydown" handler={onKeyDown} />
202-
<Row responsive>
203-
<FlexItem grow={4}>
204-
<FormField label="Cluster Host" required infoIconProps={hostInfo}>
205-
<TextInput
206-
name="host"
207-
id="host"
208-
data-testid="host"
209-
maxLength={200}
210-
placeholder="Enter Cluster Host"
211-
value={formik.values.host}
212-
onChange={value => {
213-
formik.setFieldValue(
214-
'host',
215-
validateField(value.trim()),
216-
)
217-
}}
218-
onPaste={(event: React.ClipboardEvent<HTMLInputElement>) =>
219-
handlePasteHostName(onHostNamePaste, event)
220-
}
221-
/>
222-
</FormField>
223-
</FlexItem>
224196

225-
<FlexItem grow={2}>
226-
<FormField
227-
label="Cluster Port*"
228-
additionalText="Should not exceed 65535."
229-
>
230-
<NumericInput
231-
autoValidate
232-
min={0}
233-
max={MAX_PORT_NUMBER}
234-
name="port"
235-
id="port"
236-
data-testid="port"
237-
placeholder="Enter Cluster Port"
238-
value={Number(formik.values.port)}
239-
onChange={(value) => formik.setFieldValue('port', value)}
240-
/>
241-
</FormField>
242-
</FlexItem>
243-
</Row>
197+
<Col gap="l">
198+
<Row gap="m" responsive>
199+
<FlexItem grow={4}>
200+
<FormField label="Cluster Host" required infoIconProps={hostInfo}>
201+
<TextInput
202+
name="host"
203+
id="host"
204+
data-testid="host"
205+
maxLength={200}
206+
placeholder="Enter Cluster Host"
207+
value={formik.values.host}
208+
onChange={(value) => {
209+
formik.setFieldValue('host', validateField(value.trim()))
210+
}}
211+
onPaste={(event: React.ClipboardEvent<HTMLInputElement>) =>
212+
handlePasteHostName(onHostNamePaste, event)
213+
}
214+
/>
215+
</FormField>
216+
</FlexItem>
217+
218+
<FlexItem grow={2}>
219+
<FormField label="Cluster Port" required>
220+
<NumericInput
221+
autoValidate
222+
min={0}
223+
max={MAX_PORT_NUMBER}
224+
name="port"
225+
id="port"
226+
data-testid="port"
227+
placeholder="Enter Cluster Port"
228+
value={Number(formik.values.port)}
229+
onChange={(value) => formik.setFieldValue('port', value)}
230+
/>
231+
</FormField>
232+
</FlexItem>
233+
</Row>
244234

245-
<Row responsive>
246-
<FlexItem grow>
247-
<FormField label="Admin Username*">
248-
<TextInput
249-
name="username"
250-
id="username"
251-
data-testid="username"
252-
maxLength={200}
253-
placeholder="Enter Admin Username"
254-
value={formik.values.username}
255-
onChange={(value) => formik.setFieldValue('username', value)}
256-
/>
257-
</FormField>
258-
</FlexItem>
235+
<Row gap="m" responsive>
236+
<FlexItem grow>
237+
<FormField label="Admin Username" required>
238+
<TextInput
239+
name="username"
240+
id="username"
241+
data-testid="username"
242+
maxLength={200}
243+
placeholder="Enter Admin Username"
244+
value={formik.values.username}
245+
onChange={(value) => formik.setFieldValue('username', value)}
246+
/>
247+
</FormField>
248+
</FlexItem>
259249

260-
<FlexItem grow>
261-
<FormField label="Admin Password*">
262-
<PasswordInput
263-
type="dual"
264-
name="password"
265-
id="password"
266-
data-testid="password"
267-
maxLength={200}
268-
placeholder="Enter Password"
269-
value={formik.values.password}
270-
onChange={(value) => formik.setFieldValue('password', value)}
271-
autoComplete="new-password"
272-
/>
273-
</FormField>
274-
</FlexItem>
275-
</Row>
250+
<FlexItem grow>
251+
<FormField label="Admin Password" required>
252+
<PasswordInput
253+
type="dual"
254+
name="password"
255+
id="password"
256+
data-testid="password"
257+
maxLength={200}
258+
placeholder="Enter Password"
259+
value={formik.values.password}
260+
onChange={(value) => formik.setFieldValue('password', value)}
261+
autoComplete="new-password"
262+
/>
263+
</FormField>
264+
</FlexItem>
265+
</Row>
266+
</Col>
276267
</form>
277268
<Footer />
278269
</div>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import { Title } from 'uiSrc/components/base/text'
4343
const ScrollableWrapper = styled.div`
4444
height: 100%;
4545
overflow: scroll;
46-
padding-top: ${({ theme }: { theme: Theme }) => theme.core.space.space400};
4746
`
4847

4948
export interface Props {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const CloneConnection = (props: Props) => {
2727
<Row gap="m" justify="end" style={{ flexGrow: 0 }}>
2828
<FlexItem>
2929
<SecondaryButton
30-
size="medium"
3130
aria-label="Clone database"
3231
data-testid="clone-db-btn"
3332
onClick={handleClickClone}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ const FooterActions = (props: Props) => {
5050
content={getSubmitButtonContent(errors, submitIsDisabled)}
5151
>
5252
<PrimaryButton
53-
size="medium"
5453
type="submit"
5554
onClick={onClick}
5655
disabled={submitIsDisabled}
@@ -77,7 +76,6 @@ const FooterActions = (props: Props) => {
7776
content={getSubmitButtonContent(errors, submitIsDisable())}
7877
>
7978
<EmptyButton
80-
size="medium"
8179
className="empty-btn"
8280
disabled={submitIsDisable()}
8381
icon={submitIsDisable() ? InfoIcon : undefined}
@@ -94,7 +92,6 @@ const FooterActions = (props: Props) => {
9492
<Row>
9593
{onClose && (
9694
<SecondaryButton
97-
size="medium"
9895
onClick={onClose}
9996
className="btn-cancel"
10097
data-testid="btn-cancel"

0 commit comments

Comments
 (0)