Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run prettier command against all files #444

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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