Skip to content

Commit 8966ed5

Browse files
authored
fix: add optional value label for environment variables in build creation (#611)
1 parent 3f012cf commit 8966ed5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/components/forms/KeyValue.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ interface KeyValueProps {
119119
// render the value field as a textarea when true
120120
isTextArea?: boolean
121121
isEncrypted?: boolean
122+
isValueOptional?: boolean
122123
}
123124

124125
// This local subcomponent watches the key field (using its path) and checks the provided
@@ -182,6 +183,7 @@ export default function KeyValue(props: KeyValueProps) {
182183
decoratorMapping,
183184
isTextArea = false,
184185
isEncrypted,
186+
isValueOptional = false,
185187
} = props
186188

187189
const { fields, append, remove } = useFieldArray({ control, name })
@@ -220,7 +222,7 @@ export default function KeyValue(props: KeyValueProps) {
220222
const commonProps = {
221223
...register(valuePath),
222224
width: valueSize,
223-
label: showLabel && localIndex === 0 ? valueLabel : '',
225+
label: showLabel && localIndex === 0 ? `${valueLabel}${isValueOptional ? ' (optional)' : ''}` : '',
224226
noMarginTop: compressed,
225227
disabled: isFieldDisabled,
226228
type: valueIsNumber ? 'number' : undefined,

src/pages/builds/create-edit/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,13 @@ export default function CreateEditBuilds({
313313
title='Extra arguments'
314314
subTitle='Additional arguments to pass on to the build executor'
315315
keyLabel='Name'
316-
valueLabel='Value (optional)'
316+
valueLabel='Value'
317317
addLabel='Add argument'
318318
compressed
319319
name={`mode.${watch('mode.type')}.envVars`}
320320
{...register(`mode.${watch('mode.type')}.envVars`)}
321321
errorText={extraArgumentsError()}
322+
isValueOptional
322323
/>
323324

324325
<Divider sx={{ mt: 2, mb: 2 }} />

0 commit comments

Comments
 (0)