-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Observability RAC] add filter for value action #108648
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
e6c7edd
filter for value
mgiota 5cc7824
code clean up
mgiota bb9757f
Merge branch 'master' of github.com:elastic/kibana into 108119_filter…
mgiota 2ddfb3f
fix i18n tests
mgiota 5193de7
fix type errors
mgiota c28adfe
revert changes to reason field to make reason field clickable again
mgiota 7ea274e
[RAC Observability] fix reason field
mgiota 6c22709
fix type issues
mgiota 0897318
Merge branch 'master' into 108119_filter_actions
kibanamachine 96694b9
filter my kibana.alert. status on load (will refactor)
mgiota b37f722
refactor filter for alert status on load
mgiota 64bd109
remove rest params
mgiota 2238357
fix eslint errors
mgiota 89f2bdc
Merge branch 'master' into 108119_filter_actions
kibanamachine 481c7d0
hard code alert status for now, will be fixed in another PR
mgiota c6c74dc
move filter_for button in a separate file
mgiota a1cf76d
fix errors
mgiota ac2bdd2
comply with kibana i18n guideines
mgiota 3320eae
simpler implementation for default filtering
mgiota bcead95
Merge branch 'master' into 108119_filter_actions
kibanamachine fbd4cd8
fix syntax error
mgiota 9108e1c
fix type errors
mgiota b411bab
fix eslint errors
mgiota 008e198
fix eslint errors
mgiota 09d16c7
Merge branch 'master' of github.com:elastic/kibana into 108119_filter…
mgiota 505dfa3
Merge branch 'master' of github.com:elastic/kibana into 108119_filter…
mgiota File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
64 changes: 64 additions & 0 deletions
64
x-pack/plugins/observability/public/pages/alerts/filter_for_value.tsx
This file contains hidden or 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,64 @@ | ||
| /* | ||
| * 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, { useCallback, useMemo } from 'react'; | ||
| import { i18n } from '@kbn/i18n'; | ||
|
|
||
| export const filterForValueButtonLabel = i18n.translate( | ||
| 'xpack.observability.hoverActions.filterForValueButtonLabel', | ||
| { | ||
| defaultMessage: 'Filter for value', | ||
| } | ||
| ); | ||
|
|
||
| import { EuiButtonIcon, EuiButtonEmpty } from '@elastic/eui'; | ||
|
|
||
| interface FilterForValueProps { | ||
| Component?: typeof EuiButtonEmpty | typeof EuiButtonIcon; | ||
| field: string; | ||
| value: string[] | string | null | undefined; | ||
| addToQuery: (value: string) => void; | ||
| } | ||
|
|
||
| const FilterForValueButton: React.FC<FilterForValueProps> = React.memo( | ||
| ({ Component, field, value, addToQuery }) => { | ||
| const text = useMemo(() => `${field}${value != null ? `: "${value}"` : ''}`, [field, value]); | ||
| const onClick = useCallback(() => { | ||
| addToQuery(text); | ||
| }, [text, addToQuery]); | ||
| const button = useMemo( | ||
| () => | ||
| Component ? ( | ||
| <Component | ||
| aria-label={filterForValueButtonLabel} | ||
| data-test-subj="filter-for-value" | ||
| iconType="plusInCircle" | ||
| onClick={onClick} | ||
| title={filterForValueButtonLabel} | ||
| > | ||
| {filterForValueButtonLabel} | ||
| </Component> | ||
| ) : ( | ||
| <EuiButtonIcon | ||
| aria-label={filterForValueButtonLabel} | ||
| className="timelines__hoverActionButton" | ||
| data-test-subj="filter-for-value" | ||
| iconSize="s" | ||
| iconType="plusInCircle" | ||
| onClick={onClick} | ||
| /> | ||
| ), | ||
| [Component, onClick] | ||
| ); | ||
| return button; | ||
| } | ||
| ); | ||
|
|
||
| FilterForValueButton.displayName = 'FilterForValueButton'; | ||
|
|
||
| // eslint-disable-next-line import/no-default-export | ||
| export { FilterForValueButton as default }; | ||
mgiota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.