Skip to content

Commit

Permalink
Disable/enable filter with click+shift on a filter badge (#52751)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra authored Dec 12, 2019
1 parent e488d9b commit a05fef2
Showing 1 changed file with 9 additions and 2 deletions.
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

0 comments on commit a05fef2

Please sign in to comment.