Skip to content

Commit 046011c

Browse files
authored
enhancement: Add confirmation dialog for cloud cluster creation and fix access tokens header (#1405)
1 parent 42450f1 commit 046011c

File tree

2 files changed

+85
-73
lines changed

2 files changed

+85
-73
lines changed

www/src/components/create-cluster/steps/ConfigureCloudInstanceStep.tsx

+81-68
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
CreateClusterStepKey,
2424
useCreateClusterContext,
2525
} from '../CreateClusterWizard'
26+
import { Confirm } from '../../utils/Confirm'
2627

2728
const nameRegex = /^[a-z][a-z0-9-][a-z0-9]{4,9}$/
2829

@@ -35,6 +36,7 @@ export function ConfigureCloudInstanceStep() {
3536
const [size, setSize] = useState<ConsoleSize>(ConsoleSize.Small)
3637
const [cloud, setCloud] = useState<CloudProvider>(CloudProvider.Aws)
3738
const [region, setRegion] = useState<string>(regions[0])
39+
const [confirm, setConfirm] = useState(false)
3840
const isNameValid = nameRegex.test(name)
3941

4042
const canSubmit = !!(
@@ -65,9 +67,8 @@ export function ConfigureCloudInstanceStep() {
6567
setContinueBtn(
6668
<Button
6769
key="create"
68-
loading={loading}
6970
disabled={!canSubmit}
70-
onClick={() => mutation()}
71+
onClick={() => setConfirm(true)}
7172
>
7273
Continue
7374
</Button>
@@ -79,82 +80,94 @@ export function ConfigureCloudInstanceStep() {
7980
}, [canSubmit, loading, mutation, setContinueBtn])
8081

8182
return (
82-
<Flex
83-
flexDirection="column"
84-
gap="medium"
85-
>
86-
{error && <GqlError error={error} />}
87-
<Callout
88-
css={{ marginBottom: theme.spacing.medium }}
89-
title="Your Console may take a few minutes to deploy."
90-
>
91-
After completing this step it may take a few minutes for your Console to
92-
deploy. It will run in the background as you proceed.
93-
</Callout>
94-
<FormFieldSC
95-
label="Cluster name"
96-
hint={
97-
<FormFieldCaptionSC $name={name}>
98-
Name must be between 6 and 11 characters, lowercase, alphanumeric,
99-
and begin with a letter.
100-
</FormFieldCaptionSC>
101-
}
83+
<>
84+
<Flex
85+
flexDirection="column"
86+
gap="medium"
10287
>
103-
<Input
104-
placeholder="Enter cluster name"
105-
borderColor={
106-
name === '' || isNameValid
107-
? undefined
108-
: theme.colors['border-danger']
109-
}
110-
value={name}
111-
onChange={(e) => setName(e.target.value)}
112-
/>
113-
</FormFieldSC>
114-
<FormFieldSC label="Cluster size">
115-
<Select
116-
selectedKey={size}
117-
onSelectionChange={(size) => setSize(size as ConsoleSize)}
88+
{error && <GqlError error={error} />}
89+
<Callout
90+
css={{ marginBottom: theme.spacing.medium }}
91+
title="Your Console may take a few minutes to deploy."
11892
>
119-
{Object.values(ConsoleSize)
120-
.reverse()
121-
.map((value) => (
122-
<ListBoxItem
123-
key={value}
124-
label={firstLetterUppercase(value)}
125-
/>
126-
))}
127-
</Select>
128-
</FormFieldSC>
129-
<FormFieldSC label="Cloud">
130-
<Select
131-
selectedKey={cloud}
132-
onSelectionChange={(cloud) => setCloud(cloud as CloudProvider)}
93+
After completing this step it may take a few minutes for your Console
94+
to deploy. It will run in the background as you proceed.
95+
</Callout>
96+
<FormFieldSC
97+
label="Cluster name"
98+
hint={
99+
<FormFieldCaptionSC $name={name}>
100+
Name must be between 6 and 11 characters, lowercase, alphanumeric,
101+
and begin with a letter.
102+
</FormFieldCaptionSC>
103+
}
133104
>
134-
{Object.values(CloudProvider).map((value) => (
135-
<ListBoxItem
136-
key={value}
137-
label={value}
138-
/>
139-
))}
140-
</Select>
141-
</FormFieldSC>
142-
{cloud === CloudProvider.Aws && (
143-
<FormFieldSC label="Region">
105+
<Input
106+
placeholder="Enter cluster name"
107+
borderColor={
108+
name === '' || isNameValid
109+
? undefined
110+
: theme.colors['border-danger']
111+
}
112+
value={name}
113+
onChange={(e) => setName(e.target.value)}
114+
/>
115+
</FormFieldSC>
116+
<FormFieldSC label="Cluster size">
144117
<Select
145-
selectedKey={region}
146-
onSelectionChange={(region) => setRegion(region as string)}
118+
selectedKey={size}
119+
onSelectionChange={(size) => setSize(size as ConsoleSize)}
147120
>
148-
{regions.map((region) => (
121+
{Object.values(ConsoleSize)
122+
.reverse()
123+
.map((value) => (
124+
<ListBoxItem
125+
key={value}
126+
label={firstLetterUppercase(value)}
127+
/>
128+
))}
129+
</Select>
130+
</FormFieldSC>
131+
<FormFieldSC label="Cloud">
132+
<Select
133+
selectedKey={cloud}
134+
onSelectionChange={(cloud) => setCloud(cloud as CloudProvider)}
135+
>
136+
{Object.values(CloudProvider).map((value) => (
149137
<ListBoxItem
150-
key={region}
151-
label={region}
138+
key={value}
139+
label={value}
152140
/>
153141
))}
154142
</Select>
155143
</FormFieldSC>
156-
)}
157-
</Flex>
144+
{cloud === CloudProvider.Aws && (
145+
<FormFieldSC label="Region">
146+
<Select
147+
selectedKey={region}
148+
onSelectionChange={(region) => setRegion(region as string)}
149+
>
150+
{regions.map((region) => (
151+
<ListBoxItem
152+
key={region}
153+
label={region}
154+
/>
155+
))}
156+
</Select>
157+
</FormFieldSC>
158+
)}
159+
</Flex>
160+
<Confirm
161+
open={confirm}
162+
error={error}
163+
title={`Create cluster`}
164+
text={`Would you like to proceed with cluster creation?`}
165+
submit={() => mutation()}
166+
close={() => setConfirm(false)}
167+
label="Create cluster"
168+
loading={loading}
169+
/>
170+
</>
158171
)
159172
}
160173

www/src/components/profile/AccessTokens.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { useMutation, useQuery } from '@apollo/client'
22
import { Box } from 'grommet'
3-
import { Button, Div, Flex, Span } from 'honorable'
3+
import { Button, Div, Span } from 'honorable'
44
import moment from 'moment'
55
import { useState } from 'react'
66
import lookup from 'country-code-lookup'
77
import { CopyToClipboard } from 'react-copy-to-clipboard'
88
import {
99
CopyIcon,
10+
Flex,
1011
EmptyState,
1112
GraphIcon,
1213
IconFrame,
@@ -280,14 +281,12 @@ export function AccessTokens() {
280281
height="100%"
281282
overflow="hidden"
282283
>
283-
<PageTitle
284-
heading="Access tokens"
285-
justifyContent="flex-start"
286-
>
284+
<PageTitle heading="Access tokens">
287285
<Flex
288286
direction="row"
289287
align="center"
290288
overflow="auto"
289+
flexGrow={1}
291290
>
292291
<Tooltip
293292
width="315px"

0 commit comments

Comments
 (0)