From 89f5e163802e04dc6ebb84a390bbc5907486a718 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Thu, 29 Nov 2018 14:22:51 +0100 Subject: [PATCH] Extract FileInput's parse function Feature #14524 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- src/views/run-process-panel/inputs/file-input.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/views/run-process-panel/inputs/file-input.tsx b/src/views/run-process-panel/inputs/file-input.tsx index 0e567137f0..e5fa9663ce 100644 --- a/src/views/run-process-panel/inputs/file-input.tsx +++ b/src/views/run-process-panel/inputs/file-input.tsx @@ -29,11 +29,7 @@ export const FileInput = ({ input }: FileInputProps) => commandInput={input} component={FileInputComponent} format={format} - parse={(file: CollectionFile): File => ({ - class: CWLType.FILE, - location: `keep:${file.id}`, - basename: file.name, - })} + parse={parse} validate={[ isRequiredInput(input) ? (file?: File) => file ? undefined : ERROR_MESSAGE @@ -42,6 +38,12 @@ export const FileInput = ({ input }: FileInputProps) => const format = (value?: File) => value ? value.basename : ''; +const parse = (file: CollectionFile): File => ({ + class: CWLType.FILE, + location: `keep:${file.id}`, + basename: file.name, +}); + interface FileInputComponentState { open: boolean; file?: CollectionFile; -- 2.30.2