-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Single Metric Viewer embeddable: Adds action for dashboard to apply filter from the embeddable to the page #198869
Changes from 4 commits
f396d2a
2400d61
e806f0f
4cf0dd6
9b52eef
41c37ae
b50ea4f
21cb885
c6a3be9
163bc58
eaf3776
877fe30
8a4ccbf
2e6a09c
ec42d20
8a293e1
805877f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,9 @@ | |
|
||
import './_explorer_chart_label.scss'; | ||
import PropTypes from 'prop-types'; | ||
import React, { Fragment, useCallback } from 'react'; | ||
import React, { useCallback } from 'react'; | ||
|
||
import { EuiIconTip } from '@elastic/eui'; | ||
import { EuiFlexGroup, EuiFlexItem, EuiIconTip, EuiText, EuiTextColor } from '@elastic/eui'; | ||
|
||
import { ExplorerChartLabelBadge } from './explorer_chart_label_badge'; | ||
import { ExplorerChartInfoTooltip } from '../../explorer_chart_info_tooltip'; | ||
|
@@ -19,6 +19,7 @@ export function ExplorerChartLabel({ | |
detectorLabel, | ||
entityFields, | ||
infoTooltip, | ||
mode, | ||
wrapLabel = false, | ||
onSelectEntity, | ||
}) { | ||
|
@@ -48,16 +49,30 @@ export function ExplorerChartLabel({ | |
const entityFieldBadges = entityFields.map((entity) => { | ||
const key = `${infoTooltip.chartFunction}-${entity.fieldName}-${entity.fieldType}-${entity.fieldValue}`; | ||
return ( | ||
<Fragment key={`badge-wrapper-${key}`}> | ||
<ExplorerChartLabelBadge entity={entity} /> | ||
<EuiFlexGroup gutterSize="none" alignItems="center" key={`badge-wrapper-${key}`}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I went ahead and reverted most of the changes to this layout since it relies on some css and made the least amount of changes possible. 21cb885 |
||
<EuiFlexItem grow={false}> | ||
{mode === 'embeddable' ? ( | ||
<EuiText size="xs"> | ||
<EuiTextColor color={'success'} component={'span'}> | ||
{`(${entity.fieldName}: ${entity.fieldValue})`} | ||
</EuiTextColor> | ||
</EuiText> | ||
) : ( | ||
<ExplorerChartLabelBadge entity={entity} /> | ||
)} | ||
</EuiFlexItem> | ||
|
||
{onSelectEntity !== undefined && ( | ||
<EntityFilter | ||
onFilter={applyFilter} | ||
influencerFieldName={entity.fieldName} | ||
influencerFieldValue={entity.fieldValue} | ||
/> | ||
<EuiFlexItem grow={false}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably needs a separate issue - happens on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was able to improve it in 9b52eef for dashboards with truncating and adding in a tooltip for the full entity value: Note that the badges in the explorer view will still overlap. We should create a separate issue for that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Latest changes look good for shorter field name / values. Separate issue created to improve for long values: #199549 |
||
<EntityFilter | ||
mode={mode} | ||
onFilter={applyFilter} | ||
influencerFieldName={entity.fieldName} | ||
influencerFieldValue={entity.fieldValue} | ||
/> | ||
</EuiFlexItem> | ||
)} | ||
</Fragment> | ||
</EuiFlexGroup> | ||
); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ import type { AnomaliesTableData } from '../explorer_utils'; | |
|
||
interface ExplorerAnomaliesContainerProps { | ||
id: string; | ||
mode?: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this have union of explicit values? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, it looks like this is always supplied, so doesn't need to be optional There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, higher up in the component chain, it will either not be provided or be "embeddable" - but by this point it will always be provided. Updated in 41c37ae |
||
chartsData: ExplorerChartsData; | ||
showCharts: boolean; | ||
severity: TableSeverity; | ||
|
@@ -51,6 +52,7 @@ const tooManyBucketsCalloutMsg = i18n.translate( | |
|
||
export const ExplorerAnomaliesContainer: FC<ExplorerAnomaliesContainerProps> = ({ | ||
id, | ||
mode, | ||
chartsData, | ||
showCharts, | ||
severity, | ||
|
@@ -90,6 +92,7 @@ export const ExplorerAnomaliesContainer: FC<ExplorerAnomaliesContainerProps> = ( | |
<ExplorerChartsContainer | ||
{...{ | ||
...chartsData, | ||
mode, | ||
severity: severity.val, | ||
mlLocator, | ||
tableData, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need two different translations. There can't be two possible values for one translation ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - updated in 41c37ae