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

[ML] Single Metric Viewer embeddable: Adds action for dashboard to apply filter from the embeddable to the page #198869

Merged
merged 17 commits into from
Nov 18, 2024

Conversation

alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Nov 4, 2024

Summary

Related meta issue: #187483

This PR adds the ability to add a filter and a negate filter to a dashboard via plus and minus icons in the SMV embeddable panel.
This PR also updates the behavior of the anomaly charts panel in dashboards so that the minus icon works as a negate filter instead of removing the filter. This behavior is consistent with other plus/minus icons next to values in dashboard panels.

In dashboard:

Screenshot 2024-11-11 at 09 54 41

With a by and partition field:
Screenshot 2024-11-11 at 09 59 09

In cases:

Screenshot 2024-11-11 at 10 00 41

Anomaly Charts in explorer:

image

Anomaly charts in dashboard:

image

Checklist

Delete any items that are not applicable to this PR.

@alvarezmelissa87 alvarezmelissa87 added :ml Feature:Anomaly Detection ML anomaly detection v9.0.0 Feature:Embeddables Relating to the Embeddable system v8.17.0 labels Nov 4, 2024
@alvarezmelissa87 alvarezmelissa87 self-assigned this Nov 4, 2024
@alvarezmelissa87 alvarezmelissa87 marked this pull request as ready for review November 5, 2024 19:01
@alvarezmelissa87 alvarezmelissa87 requested a review from a team as a code owner November 5, 2024 19:01
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@@ -59,7 +59,7 @@ export const EntityFilter: FC<EntityFilterProps> = ({
content={
<FormattedMessage
id="xpack.ml.entityFilter.removeFilterTooltip"
defaultMessage="Remove filter"
defaultMessage="Add negate filter for value"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't seem to have any docs about what a negate filter is, other than perhaps https://www.elastic.co/guide/en/kibana/current/kuery-query.html#_negating_a_query, so my inclination is to try to make it a bit clearer. For example:

Suggested change
defaultMessage="Add negate filter for value"
defaultMessage="Add negate filter to exclude the value"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discover and Lens use 'Filter out value' here. What do you think about that more concise text @lcawl ?

Screenshot 2024-11-06 at 11 40 46

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to use this simplified language in 2400d61
cc @lcawl

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I agree that's clearer.

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and overall looks good. Added some comments on the styling and text used for the filter controls.

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

{entityData.entities.map((entity, i) => {
return (
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize="none" alignItems="center">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any tweak we can make to the flex layout here to prevent the large gap between the entity field name / value text and the filter icons as the labels grow in length?

Screenshot 2024-11-07 at 13 09 30

For that job I used the filebeat_ecs QAF bootstrap template, and then this job config:

"analysis_config": {
    "bucket_span": "1h",
    "detectors": [
      {
        "detector_description": "mean(\"http.response.body.bytes\") by \"http.request.referrer\" partitionfield=\"host.id\"",
        "function": "mean",
        "field_name": "http.response.body.bytes",
        "by_field_name": "http.request.referrer",
        "partition_field_name": "host.id",
        "detector_index": 0
      }
    ],
    "influencers": [
      "host.id",
      "http.request.referrer"
    ],
    "model_prune_window": "30d"
  },

Copy link
Contributor Author

@alvarezmelissa87 alvarezmelissa87 Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is part of the flex components responsive behavior - the text tries to wrap at the hyphens until it can fit fully 🤔 I tried using EuiTextTruncate but the gap is still there so I think it's better to have the full value. I can dig deeper with someone in EUI to see if there's anything else we can do other than the props provided for the flex group.

smv-filter-resize.mp4

influencerFieldName={entity.fieldName}
influencerFieldValue={entity.fieldValue}
/>
<EuiFlexItem grow={false}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably isn't a new issue, but for long field names / values, the filter icons can end up being rendered out of the visible area:

Screenshot 2024-11-07 at 13 14 06

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably needs a separate issue - happens on main and also affects the charts when in the Anomaly Explorer.

Copy link
Contributor Author

@alvarezmelissa87 alvarezmelissa87 Nov 7, 2024

Choose a reason for hiding this comment

The 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:
image

Note that the badges in the explorer view will still overlap. We should create a separate issue for that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this needs some more tweaking. The anomaly charts look good for long values, but not for short text values there can be a large gap:

Screenshot 2024-11-08 at 10 16 14

Copy link
Contributor

Choose a reason for hiding this comment

The 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

content={
<FormattedMessage
id="xpack.ml.entityFilter.removeFilterTooltip"
defaultMessage={mode ? 'Filter out' : 'Remove filter'}
Copy link
Member

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

Copy link
Contributor Author

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

@@ -23,6 +23,7 @@ import type { AnomaliesTableData } from '../explorer_utils';

interface ExplorerAnomaliesContainerProps {
id: string;
mode?: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this have union of explicit values?

Copy link
Member

Choose a reason for hiding this comment

The 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

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

};

interface SingleMetricViewerTitleProps {
api: any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this any be replaced with the correct type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 41c37ae

<EuiButtonIcon
size="xs"
onClick={() => {
const trigger = uiActions.getTrigger(SINGLE_METRIC_VIEWER_ENTITY_FIELD_SELECTION_TRIGGER);
Copy link
Member

@jgowdyelastic jgowdyelastic Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this is calling getTrigger it might be more efficient if the whole function was declared above and wrapped in a useCallback

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to a function wrapped in useCallback in 41c37ae

@@ -17,14 +20,16 @@ const SingleMetricViewerLazy = dynamic(async () => import('./single_metric_viewe
export const getSingleMetricViewerComponent = (
coreStart: CoreStart,
pluginStart: MlDependencies,
mlServices: SingleMetricViewerServices
mlServices: SingleMetricViewerServices,
api?: SingleMetricViewerEmbeddableApi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api is optional here, but in TimeSeriesExplorerEmbeddableChart it is non-optional

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 41c37ae

@@ -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}`}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the changes here causing the badges in the Anomaly Explorer charts to be rendered with line breaks after the detector description label and before the info tooltip?

Before:
Screenshot 2024-11-11 at 10 29 34

After:
Screenshot 2024-11-11 at 10 16 45

Can the line breaks be removed? (Could also remove the - character before the badge - not sure that adds anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
We should update this to use components in a separate PR.

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

@alvarezmelissa87
Copy link
Contributor Author

/ci

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested latest changes and LGTM

@@ -23,6 +23,7 @@ import type { AnomaliesTableData } from '../explorer_utils';

interface ExplorerAnomaliesContainerProps {
id: string;
mode: 'embeddable';
Copy link
Member

@jgowdyelastic jgowdyelastic Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if mode is always passed in and always has the value embeddable, does it need to be passed in at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically a flag that we pass down to the filter icons to know what action they should be doing depending on whether they are used in the explorer in ML or in the embeddable/dashboard.
At this level it's always here because this is the component dashboard uses but then both it and the explorer and
use <ExplorerChartsContainer which is where we need to get the flag to. We only care whether it's there or not.

Now that you mention it, it probably would make more sense to have a flag like isEmbedded or isDashboard instead since it really is used more as a boolean flag.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the code, ExplorerAnomaliesContainer is only used once, where mode="embeddable" is passed in.
This was why I was questioning it, it appears that ExplorerAnomaliesContainer doesn't need it as a prop as the value never changes.

Copy link
Contributor Author

@alvarezmelissa87 alvarezmelissa87 Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're right. The naming tripped me up. So, removed it from ExplorerAnomaliesContainer and, since I use it more as a boolean flag for the tooltip content in entity filter, I updated the naming and made it a boolean in the lower components we do need it in. 8a4ccbf
Thanks, @jgowdyelastic 🙏

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alvarezmelissa87
Copy link
Contributor Author

/ci

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

@alvarezmelissa87
Copy link
Contributor Author

/ci

@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 14, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #44 / Discover discover async search relative timerange works
  • [job] [logs] FTR Configs #31 / serverless search UI Elasticsearch Start [Onboarding Empty State] developer should show the api key in code view
  • [job] [logs] FTR Configs #31 / serverless search UI Elasticsearch Start [Onboarding Empty State] developer should show the api key in code view

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [ed002ec]

History

cc @alvarezmelissa87

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

@alvarezmelissa87 alvarezmelissa87 merged commit f876540 into elastic:main Nov 18, 2024
22 checks passed
@alvarezmelissa87 alvarezmelissa87 deleted the ml-smv-updates branch November 18, 2024 19:08
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11899350977

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 18, 2024
…ly filter from the embeddable to the page (elastic#198869)

## Summary

Related meta issue: elastic#187483

This PR adds the ability to add a filter and a negate filter to a
dashboard via plus and minus icons in the SMV embeddable panel.
This PR also updates the behavior of the anomaly charts panel in
dashboards so that the minus icon works as a negate filter instead of
removing the filter. This behavior is consistent with other plus/minus
icons next to values in dashboard panels.

In dashboard:

<img width="1217" alt="Screenshot 2024-11-11 at 09 54 41"
src="https://github.com/user-attachments/assets/a8e12ce8-3794-4ddc-93da-e3d0bf139df7">

With a by and partition field:
<img width="1214" alt="Screenshot 2024-11-11 at 09 59 09"
src="https://github.com/user-attachments/assets/3b508a64-8bb1-4d89-89b2-9b8d195d1cbe">

In cases:

<img width="1555" alt="Screenshot 2024-11-11 at 10 00 41"
src="https://github.com/user-attachments/assets/1d1ac6d7-29c8-4e84-a758-3dfc293d58fe">

Anomaly Charts in explorer:

![image](https://github.com/user-attachments/assets/6e738171-5f1a-46c2-bd34-2c8581f2a3e3)

Anomaly charts in dashboard:

![image](https://github.com/user-attachments/assets/5011b44c-0a33-42a2-a869-413d4fffe4ad)

### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit f876540)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 18, 2024
…to apply filter from the embeddable to the page (#198869) (#200638)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML] Single Metric Viewer embeddable: Add action for dashboard to
apply filter from the embeddable to the page
(#198869)](#198869)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Melissa
Alvarez","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-18T19:08:20Z","message":"[ML]
Single Metric Viewer embeddable: Add action for dashboard to apply
filter from the embeddable to the page (#198869)\n\n##
Summary\r\n\r\nRelated meta issue:
https://github.com/elastic/kibana/issues/187483\r\n\r\nThis PR adds the
ability to add a filter and a negate filter to a\r\ndashboard via plus
and minus icons in the SMV embeddable panel.\r\nThis PR also updates the
behavior of the anomaly charts panel in\r\ndashboards so that the minus
icon works as a negate filter instead of\r\nremoving the filter. This
behavior is consistent with other plus/minus\r\nicons next to values in
dashboard panels.\r\n\r\nIn dashboard:\r\n\r\n<img width=\"1217\"
alt=\"Screenshot 2024-11-11 at 09 54
41\"\r\nsrc=\"https://github.com/user-attachments/assets/a8e12ce8-3794-4ddc-93da-e3d0bf139df7\">\r\n\r\n\r\nWith
a by and partition field:\r\n<img width=\"1214\" alt=\"Screenshot
2024-11-11 at 09 59
09\"\r\nsrc=\"https://github.com/user-attachments/assets/3b508a64-8bb1-4d89-89b2-9b8d195d1cbe\">\r\n\r\n\r\nIn
cases:\r\n\r\n<img width=\"1555\" alt=\"Screenshot 2024-11-11 at 10 00
41\"\r\nsrc=\"https://github.com/user-attachments/assets/1d1ac6d7-29c8-4e84-a758-3dfc293d58fe\">\r\n\r\n\r\nAnomaly
Charts in
explorer:\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/6e738171-5f1a-46c2-bd34-2c8581f2a3e3)\r\n\r\nAnomaly
charts in
dashboard:\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/5011b44c-0a33-42a2-a869-413d4fffe4ad)\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"f876540dc7fc935e9cc4b7d841247ce7bca5728d","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement",":ml","Feature:Anomaly
Detection","v9.0.0","Feature:Embeddables","backport:version","v8.17.0"],"title":"[ML]
Single Metric Viewer embeddable: Add action for dashboard to apply
filter from the embeddable to the
page","number":198869,"url":"https://github.com/elastic/kibana/pull/198869","mergeCommit":{"message":"[ML]
Single Metric Viewer embeddable: Add action for dashboard to apply
filter from the embeddable to the page (#198869)\n\n##
Summary\r\n\r\nRelated meta issue:
https://github.com/elastic/kibana/issues/187483\r\n\r\nThis PR adds the
ability to add a filter and a negate filter to a\r\ndashboard via plus
and minus icons in the SMV embeddable panel.\r\nThis PR also updates the
behavior of the anomaly charts panel in\r\ndashboards so that the minus
icon works as a negate filter instead of\r\nremoving the filter. This
behavior is consistent with other plus/minus\r\nicons next to values in
dashboard panels.\r\n\r\nIn dashboard:\r\n\r\n<img width=\"1217\"
alt=\"Screenshot 2024-11-11 at 09 54
41\"\r\nsrc=\"https://github.com/user-attachments/assets/a8e12ce8-3794-4ddc-93da-e3d0bf139df7\">\r\n\r\n\r\nWith
a by and partition field:\r\n<img width=\"1214\" alt=\"Screenshot
2024-11-11 at 09 59
09\"\r\nsrc=\"https://github.com/user-attachments/assets/3b508a64-8bb1-4d89-89b2-9b8d195d1cbe\">\r\n\r\n\r\nIn
cases:\r\n\r\n<img width=\"1555\" alt=\"Screenshot 2024-11-11 at 10 00
41\"\r\nsrc=\"https://github.com/user-attachments/assets/1d1ac6d7-29c8-4e84-a758-3dfc293d58fe\">\r\n\r\n\r\nAnomaly
Charts in
explorer:\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/6e738171-5f1a-46c2-bd34-2c8581f2a3e3)\r\n\r\nAnomaly
charts in
dashboard:\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/5011b44c-0a33-42a2-a869-413d4fffe4ad)\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"f876540dc7fc935e9cc4b7d841247ce7bca5728d"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198869","number":198869,"mergeCommit":{"message":"[ML]
Single Metric Viewer embeddable: Add action for dashboard to apply
filter from the embeddable to the page (#198869)\n\n##
Summary\r\n\r\nRelated meta issue:
https://github.com/elastic/kibana/issues/187483\r\n\r\nThis PR adds the
ability to add a filter and a negate filter to a\r\ndashboard via plus
and minus icons in the SMV embeddable panel.\r\nThis PR also updates the
behavior of the anomaly charts panel in\r\ndashboards so that the minus
icon works as a negate filter instead of\r\nremoving the filter. This
behavior is consistent with other plus/minus\r\nicons next to values in
dashboard panels.\r\n\r\nIn dashboard:\r\n\r\n<img width=\"1217\"
alt=\"Screenshot 2024-11-11 at 09 54
41\"\r\nsrc=\"https://github.com/user-attachments/assets/a8e12ce8-3794-4ddc-93da-e3d0bf139df7\">\r\n\r\n\r\nWith
a by and partition field:\r\n<img width=\"1214\" alt=\"Screenshot
2024-11-11 at 09 59
09\"\r\nsrc=\"https://github.com/user-attachments/assets/3b508a64-8bb1-4d89-89b2-9b8d195d1cbe\">\r\n\r\n\r\nIn
cases:\r\n\r\n<img width=\"1555\" alt=\"Screenshot 2024-11-11 at 10 00
41\"\r\nsrc=\"https://github.com/user-attachments/assets/1d1ac6d7-29c8-4e84-a758-3dfc293d58fe\">\r\n\r\n\r\nAnomaly
Charts in
explorer:\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/6e738171-5f1a-46c2-bd34-2c8581f2a3e3)\r\n\r\nAnomaly
charts in
dashboard:\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/5011b44c-0a33-42a2-a869-413d4fffe4ad)\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"f876540dc7fc935e9cc4b7d841247ce7bca5728d"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Melissa Alvarez <[email protected]>
@peteharverson peteharverson changed the title [ML] Single Metric Viewer embeddable: Add action for dashboard to apply filter from the embeddable to the page [ML] Single Metric Viewer embeddable: Adds action for dashboard to apply filter from the embeddable to the page Nov 21, 2024
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
…ly filter from the embeddable to the page (elastic#198869)

## Summary

Related meta issue: elastic#187483

This PR adds the ability to add a filter and a negate filter to a
dashboard via plus and minus icons in the SMV embeddable panel.
This PR also updates the behavior of the anomaly charts panel in
dashboards so that the minus icon works as a negate filter instead of
removing the filter. This behavior is consistent with other plus/minus
icons next to values in dashboard panels.

In dashboard:

<img width="1217" alt="Screenshot 2024-11-11 at 09 54 41"
src="https://github.com/user-attachments/assets/a8e12ce8-3794-4ddc-93da-e3d0bf139df7">


With a by and partition field:
<img width="1214" alt="Screenshot 2024-11-11 at 09 59 09"
src="https://github.com/user-attachments/assets/3b508a64-8bb1-4d89-89b2-9b8d195d1cbe">


In cases:

<img width="1555" alt="Screenshot 2024-11-11 at 10 00 41"
src="https://github.com/user-attachments/assets/1d1ac6d7-29c8-4e84-a758-3dfc293d58fe">


Anomaly Charts in explorer:


![image](https://github.com/user-attachments/assets/6e738171-5f1a-46c2-bd34-2c8581f2a3e3)

Anomaly charts in dashboard:


![image](https://github.com/user-attachments/assets/5011b44c-0a33-42a2-a869-413d4fffe4ad)



### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:Anomaly Detection ML anomaly detection Feature:Embeddables Relating to the Embeddable system :ml release_note:enhancement v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants