From 64fd423c614248beb5a067d761354c11dffe3b9e Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Fri, 29 Nov 2024 13:34:36 -0800 Subject: [PATCH] improvement: update import secret env select --- .../ActionBar/CreateSecretImportForm.tsx | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/frontend/src/views/SecretMainPage/components/ActionBar/CreateSecretImportForm.tsx b/frontend/src/views/SecretMainPage/components/ActionBar/CreateSecretImportForm.tsx index 7f9f2a4fe..ffd987e3e 100644 --- a/frontend/src/views/SecretMainPage/components/ActionBar/CreateSecretImportForm.tsx +++ b/frontend/src/views/SecretMainPage/components/ActionBar/CreateSecretImportForm.tsx @@ -6,6 +6,7 @@ import { z } from "zod"; import { createNotification } from "@app/components/notifications"; import { Button, + FilterableSelect, FormControl, Modal, ModalContent, @@ -17,7 +18,7 @@ import { useSubscription, useWorkspace } from "@app/context"; import { useCreateSecretImport } from "@app/hooks/api"; const typeSchema = z.object({ - environment: z.string().trim(), + environment: z.object({ name: z.string(), slug: z.string() }), secretPath: z .string() .trim() @@ -80,7 +81,7 @@ export const CreateSecretImportForm = ({ path: secretPath, isReplication, import: { - environment: importedEnv, + environment: importedEnv.slug, path: importedSecPath } }); @@ -88,8 +89,9 @@ export const CreateSecretImportForm = ({ reset(); createNotification({ type: "success", - text: `Successfully linked. ${isReplication ? "Please refresh the dashboard to view changes" : "" - }` + text: `Successfully linked. ${ + isReplication ? "Please refresh the dashboard to view changes" : "" + }` }); } catch (err) { console.error(err); @@ -118,21 +120,16 @@ export const CreateSecretImportForm = ({ ( + render={({ field: { onChange, value }, fieldState: { error } }) => ( - + option.name} + getOptionValue={(option) => option.slug} + placeholder="Select environment..." + value={value} + onChange={onChange} + /> )} /> @@ -142,7 +139,7 @@ export const CreateSecretImportForm = ({ defaultValue="/" render={({ field, fieldState: { error } }) => ( - + )} />