From 2910683012103ac87fc7c037015784b6fe193b45 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Mon, 27 Mar 2023 15:29:18 -0700 Subject: [PATCH] run prettier command against all files Signed-off-by: Jackie Han --- .../containers/AnomaliesChart.tsx | 9 +- .../containers/AnomalyDetailsChart.tsx | 16 ++-- .../utils/__tests__/helpers.test.tsx | 89 ++++++++++--------- public/pages/DefineDetector/utils/helpers.ts | 5 +- .../containers/AnomalyResults.tsx | 9 +- 5 files changed, 66 insertions(+), 62 deletions(-) diff --git a/public/pages/AnomalyCharts/containers/AnomaliesChart.tsx b/public/pages/AnomalyCharts/containers/AnomaliesChart.tsx index a380f806..0a9a4e03 100644 --- a/public/pages/AnomalyCharts/containers/AnomaliesChart.tsx +++ b/public/pages/AnomalyCharts/containers/AnomaliesChart.tsx @@ -110,13 +110,10 @@ export const AnomaliesChart = React.memo((props: AnomaliesChartProps) => { const handleDateRangeChange = (startDate: number, endDate: number) => { props.onDateRangeChange(startDate, endDate); props.onZoomRangeChange(startDate, endDate); - if ( - !props.isHistorical && - endDate < get(props, 'detector.enabledTime') - ) { - setShowOutOfRangeCallOut(true) + if (!props.isHistorical && endDate < get(props, 'detector.enabledTime')) { + setShowOutOfRangeCallOut(true); } else { - setShowOutOfRangeCallOut(false) + setShowOutOfRangeCallOut(false); } }; diff --git a/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx b/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx index 0743f46c..e2116e30 100644 --- a/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx +++ b/public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx @@ -427,15 +427,19 @@ export const AnomalyDetailsChart = React.memo( return ( {props.openOutOfRangeCallOut ? ( - - {`Your selected dates are not in the range from when the detector + + {`Your selected dates are not in the range from when the detector last started streaming data - (${moment(get(props, 'detector.enabledTime')).format('MM/DD/YYYY hh:mm A')}).`} + (${moment(get(props, 'detector.enabledTime')).format( + 'MM/DD/YYYY hh:mm A' + )}).`} ) : null} - + { test('should return initialValues if detector is null', () => { @@ -54,61 +58,58 @@ describe('detectorDefinitionToFormik', () => { windowDelay: randomDetector.windowDelay.period.interval, }); }); - test('upgrade old detector\'s filters to include filter type', () => { + test("upgrade old detector's filters to include filter type", () => { const randomDetector = getRandomDetector(); randomDetector.uiMetadata = { features: {}, - filters : [ + filters: [ { - fieldInfo : [ + fieldInfo: [ { - label : 'service', - type : DATA_TYPES.KEYWORD - } + label: 'service', + type: DATA_TYPES.KEYWORD, + }, ], - fieldValue : "app_3", - operator : OPERATORS_MAP.IS + fieldValue: 'app_3', + operator: OPERATORS_MAP.IS, }, { - fieldInfo : [ + fieldInfo: [ { - label : "host", - type : DATA_TYPES.KEYWORD - } + label: 'host', + type: DATA_TYPES.KEYWORD, + }, ], - fieldValue : "server_2", - operator : OPERATORS_MAP.IS - } + fieldValue: 'server_2', + operator: OPERATORS_MAP.IS, + }, ], - filterType : FILTER_TYPES.SIMPLE + filterType: FILTER_TYPES.SIMPLE, }; const adFormikValues = filtersToFormik(randomDetector); - expect(adFormikValues).toEqual( - [ - { - fieldInfo : [ - { - label : 'service', - type : DATA_TYPES.KEYWORD - } - ], - fieldValue : "app_3", - operator : OPERATORS_MAP.IS, - filterType : FILTER_TYPES.SIMPLE - }, - { - fieldInfo : [ - { - label : "host", - type : DATA_TYPES.KEYWORD - } - ], - fieldValue : "server_2", - operator : OPERATORS_MAP.IS, - filterType : FILTER_TYPES.SIMPLE - } - ] - ); + expect(adFormikValues).toEqual([ + { + fieldInfo: [ + { + label: 'service', + type: DATA_TYPES.KEYWORD, + }, + ], + fieldValue: 'app_3', + operator: OPERATORS_MAP.IS, + filterType: FILTER_TYPES.SIMPLE, + }, + { + fieldInfo: [ + { + label: 'host', + type: DATA_TYPES.KEYWORD, + }, + ], + fieldValue: 'server_2', + operator: OPERATORS_MAP.IS, + filterType: FILTER_TYPES.SIMPLE, + }, + ]); }); - }); diff --git a/public/pages/DefineDetector/utils/helpers.ts b/public/pages/DefineDetector/utils/helpers.ts index fd427913..f9e9ae45 100644 --- a/public/pages/DefineDetector/utils/helpers.ts +++ b/public/pages/DefineDetector/utils/helpers.ts @@ -89,8 +89,9 @@ export function filtersToFormik(detector: Detector): UIFilter[] { }, ]; } else { - curFilters.forEach((filter: UIFilter) => - filter.filterType = curFilterType); + curFilters.forEach( + (filter: UIFilter) => (filter.filterType = curFilterType) + ); } } return curFilters; diff --git a/public/pages/DetectorResults/containers/AnomalyResults.tsx b/public/pages/DetectorResults/containers/AnomalyResults.tsx index 2e769d08..827570ce 100644 --- a/public/pages/DetectorResults/containers/AnomalyResults.tsx +++ b/public/pages/DetectorResults/containers/AnomalyResults.tsx @@ -312,10 +312,11 @@ export function AnomalyResults(props: AnomalyResultsProps) { />

- Attempting to initialize the detector with historical data. - This initializing process takes approximately 1 minute if - you have data in each of the last{' '} - {32+get(detector, 'shingleSize', DEFAULT_SHINGLE_SIZE)}{' '} consecutive intervals. + Attempting to initialize the detector with historical data. This + initializing process takes approximately 1 minute if you have + data in each of the last{' '} + {32 + get(detector, 'shingleSize', DEFAULT_SHINGLE_SIZE)}{' '} + consecutive intervals.