File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ const VALIDATIONS = {
8
8
'unique' ,
9
9
'differentFrom' ,
10
10
'sameAs' ,
11
+ 'lessThanVariable' ,
12
+ 'greaterThanVariable' ,
11
13
] ,
12
14
number : [
13
15
'required' ,
@@ -16,18 +18,24 @@ const VALIDATIONS = {
16
18
'unique' ,
17
19
'differentFrom' ,
18
20
'sameAs' ,
21
+ 'lessThanVariable' ,
22
+ 'greaterThanVariable' ,
19
23
] ,
20
24
datetime : [
21
25
'required' ,
22
26
'unique' ,
23
27
'differentFrom' ,
24
28
'sameAs' ,
29
+ 'lessThanVariable' ,
30
+ 'greaterThanVariable' ,
25
31
] ,
26
32
scalar : [
27
33
'required' ,
28
34
'unique' ,
29
35
'differentFrom' ,
30
36
'sameAs' ,
37
+ 'lessThanVariable' ,
38
+ 'greaterThanVariable' ,
31
39
] ,
32
40
boolean : [
33
41
'required' ,
@@ -40,6 +48,8 @@ const VALIDATIONS = {
40
48
'unique' ,
41
49
'differentFrom' ,
42
50
'sameAs' ,
51
+ 'lessThanVariable' ,
52
+ 'greaterThanVariable' ,
43
53
] ,
44
54
categorical : [
45
55
'required' ,
@@ -63,6 +73,8 @@ const VALIDATIONS_WITH_NUMBER_VALUES = [
63
73
const VALIDATIONS_WITH_LIST_VALUES = [
64
74
'differentFrom' ,
65
75
'sameAs' ,
76
+ 'lessThanVariable' ,
77
+ 'greaterThanVariable' ,
66
78
] ;
67
79
68
80
const isValidationWithNumberValue = ( validation ) => (
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React from 'react';
2
2
import PropTypes from 'prop-types' ;
3
3
import { useSelector , useDispatch } from 'react-redux' ;
4
4
import { change , formValueSelector } from 'redux-form' ;
5
+ import { get , filter } from 'lodash' ;
5
6
import { Section , Row } from '@components/EditorLayout' ;
6
7
import Validations from '@components/Validations' ;
7
8
import { getFieldId } from '../../utils/issues' ;
@@ -24,6 +25,7 @@ const ValidationSection = ({
24
25
return true ;
25
26
} ;
26
27
28
+ const existingVariablesForType = filter ( existingVariables , ( variable ) => get ( variable , 'type' ) === variableType ) ;
27
29
return (
28
30
< Section
29
31
disabled = { disabled }
@@ -43,7 +45,7 @@ const ValidationSection = ({
43
45
form = { form }
44
46
name = "validation"
45
47
variableType = { variableType }
46
- existingVariables = { existingVariables }
48
+ existingVariables = { existingVariablesForType }
47
49
/>
48
50
</ Row >
49
51
</ Section >
You can’t perform that action at this time.
0 commit comments