[arvados-workbench2] updated: 2.6.3-105-g9acf0acc

git repository hosting git at public.arvados.org
Thu Sep 14 21:07:48 UTC 2023


Summary of changes:
 src/views/run-process-panel/inputs/enum-input.tsx | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

       via  9acf0accecfba4ac2f6dd2bb5f441ba7354a237b (commit)
      from  0737f5067e29dea6a72a6612fddffe64d919e459 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 9acf0accecfba4ac2f6dd2bb5f441ba7354a237b
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Thu Sep 14 17:06:11 2023 -0400

    19359: Can select empty item to clear optional enum input
    
    Sets the field value to null, which means "use default value" in CWL.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/views/run-process-panel/inputs/enum-input.tsx b/src/views/run-process-panel/inputs/enum-input.tsx
index 8a999786..207a30ac 100644
--- a/src/views/run-process-panel/inputs/enum-input.tsx
+++ b/src/views/run-process-panel/inputs/enum-input.tsx
@@ -21,12 +21,21 @@ const getValidation = memoize(
             : () => undefined,
     ]));
 
+const emptyToNull = value => {
+    if (value === '') {
+        return null;
+    } else {
+        return value;
+    }
+};
+
 export const EnumInput = ({ input }: EnumInputProps) =>
     <Field
         name={input.id}
         commandInput={input}
         component={EnumInputComponent}
         validate={getValidation(input)}
+        normalize={emptyToNull}
     />;
 
 const EnumInputComponent = (props: GenericInputProps) =>
@@ -40,10 +49,10 @@ const Input = (props: GenericInputProps) => {
         value={props.input.value}
         onChange={props.input.onChange}
         disabled={props.commandInput.disabled} >
-        {type.symbols.map(symbol =>
+        {(isRequiredInput(props.commandInput) ? [] : [<MenuItem key={'_empty'} value={''} />]).concat(type.symbols.map(symbol =>
             <MenuItem key={symbol} value={extractValue(symbol)}>
                 {extractValue(symbol)}
-            </MenuItem>)}
+            </MenuItem>))}
     </Select>;
 };
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list