Skip to content

Commit

Permalink
feat: improve UX by don't reject empty tags
Browse files Browse the repository at this point in the history
  • Loading branch information
simonknittel committed Jan 1, 2025
1 parent 8e526fc commit 666933c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/src/fleet/actions/createVariant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const schema = z.object({
status: z
.enum([VariantStatus.FLIGHT_READY, VariantStatus.NOT_FLIGHT_READY])
.optional(),
tagKeys: z.array(z.string().trim().min(1)).optional(),
tagValues: z.array(z.string().trim().min(1)).optional(),
tagKeys: z.array(z.string().trim()).optional(),
tagValues: z.array(z.string().trim()).optional(),
});

export const createVariant = async (formData: FormData) => {
Expand Down
4 changes: 2 additions & 2 deletions app/src/fleet/actions/updateVariant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const schema = z.object({
status: z
.enum([VariantStatus.FLIGHT_READY, VariantStatus.NOT_FLIGHT_READY])
.optional(),
tagKeys: z.array(z.string().trim().min(1)).optional(),
tagValues: z.array(z.string().trim().min(1)).optional(),
tagKeys: z.array(z.string().trim()).optional(),
tagValues: z.array(z.string().trim()).optional(),
});

export const updateVariant: ServerAction = async (formData) => {
Expand Down
2 changes: 0 additions & 2 deletions app/src/fleet/components/CreateVariantModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,13 @@ export const CreateVariantModal = ({
className="p-2 rounded bg-neutral-900 flex-1 min-w-0"
name="tagKeys[]"
placeholder="Key"
required
defaultValue={tag.key}
/>
<input
type="text"
className="p-2 rounded bg-neutral-900 flex-1 min-w-0"
name="tagValues[]"
placeholder="Value"
required
defaultValue={tag.value}
/>
<Button
Expand Down
2 changes: 0 additions & 2 deletions app/src/fleet/components/UpdateVariantModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,13 @@ export const UpdateVariantModal = ({ onRequestClose, variant }: Props) => {
className="p-2 rounded bg-neutral-900 flex-1 min-w-0"
name="tagKeys[]"
placeholder="Key"
required
defaultValue={tag.key}
/>
<input
type="text"
className="p-2 rounded bg-neutral-900 flex-1 min-w-0"
name="tagValues[]"
placeholder="Value"
required
defaultValue={tag.value}
/>
<Button
Expand Down

0 comments on commit 666933c

Please sign in to comment.