Skip to content

Commit e2bdafc

Browse files
authored
feat: [WD-24084] Fix error messaging for creation a SB with no valid … (#1411)
…pools available. ## Done - Fix error messaging for creation a SB with no valid pools available. ## QA 1. Run the LXD-UI: - On the demo server via the link posted by @webteam-app below. This is only available for PRs created by collaborators of the repo. Ask @Kxiru or @edlerd for access. - With a local copy of this branch, [build and run as described in the docs](https://github.com/canonical/lxd-ui/blob/main/CONTRIBUTING.md#setting-up-for-development). 2. Perform the following QA steps: - [List the steps to QA the new feature(s) or prove that a bug has been resolved] ## Screenshots <img width="1437" height="1040" alt="image" src="https://github.com/user-attachments/assets/647ffc96-26cb-441b-899f-8d44ecc5d114" />
2 parents 792a58b + a534ca5 commit e2bdafc

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

src/pages/storage/forms/StorageBucketForm.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,6 @@ const StorageBucketForm: FC<Props> = ({ formik, bucket }) => {
4646
<Form onSubmit={formik.handleSubmit} className={"bucket-create-form"}>
4747
{/* hidden submit to enable enter key in inputs */}
4848
<Input type="submit" hidden value="Hidden input" />
49-
<Input
50-
{...getFormProps("name")}
51-
type="text"
52-
label="Name"
53-
required
54-
autoFocus
55-
disabled={!!bucketEditRestriction || isEditing}
56-
help={isEditing && "Storage bucket name can't be changed"}
57-
title={bucketEditRestriction}
58-
/>
59-
6049
<StoragePoolSelector
6150
value={formik.values.pool}
6251
setValue={(value) => void formik.setFieldValue("pool", value)}
@@ -69,9 +58,26 @@ const StorageBucketForm: FC<Props> = ({ formik, bucket }) => {
6958
disabled: !!bucketEditRestriction || isEditing,
7059
help: isEditing
7160
? "Storage bucket pool can't be changed"
72-
: "Pool must have a Ceph Object driver",
61+
: formik.errors.pool
62+
? null
63+
: "Pool must have a Ceph Object driver",
64+
error: formik.errors.pool,
65+
onBlur: formik.handleBlur,
66+
takeFocus: true,
67+
required: true,
7368
}}
7469
/>
70+
71+
<Input
72+
{...getFormProps("name")}
73+
type="text"
74+
label="Name"
75+
required
76+
disabled={!!bucketEditRestriction || isEditing}
77+
help={isEditing && "Storage bucket name can't be changed"}
78+
title={bucketEditRestriction}
79+
/>
80+
7581
<DiskSizeSelector
7682
label="Size"
7783
value={formik.values.size}

src/pages/storage/panels/CreateStorageBucketPanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const CreateStorageBucketPanel: FC = () => {
4040
...testDuplicateStorageBucketName(panelParams.project, controllerState),
4141
)
4242
.required("Bucket name is required"),
43+
pool: Yup.string().required("Pool must have a Ceph Object driver"),
4344
});
4445

4546
const handleSuccess = (bucketName: string, pool: string) => {

0 commit comments

Comments
 (0)