Skip to content

Commit

Permalink
run prettier command against all files (#444)
Browse files Browse the repository at this point in the history
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
(cherry picked from commit 95fd0fd)
  • Loading branch information
jackiehanyang authored and amitgalitz committed Apr 2, 2023
1 parent 8d2a955 commit 8b576a5
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 62 deletions.
9 changes: 3 additions & 6 deletions public/pages/AnomalyCharts/containers/AnomaliesChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
16 changes: 10 additions & 6 deletions public/pages/AnomalyCharts/containers/AnomalyDetailsChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -427,15 +427,19 @@ export const AnomalyDetailsChart = React.memo(
return (
<React.Fragment>
{props.openOutOfRangeCallOut ? (
<EuiCallOut data-test-subj='outOfRangeCallOut'
title='Selected dates are out of the range'
color='primary'>
{`Your selected dates are not in the range from when the detector
<EuiCallOut
data-test-subj="outOfRangeCallOut"
title="Selected dates are out of the range"
color="primary"
>
{`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'
)}).`}
</EuiCallOut>
) : null}

<EuiFlexGroup style={{ padding: '20px' }}>
<EuiFlexItem>
<EuiStat
Expand Down
89 changes: 45 additions & 44 deletions public/pages/DefineDetector/utils/__tests__/helpers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ import {
detectorDefinitionToFormik,
filtersToFormik,
} from '../../utils/helpers';
import { Detector, OPERATORS_MAP, FILTER_TYPES } from '../../../../models/interfaces';
import {
Detector,
OPERATORS_MAP,
FILTER_TYPES,
} from '../../../../models/interfaces';

describe('detectorDefinitionToFormik', () => {
test('should return initialValues if detector is null', () => {
Expand Down Expand Up @@ -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,
},
]);
});

});
5 changes: 3 additions & 2 deletions public/pages/DefineDetector/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions public/pages/DetectorResults/containers/AnomalyResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,11 @@ export function AnomalyResults(props: AnomalyResultsProps) {
/>
<EuiText>
<p>
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.
</p>
</EuiText>
</EuiFlexGroup>
Expand Down

0 comments on commit 8b576a5

Please sign in to comment.