File tree Expand file tree Collapse file tree
x-pack/plugins/ml/common/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,10 +91,10 @@ export function isSourceDataChartableForDetector(job: CombinedJob, detectorIndex
9191 // Perform extra check to see if the detector is using a scripted field.
9292 const scriptFields = Object . keys ( job . datafeed_config . script_fields ) ;
9393 isSourceDataChartable =
94- scriptFields . indexOf ( dtr . field_name ) === - 1 &&
95- scriptFields . indexOf ( dtr . partition_field_name ) === - 1 &&
96- scriptFields . indexOf ( dtr . by_field_name ) === - 1 &&
97- scriptFields . indexOf ( dtr . over_field_name ) === - 1 ;
94+ scriptFields . indexOf ( dtr . field_name ! ) === - 1 &&
95+ scriptFields . indexOf ( dtr . partition_field_name ! ) === - 1 &&
96+ scriptFields . indexOf ( dtr . by_field_name ! ) === - 1 &&
97+ scriptFields . indexOf ( dtr . over_field_name ! ) === - 1 ;
9898 }
9999 }
100100
@@ -180,14 +180,16 @@ export function isModelPlotEnabled(
180180 entityField => entityField . fieldName === detector . partition_field_name
181181 ) ;
182182 isEnabled =
183- partitionEntity !== undefined && terms . indexOf ( String ( partitionEntity . fieldValue ) ) !== - 1 ;
183+ partitionEntity ?. fieldValue !== undefined &&
184+ terms . indexOf ( String ( partitionEntity . fieldValue ) ) !== - 1 ;
184185 }
185186
186187 if ( isEnabled === true && detectorHasByField === true ) {
187188 const byEntity = entityFields . find (
188189 entityField => entityField . fieldName === detector . by_field_name
189190 ) ;
190- isEnabled = byEntity !== undefined && terms . indexOf ( String ( byEntity . fieldValue ) ) !== - 1 ;
191+ isEnabled =
192+ byEntity ?. fieldValue !== undefined && terms . indexOf ( String ( byEntity . fieldValue ) ) !== - 1 ;
191193 }
192194 }
193195 }
You can’t perform that action at this time.
0 commit comments