-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move embeddable content into smv in ml to remove duplication
- Loading branch information
1 parent
5d994f4
commit cf53d3c
Showing
12 changed files
with
540 additions
and
1,273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
...public/application/timeseriesexplorer/components/timeseriesexplorer_annotations_table.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { FC } from 'react'; | ||
import React from 'react'; | ||
import { EuiAccordion, EuiBadge, EuiCallOut, EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { AnnotationsTable } from '../../components/annotations/annotations_table'; | ||
|
||
interface Props { | ||
chartDetails: any; | ||
detectors: any; | ||
focusAnnotationData: any; | ||
focusAnnotationError: any; | ||
selectedDetectorIndex: number; | ||
selectedJobId: string; | ||
} | ||
|
||
export const TimeSeriesExplorerAnnotationsTable: FC<Props> = ({ | ||
chartDetails, | ||
detectors, | ||
focusAnnotationData, | ||
focusAnnotationError, | ||
selectedDetectorIndex, | ||
selectedJobId, | ||
}) => { | ||
return ( | ||
<> | ||
{focusAnnotationError !== undefined && ( | ||
<> | ||
<EuiTitle data-test-subj="mlAnomalyExplorerAnnotations error" size={'xs'}> | ||
<h2> | ||
<FormattedMessage | ||
id="xpack.ml.timeSeriesExplorer.annotationsErrorTitle" | ||
defaultMessage="Annotations" | ||
/> | ||
</h2> | ||
</EuiTitle> | ||
<EuiPanel> | ||
<EuiCallOut | ||
title={i18n.translate('xpack.ml.timeSeriesExplorer.annotationsErrorCallOutTitle', { | ||
defaultMessage: 'An error occurred loading annotations:', | ||
})} | ||
color="danger" | ||
iconType="warning" | ||
> | ||
<p>{focusAnnotationError}</p> | ||
</EuiCallOut> | ||
</EuiPanel> | ||
<EuiSpacer size="m" /> | ||
</> | ||
)} | ||
{focusAnnotationData && focusAnnotationData.length > 0 && ( | ||
<> | ||
<EuiAccordion | ||
id={'mlAnnotationsAccordion'} | ||
buttonContent={ | ||
<EuiTitle size={'xs'}> | ||
<h2> | ||
<FormattedMessage | ||
id="xpack.ml.timeSeriesExplorer.annotationsTitle" | ||
defaultMessage="Annotations {badge}" | ||
values={{ | ||
badge: ( | ||
<EuiBadge color={'hollow'}> | ||
<FormattedMessage | ||
id="xpack.ml.explorer.annotationsTitleTotalCount" | ||
defaultMessage="Total: {count}" | ||
values={{ count: focusAnnotationData.length }} | ||
/> | ||
</EuiBadge> | ||
), | ||
}} | ||
/> | ||
</h2> | ||
</EuiTitle> | ||
} | ||
data-test-subj="mlAnomalyExplorerAnnotations loaded" | ||
> | ||
<AnnotationsTable | ||
chartDetails={chartDetails} | ||
detectorIndex={selectedDetectorIndex} | ||
detectors={detectors} | ||
jobIds={[selectedJobId]} | ||
annotations={focusAnnotationData} | ||
isSingleMetricViewerLinkVisible={false} | ||
isNumberBadgeVisible={true} | ||
/> | ||
</EuiAccordion> | ||
<EuiSpacer size="m" /> | ||
</> | ||
)} | ||
</> | ||
); | ||
}; |
Oops, something went wrong.