[ARVADOS-WORKBENCH2] updated: 1.2.0-499-g2f320e4

Git user git at public.curoverse.com
Mon Oct 1 04:13:30 EDT 2018


Summary of changes:
 src/validators/is-number.tsx                       | 2 +-
 src/views/run-process-panel/inputs/float-input.tsx | 8 +++++---
 src/views/run-process-panel/inputs/int-input.tsx   | 8 ++++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

       via  2f320e4890a5c74bda5d10fedf6011d23585a4b0 (commit)
       via  b1e94c2980f863debc47501a88b50e6e3597ae31 (commit)
      from  cfff00494c45cb6f8a53373a64d72dbd2fe8cd85 (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 2f320e4890a5c74bda5d10fedf6011d23585a4b0
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Mon Oct 1 10:12:30 2018 +0200

    Add conditional validation detection to int and float inputs
    
    Feature #13863
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views/run-process-panel/inputs/float-input.tsx b/src/views/run-process-panel/inputs/float-input.tsx
index 664425d..f6fffed 100644
--- a/src/views/run-process-panel/inputs/float-input.tsx
+++ b/src/views/run-process-panel/inputs/float-input.tsx
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { getInputLabel, FloatCommandInputParameter } from '~/models/workflow';
+import { getInputLabel, FloatCommandInputParameter, isRequiredInput } from '~/models/workflow';
 import { Field, WrappedFieldProps } from 'redux-form';
 import { TextField } from '~/components/text-field/text-field';
 import { isNumber } from '~/validators/is-number';
@@ -17,8 +17,10 @@ export const FloatInput = ({ input }: FloatInputProps) =>
         component={DecimalInput}
         parse={parseFloat}
         format={value => isNaN(value) ? '' : JSON.stringify(value)}
-        validate={[isNumber]} />;
-
+        validate={[
+            isRequiredInput(input)
+                ? isNumber
+                : () => undefined,]} />;
 
 class DecimalInput extends React.Component<WrappedFieldProps & { label?: string }> {
     state = {
diff --git a/src/views/run-process-panel/inputs/int-input.tsx b/src/views/run-process-panel/inputs/int-input.tsx
index 5b6f95d..60a49b6 100644
--- a/src/views/run-process-panel/inputs/int-input.tsx
+++ b/src/views/run-process-panel/inputs/int-input.tsx
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { IntCommandInputParameter, getInputLabel } from '~/models/workflow';
+import { IntCommandInputParameter, getInputLabel, isRequiredInput } from '~/models/workflow';
 import { Field } from 'redux-form';
 import { TextField } from '~/components/text-field/text-field';
 import { isInteger } from '~/validators/is-integer';
@@ -18,5 +18,9 @@ export const IntInput = ({ input }: IntInputProps) =>
         component={TextField}
         parse={value => parseInt(value, 10)}
         format={value => isNaN(value) ? '' : JSON.stringify(value)}
-        validate={[isInteger]} />;
+        validate={[
+            isRequiredInput(input)
+                ? isInteger
+                : () => undefined,
+        ]} />;
 

commit b1e94c2980f863debc47501a88b50e6e3597ae31
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Mon Oct 1 10:06:41 2018 +0200

    Fix isNumber validator
    
    Feature #13863
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/validators/is-number.tsx b/src/validators/is-number.tsx
index 9b548b9..152c647 100644
--- a/src/validators/is-number.tsx
+++ b/src/validators/is-number.tsx
@@ -6,5 +6,5 @@ import { isNumber as isNum } from 'lodash';
 const ERROR_MESSAGE = 'This field must be a number';
 
 export const isNumber = (value: any) => {
-    return isNum(value) ? undefined : ERROR_MESSAGE;
+    return !isNaN(value) && isNum(value) ? undefined : ERROR_MESSAGE;
 };

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list