Commit 66abe0f 1 parent 58bbec8 commit 66abe0f Copy full SHA for 66abe0f
File tree 1 file changed +10
-0
lines changed
public/pages/DefineDetector/components/CustomResultIndex
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ interface CustomResultIndexProps {
48
48
function CustomResultIndex ( props : CustomResultIndexProps ) {
49
49
const [ enabled , setEnabled ] = useState < boolean > ( ! ! props . resultIndex ) ;
50
50
const [ customResultIndexConditionsEnabled , setCustomResultIndexConditionsEnabled ] = useState < boolean > ( true ) ;
51
+ const [ isDisabled , setIsDisabled ] = useState ( false ) ;
51
52
const customResultIndexMinAge = get ( props . formikProps , 'values.resultIndexMinAge' ) ;
52
53
const customResultIndexMinSize = get ( props . formikProps , 'values.resultIndexMinSize' ) ;
53
54
const customResultIndexTTL = get ( props . formikProps , 'values.resultIndexTtl' ) ;
@@ -66,6 +67,14 @@ function CustomResultIndex(props: CustomResultIndexProps) {
66
67
}
67
68
} , [ customResultIndexConditionsEnabled ] )
68
69
70
+ useEffect ( ( ) => {
71
+ if ( props . isEdit && ! get ( props . formikProps , 'values.flattenCustomResultIndex' ) ) {
72
+ setIsDisabled ( true ) ;
73
+ } else {
74
+ setIsDisabled ( false ) ;
75
+ }
76
+ } , [ props . isEdit ] ) ;
77
+
69
78
const hintTextStyle = {
70
79
color : '#69707d' ,
71
80
fontSize : '12px' ,
@@ -162,6 +171,7 @@ function CustomResultIndex(props: CustomResultIndexProps) {
162
171
id = { 'flattenCustomResultIndex' }
163
172
label = "Enable flattened custom result index"
164
173
checked = { field . value ? field . value : get ( props . formikProps , 'values.flattenCustomResultIndex' ) }
174
+ disabled = { isDisabled }
165
175
{ ...field }
166
176
/>
167
177
< p style = { hintTextStyle } > Flattening the custom result index will make it easier to query them on the dashboard. It also allows you to perform term aggregations on categorical fields.</ p >
You can’t perform that action at this time.
0 commit comments