Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipb committed Sep 28, 2020
1 parent 20263f8 commit 78e8191
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const FlyoutHome = (props: Props) => {
return (
<LoadingPage
message={i18n.translate('xpack.infra.ml.anomalyFlyout.jobStatusLoadingMessage', {
defaultMessage: 'Checking status of metris jobs...',
defaultMessage: 'Checking status of metrics jobs...',
})}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export const JobSetupScreen = (props: Props) => {
label={
<FormattedMessage
id="xpack.infra.ml.steps.setupProcess.partition.label"
defaultMessage="Partition filed"
defaultMessage="Partition field"
/>
}
compressed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import moment from 'moment';
import { first, last } from 'lodash';
import { EuiLoadingChart, EuiText, EuiEmptyPrompt, EuiButton, EuiIcon } from '@elastic/eui';
import { EuiLoadingChart, EuiText, EuiEmptyPrompt, EuiButton } from '@elastic/eui';
import {
Axis,
Chart,
Expand Down Expand Up @@ -189,8 +189,15 @@ export const Timeline: React.FC<Props> = ({ interval, yAxisFormatter, isVisible
);
}

function generateAnnotationData(values: any[]): LineAnnotationDatum[] {
return values.map((value, index) => ({ dataValue: value, details: `detail-${index}` }));
function generateAnnotationData(results: number[][]): LineAnnotationDatum[] {
return results.map((anomaly, index) => {
const [val, score] = anomaly;
return {
dataValue: val,
details: `Score: ${score}`,
header: `Anomaly`,
};
});
}

return (
Expand All @@ -208,19 +215,18 @@ export const Timeline: React.FC<Props> = ({ interval, yAxisFormatter, isVisible
</TimelineHeader>
<TimelineChartContainer>
<Chart>
{(anomalies || []).map((a) => {
return (
<LineAnnotation
key={a.id}
id={a.id}
domainType={AnnotationDomainTypes.XDomain}
dataValues={generateAnnotationData([a.startTime, 0])}
style={annotationStyle}
marker={<EuiIcon onClick={() => alert('clicked')} type="alert" />}
markerPosition={'bottom'}
/>
);
})}
{anomalies && (
<LineAnnotation
id={'anomalies'}
domainType={AnnotationDomainTypes.XDomain}
dataValues={generateAnnotationData(
anomalies.map((a) => [a.startTime, a.anomalyScore])
)}
style={annotationStyle}
marker={<div style={{ background: 'red', padding: 5 }} />}
markerPosition={'bottom'}
/>
)}
<MetricExplorerSeriesChart
type={MetricsExplorerChartType.area}
metric={chartMetric}
Expand Down Expand Up @@ -257,7 +263,7 @@ const annotationStyle = {
line: {
strokeWidth: 3,
stroke: '#f00',
opacity: 1,
opacity: 0,
},
details: {
fontSize: 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,6 @@ export const useMetricsHostsAnomaliesResults = ({
});
}, [filteredDatasets]);

// useEffect(() => {
// getMetricsHostsAnomalies();
// }, [getMetricsHostsAnomalies]); // TODO: FIgure out the deps here.

const handleFetchNextPage = useCallback(() => {
if (reducerState.lastReceivedCursors) {
dispatch({ type: 'fetchNextPage' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,6 @@ export const useMetricsK8sAnomaliesResults = ({
});
}, [filteredDatasets]);

// useEffect(() => {
// getMetricsK8sAnomalies();
// }, [getMetricsK8sAnomalies]);

const handleFetchNextPage = useCallback(() => {
if (reducerState.lastReceivedCursors) {
dispatch({ type: 'fetchNextPage' });
Expand Down

0 comments on commit 78e8191

Please sign in to comment.