@@ -18,7 +18,7 @@ import { Alert, AlertDescription, AlertTitle } from 'components/redpanda-ui/comp
1818import { Button } from 'components/redpanda-ui/components/button' ;
1919import { Card , CardContent , CardHeader , CardTitle , CardVariant } from 'components/redpanda-ui/components/card' ;
2020import { Field , FieldDescription , FieldError , FieldLabel } from 'components/redpanda-ui/components/field' ;
21- import { Input , InputEnd } from 'components/redpanda-ui/components/input' ;
21+ import { Input } from 'components/redpanda-ui/components/input' ;
2222import { Text } from 'components/redpanda-ui/components/typography' ;
2323import { Check , Key , Loader2 , Plus , X } from 'lucide-react' ;
2424import { CreateSecretRequestSchema } from 'protogen/redpanda/api/console/v1alpha1/secret_pb' ;
@@ -281,58 +281,45 @@ export const QuickAddSecrets: React.FC<QuickAddSecretsProps> = ({
281281 </ AlertDescription >
282282 </ Alert >
283283
284- < div className = "space-y-4" >
285- < div className = "flex flex-col gap-2" >
286- < form key = { formKey } className = "space-y-5" onSubmit = { form . handleSubmit ( handleCreateSecrets ) } >
287- { missingSecrets . map ( ( normalizedSecretName ) => {
288- const fieldName = `${ normalizedSecretName } .value` as keyof SecretFormData ;
289- const error = form . formState . errors [ normalizedSecretName ] ?. value ;
290- const nameId = `secret-name-${ normalizedSecretName } ` ;
291- const valueId = `secret-value-${ normalizedSecretName } ` ;
292-
293- return (
294- < div className = "flex flex-col gap-2" key = { normalizedSecretName } >
295- < Field >
296- < FieldLabel className = "font-medium text-muted-foreground text-xs" htmlFor = { nameId } >
297- Secret name
298- </ FieldLabel >
299- < Input className = "font-mono" disabled id = { nameId } readOnly value = { normalizedSecretName } />
300- </ Field >
301- < Field data-invalid = { ! ! error } >
302- < FieldLabel className = "font-medium text-muted-foreground text-xs" htmlFor = { valueId } >
303- Secret value
304- </ FieldLabel >
305- < Input
306- id = { valueId }
307- placeholder = "Enter the secret value"
308- type = "password"
309- { ...form . register ( fieldName ) }
310- aria-describedby = { error ? `${ valueId } -error` : undefined }
311- aria-invalid = { ! ! error }
312- />
313- { ! ! error && < FieldError id = { `${ valueId } -error` } > { error . message } </ FieldError > }
314- </ Field >
315- </ div >
316- ) ;
317- } ) }
318-
319- < Button className = "w-full" disabled = { form . formState . isSubmitting } type = "submit" variant = "primary" >
320- { form . formState . isSubmitting ? (
321- < div className = "flex items-center gap-2" >
322- < Loader2 className = "h-4 w-4 animate-spin" />
323- < Text as = "span" > Creating...</ Text >
324- </ div >
325- ) : (
326- < >
327- < Plus className = "h-4 w-4" />
328- Create { missingSecrets . length } secret
329- { missingSecrets . length > 1 ? 's' : '' }
330- </ >
331- ) }
332- </ Button >
333- </ form >
334- </ div >
335- </ div >
284+ < form key = { formKey } className = "space-y-4" onSubmit = { form . handleSubmit ( handleCreateSecrets ) } >
285+ { missingSecrets . map ( ( normalizedSecretName ) => {
286+ const fieldName = `${ normalizedSecretName } .value` as keyof SecretFormData ;
287+ const error = form . formState . errors [ normalizedSecretName ] ?. value ;
288+ const valueId = `secret-value-${ normalizedSecretName } ` ;
289+
290+ return (
291+ < Field data-invalid = { ! ! error } key = { normalizedSecretName } >
292+ < FieldLabel className = "font-medium font-mono text-sm" htmlFor = { valueId } >
293+ { normalizedSecretName }
294+ </ FieldLabel >
295+ < Input
296+ id = { valueId }
297+ placeholder = "Enter value"
298+ type = "password"
299+ { ...form . register ( fieldName ) }
300+ aria-describedby = { error ? `${ valueId } -error` : undefined }
301+ aria-invalid = { ! ! error }
302+ />
303+ { ! ! error && < FieldError id = { `${ valueId } -error` } > { error . message } </ FieldError > }
304+ </ Field >
305+ ) ;
306+ } ) }
307+
308+ < Button className = "w-full" disabled = { form . formState . isSubmitting } type = "submit" variant = "primary" >
309+ { form . formState . isSubmitting ? (
310+ < div className = "flex items-center gap-2" >
311+ < Loader2 className = "h-4 w-4 animate-spin" />
312+ < Text as = "span" > Creating...</ Text >
313+ </ div >
314+ ) : (
315+ < >
316+ < Plus className = "h-4 w-4" />
317+ Create { missingSecrets . length } secret
318+ { missingSecrets . length > 1 ? 's' : '' }
319+ </ >
320+ ) }
321+ </ Button >
322+ </ form >
336323 </ >
337324 ) ;
338325
@@ -341,14 +328,16 @@ export const QuickAddSecrets: React.FC<QuickAddSecretsProps> = ({
341328 { /* Display newly created secrets */ }
342329 { newlyCreatedSecrets . length > 0 && (
343330 < div className = "space-y-2" >
344- < Text className = "font-medium text-muted-foreground text-sm" > Created secrets: </ Text >
345- < div className = "space-y-2 " >
331+ < Text className = "font-medium text-muted-foreground text-sm" > Created secrets</ Text >
332+ < div className = "flex flex-col gap-1.5 " >
346333 { newlyCreatedSecrets . map ( ( secretName ) => (
347- < Input className = "font-mono" disabled key = { secretName } readOnly value = { secretName } >
348- < InputEnd >
349- < Check className = "h-4 w-4 text-green-600" />
350- </ InputEnd >
351- </ Input >
334+ < div
335+ className = "flex items-center gap-2 rounded-md border border-green-600/30 bg-green-600/5 px-3 py-2"
336+ key = { secretName }
337+ >
338+ < Check className = "h-4 w-4 shrink-0 text-green-600" />
339+ < Text className = "font-mono text-sm" > { secretName } </ Text >
340+ </ div >
352341 ) ) }
353342 </ div >
354343 </ div >
0 commit comments