From 2b86e5928fb3ebe3d32a7dceef56b3803958f1cb Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Thu, 29 Nov 2018 13:54:56 +0100 Subject: [PATCH] Extract DirectoryInput parse function Feature #14524 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- .../run-process-panel/inputs/directory-input.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/views/run-process-panel/inputs/directory-input.tsx b/src/views/run-process-panel/inputs/directory-input.tsx index 3bbb2b0d..76863c6d 100644 --- a/src/views/run-process-panel/inputs/directory-input.tsx +++ b/src/views/run-process-panel/inputs/directory-input.tsx @@ -30,11 +30,7 @@ export const DirectoryInput = ({ input }: DirectoryInputProps) => commandInput={input} component={DirectoryInputComponent} format={format} - parse={(directory: CollectionResource): Directory => ({ - class: CWLType.DIRECTORY, - location: `keep:${directory.portableDataHash}`, - basename: directory.name, - })} + parse={parse} validate={[ isRequiredInput(input) ? (directory?: Directory) => directory ? undefined : ERROR_MESSAGE @@ -43,6 +39,12 @@ export const DirectoryInput = ({ input }: DirectoryInputProps) => const format = (value?: Directory) => value ? value.basename : ''; +const parse = (directory: CollectionResource): Directory => ({ + class: CWLType.DIRECTORY, + location: `keep:${directory.portableDataHash}`, + basename: directory.name, +}); + interface DirectoryInputComponentState { open: boolean; -- 2.30.2