forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Adds action to add log rate analysis to a case (elastic#201549)
## Summary Follow up to [elastic#197247](elastic#197247) Adds action to add Log Rate Analysis Embeddable to a case. https://github.com/user-attachments/assets/f45554e1-cef7-4c54-bea5-c509f236a956 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
2af799b
commit aa4c39c
Showing
27 changed files
with
450 additions
and
90 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
52 changes: 52 additions & 0 deletions
52
x-pack/plugins/aiops/public/cases/log_rate_analysis_attachment.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,52 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import { memoize } from 'lodash'; | ||
import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; | ||
import type { PersistableStateAttachmentViewProps } from '@kbn/cases-plugin/public/client/attachment_framework/types'; | ||
import { FIELD_FORMAT_IDS } from '@kbn/field-formats-plugin/common'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { EuiDescriptionList } from '@elastic/eui'; | ||
import type { | ||
LogRateAnalysisEmbeddableWrapper, | ||
LogRateAnalysisEmbeddableWrapperProps, | ||
} from '../shared_components/log_rate_analysis_embeddable_wrapper'; | ||
|
||
export const initComponent = memoize( | ||
(fieldFormats: FieldFormatsStart, LogRateAnalysisComponent: LogRateAnalysisEmbeddableWrapper) => { | ||
return React.memo((props: PersistableStateAttachmentViewProps) => { | ||
const { persistableStateAttachmentState } = props; | ||
const dataFormatter = fieldFormats.deserialize({ | ||
id: FIELD_FORMAT_IDS.DATE, | ||
}); | ||
const inputProps = | ||
persistableStateAttachmentState as unknown as LogRateAnalysisEmbeddableWrapperProps; | ||
|
||
const listItems = [ | ||
{ | ||
title: ( | ||
<FormattedMessage | ||
id="xpack.aiops.logRateAnalysis.cases.timeRangeLabel" | ||
defaultMessage="Time range" | ||
/> | ||
), | ||
description: `${dataFormatter.convert( | ||
inputProps.timeRange.from | ||
)} - ${dataFormatter.convert(inputProps.timeRange.to)}`, | ||
}, | ||
]; | ||
|
||
return ( | ||
<> | ||
<EuiDescriptionList compressed type={'inline'} listItems={listItems} /> | ||
<LogRateAnalysisComponent {...inputProps} embeddingOrigin={'cases'} /> | ||
</> | ||
); | ||
}); | ||
} | ||
); |
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
Oops, something went wrong.