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

[7.x] Disable/enable filter with click+shift on a filter badge (#52751) #53006

Merged
merged 2 commits into from
Dec 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/plugins/data/public/ui/filter_bar/filter_item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { EuiContextMenu, EuiPopover } from '@elastic/eui';
import { InjectedIntl, injectI18n } from '@kbn/i18n/react';
import classNames from 'classnames';
import React, { Component } from 'react';
import React, { Component, MouseEvent } from 'react';
import { IUiSettingsClient } from 'src/core/public';
import { FilterEditor } from './filter_editor';
import { FilterView } from './filter_view';
Expand All @@ -46,6 +46,13 @@ class FilterItemUI extends Component<Props, State> {
isPopoverOpen: false,
};

private handleBadgeClick = (e: MouseEvent<HTMLInputElement>) => {
if (e.shiftKey) {
this.onToggleDisabled();
} else {
this.togglePopover();
}
};
public render() {
const { filter, id } = this.props;
const { negate, disabled } = filter.meta;
Expand Down Expand Up @@ -73,7 +80,7 @@ class FilterItemUI extends Component<Props, State> {
valueLabel={valueLabel}
className={classes}
iconOnClick={() => this.props.onRemove()}
onClick={this.togglePopover}
onClick={this.handleBadgeClick}
data-test-subj={`filter ${dataTestSubjDisabled} ${dataTestSubjKey} ${dataTestSubjValue}`}
/>
);
Expand Down