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

Move filter bar and apply filters to data plugin #36778

Merged
merged 4 commits into from
May 29, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Updated i18n keys
Liza Katz committed May 28, 2019
commit 7d211eedc522d9841a0b57c42885e726a3c26af1
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ export class ApplyFiltersPopover extends Component<Props, State> {
<EuiModalHeader>
<EuiModalHeaderTitle>
<FormattedMessage
id="common.ui.applyFilters.popupHeader"
id="data.filter.applyFilters.popupHeader"
defaultMessage="Select filters to apply"
/>
</EuiModalHeaderTitle>
@@ -93,13 +93,13 @@ export class ApplyFiltersPopover extends Component<Props, State> {
<EuiModalFooter>
<EuiButtonEmpty onClick={this.props.onCancel}>
<FormattedMessage
id="common.ui.applyFiltersPopup.cancelButtonLabel"
id="data.filter.applyFiltersPopup.cancelButtonLabel"
defaultMessage="Cancel"
/>
</EuiButtonEmpty>
<EuiButton onClick={this.onSubmit} fill>
<FormattedMessage
id="common.ui.applyFiltersPopup.saveButtonLabel"
id="data.filter.applyFiltersPopup.saveButtonLabel"
defaultMessage="Apply"
/>
</EuiButton>
Original file line number Diff line number Diff line change
@@ -118,7 +118,7 @@ class FilterBarUI extends Component<Props, State> {
<EuiButtonEmpty size="xs" onClick={this.onOpenAddFilterPopover} data-test-subj="addFilter">
+{' '}
<FormattedMessage
id="common.ui.filterBar.addFilterButtonLabel"
id="data.filter.filterBar.addFilterButtonLabel"
defaultMessage="Add filter"
/>
</EuiButtonEmpty>
Original file line number Diff line number Diff line change
@@ -95,20 +95,20 @@ class FilterEditorUI extends Component<Props, State> {
<EuiFlexGroup alignItems="baseline">
<EuiFlexItem>
<FormattedMessage
id="common.ui.filterEditor.editFilterPopupTitle"
id="data.filter.filterEditor.editFilterPopupTitle"
defaultMessage="Edit filter"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty size="xs" onClick={this.toggleCustomEditor}>
{this.state.isCustomEditorOpen ? (
<FormattedMessage
id="common.ui.filterEditor.editFilterValuesButtonLabel"
id="data.filter.filterEditor.editFilterValuesButtonLabel"
defaultMessage="Edit filter values"
/>
) : (
<FormattedMessage
id="common.ui.filterEditor.editQueryDslButtonLabel"
id="data.filter.filterEditor.editQueryDslButtonLabel"
defaultMessage="Edit as Query DSL"
/>
)}
@@ -128,7 +128,7 @@ class FilterEditorUI extends Component<Props, State> {
<EuiSwitch
id="filterEditorCustomLabelSwitch"
label={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.createCustomLabelSwitchLabel',
id: 'data.filter.filterEditor.createCustomLabelSwitchLabel',
defaultMessage: 'Create custom label?',
})}
checked={this.state.useCustomLabel}
@@ -140,7 +140,7 @@ class FilterEditorUI extends Component<Props, State> {
<EuiSpacer size="m" />
<EuiFormRow
label={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.createCustomLabelInputLabel',
id: 'data.filter.filterEditor.createCustomLabelInputLabel',
defaultMessage: 'Custom label',
})}
>
@@ -163,7 +163,7 @@ class FilterEditorUI extends Component<Props, State> {
data-test-subj="saveFilter"
>
<FormattedMessage
id="common.ui.filterEditor.saveButtonLabel"
id="data.filter.filterEditor.saveButtonLabel"
defaultMessage="Save"
/>
</EuiButton>
@@ -175,7 +175,7 @@ class FilterEditorUI extends Component<Props, State> {
data-test-subj="cancelSaveFilter"
>
<FormattedMessage
id="common.ui.filterEditor.cancelButtonLabel"
id="data.filter.filterEditor.cancelButtonLabel"
defaultMessage="Cancel"
/>
</EuiButtonEmpty>
@@ -198,13 +198,13 @@ class FilterEditorUI extends Component<Props, State> {
<EuiFlexItem>
<EuiFormRow
label={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.indexPatternSelectLabel',
id: 'data.filter.filterEditor.indexPatternSelectLabel',
defaultMessage: 'Index Pattern',
})}
>
<IndexPatternComboBox
placeholder={this.props.intl.formatMessage({
id: 'common.ui.filterBar.indexPatternSelectPlaceholder',
id: 'data.filter.filterBar.indexPatternSelectPlaceholder',
defaultMessage: 'Select an index pattern',
})}
options={this.props.indexPatterns}
@@ -240,15 +240,15 @@ class FilterEditorUI extends Component<Props, State> {
return (
<EuiFormRow
label={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.fieldSelectLabel',
id: 'data.filter.filterEditor.fieldSelectLabel',
defaultMessage: 'Field',
})}
>
<FieldComboBox
id="fieldInput"
isDisabled={!selectedIndexPattern}
placeholder={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.fieldSelectPlaceholder',
id: 'data.filter.filterEditor.fieldSelectPlaceholder',
defaultMessage: 'Select a field',
})}
options={fields}
@@ -269,14 +269,14 @@ class FilterEditorUI extends Component<Props, State> {
return (
<EuiFormRow
label={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.operatorSelectLabel',
id: 'data.filter.filterEditor.operatorSelectLabel',
defaultMessage: 'Operator',
})}
>
<OperatorComboBox
isDisabled={!selectedField}
placeholder={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.operatorSelectPlaceholder',
id: 'data.filter.filterEditor.operatorSelectPlaceholder',
defaultMessage: 'Select an operator',
})}
options={operators}
Original file line number Diff line number Diff line change
@@ -27,23 +27,23 @@ export interface Operator {
}

export const isOperator = {
message: i18n.translate('common.ui.filterEditor.isOperatorOptionLabel', {
message: i18n.translate('data.filter.filterEditor.isOperatorOptionLabel', {
defaultMessage: 'is',
}),
type: 'phrase',
negate: false,
};

export const isNotOperator = {
message: i18n.translate('common.ui.filterEditor.isNotOperatorOptionLabel', {
message: i18n.translate('data.filter.filterEditor.isNotOperatorOptionLabel', {
defaultMessage: 'is not',
}),
type: 'phrase',
negate: true,
};

export const isOneOfOperator = {
message: i18n.translate('common.ui.filterEditor.isOneOfOperatorOptionLabel', {
message: i18n.translate('data.filter.filterEditor.isOneOfOperatorOptionLabel', {
defaultMessage: 'is one of',
}),
type: 'phrases',
@@ -52,7 +52,7 @@ export const isOneOfOperator = {
};

export const isNotOneOfOperator = {
message: i18n.translate('common.ui.filterEditor.isNotOneOfOperatorOptionLabel', {
message: i18n.translate('data.filter.filterEditor.isNotOneOfOperatorOptionLabel', {
defaultMessage: 'is not one of',
}),
type: 'phrases',
@@ -61,7 +61,7 @@ export const isNotOneOfOperator = {
};

export const isBetweenOperator = {
message: i18n.translate('common.ui.filterEditor.isBetweenOperatorOptionLabel', {
message: i18n.translate('data.filter.filterEditor.isBetweenOperatorOptionLabel', {
defaultMessage: 'is between',
}),
type: 'range',
@@ -70,7 +70,7 @@ export const isBetweenOperator = {
};

export const isNotBetweenOperator = {
message: i18n.translate('common.ui.filterEditor.isNotBetweenOperatorOptionLabel', {
message: i18n.translate('data.filter.filterEditor.isNotBetweenOperatorOptionLabel', {
defaultMessage: 'is not between',
}),
type: 'range',
@@ -79,15 +79,15 @@ export const isNotBetweenOperator = {
};

export const existsOperator = {
message: i18n.translate('common.ui.filterEditor.existsOperatorOptionLabel', {
message: i18n.translate('data.filter.filterEditor.existsOperatorOptionLabel', {
defaultMessage: 'exists',
}),
type: 'exists',
negate: false,
};

export const doesNotExistOperator = {
message: i18n.translate('common.ui.filterEditor.doesNotExistOperatorOptionLabel', {
message: i18n.translate('data.filter.filterEditor.doesNotExistOperatorOptionLabel', {
defaultMessage: 'does not exist',
}),
type: 'exists',
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ class PhraseValueInputUI extends PhraseSuggestor<Props> {
return (
<EuiFormRow
label={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.valueInputLabel',
id: 'data.filter.filterEditor.valueInputLabel',
defaultMessage: 'Value',
})}
>
@@ -45,7 +45,7 @@ class PhraseValueInputUI extends PhraseSuggestor<Props> {
) : (
<ValueInputType
placeholder={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.valueInputPlaceholder',
id: 'data.filter.filterEditor.valueInputPlaceholder',
defaultMessage: 'Enter a value',
})}
value={this.props.value}
@@ -64,7 +64,7 @@ class PhraseValueInputUI extends PhraseSuggestor<Props> {
return (
<StringComboBox
placeholder={intl.formatMessage({
id: 'common.ui.filterEditor.valueSelectPlaceholder',
id: 'data.filter.filterEditor.valueSelectPlaceholder',
defaultMessage: 'Select a value',
})}
options={options}
Original file line number Diff line number Diff line change
@@ -38,13 +38,13 @@ class PhrasesValuesInputUI extends PhraseSuggestor<Props> {
return (
<EuiFormRow
label={intl.formatMessage({
id: 'common.ui.filterEditor.valuesSelectLabel',
id: 'data.filter.filterEditor.valuesSelectLabel',
defaultMessage: 'Values',
})}
>
<StringComboBox
placeholder={intl.formatMessage({
id: 'common.ui.filterEditor.valuesSelectPlaceholder',
id: 'data.filter.filterEditor.valuesSelectPlaceholder',
defaultMessage: 'Select values',
})}
options={options}
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ class RangeValueInputUI extends Component<Props> {
<EuiFlexItem>
<EuiFormRow
label={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.rangeStartInputLabel',
id: 'data.filter.filterEditor.rangeStartInputLabel',
defaultMessage: 'From',
})}
>
@@ -63,7 +63,7 @@ class RangeValueInputUI extends Component<Props> {
value={this.props.value ? this.props.value.from : undefined}
onChange={this.onFromChange}
placeholder={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.rangeStartInputPlaceholder',
id: 'data.filter.filterEditor.rangeStartInputPlaceholder',
defaultMessage: 'Start of the range',
})}
/>
@@ -72,7 +72,7 @@ class RangeValueInputUI extends Component<Props> {
<EuiFlexItem>
<EuiFormRow
label={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.rangeEndInputLabel',
id: 'data.filter.filterEditor.rangeEndInputLabel',
defaultMessage: 'To',
})}
>
@@ -81,7 +81,7 @@ class RangeValueInputUI extends Component<Props> {
value={this.props.value ? this.props.value.to : undefined}
onChange={this.onToChange}
placeholder={this.props.intl.formatMessage({
id: 'common.ui.filterEditor.rangeEndInputPlaceholder',
id: 'data.filter.filterEditor.rangeEndInputPlaceholder',
defaultMessage: 'End of the range',
})}
/>
@@ -91,7 +91,7 @@ class RangeValueInputUI extends Component<Props> {
{type === 'date' ? (
<EuiLink target="_blank" href={getDocLink('date.dateMath')}>
<FormattedMessage
id="common.ui.filterEditor.dateFormatHelpLinkLabel"
id="data.filter.filterEditor.dateFormatHelpLinkLabel"
defaultMessage="Accepted date formats"
/>{' '}
<EuiIcon type="link" />
Original file line number Diff line number Diff line change
@@ -82,14 +82,14 @@ class ValueInputTypeUI extends Component<Props> {
{
value: 'true',
text: this.props.intl.formatMessage({
id: 'common.ui.filterEditor.trueOptionLabel',
id: 'data.filter.filterEditor.trueOptionLabel',
defaultMessage: 'true',
}),
},
{
value: 'false',
text: this.props.intl.formatMessage({
id: 'common.ui.filterEditor.falseOptionLabel',
id: 'data.filter.filterEditor.falseOptionLabel',
defaultMessage: 'false',
}),
},
Original file line number Diff line number Diff line change
@@ -88,11 +88,11 @@ class FilterItemUI extends Component<Props, State> {
{
name: isFilterPinned(filter)
? this.props.intl.formatMessage({
id: 'common.ui.filterBar.unpinFilterButtonLabel',
id: 'data.filter.filterBar.unpinFilterButtonLabel',
defaultMessage: 'Unpin',
})
: this.props.intl.formatMessage({
id: 'common.ui.filterBar.pinFilterButtonLabel',
id: 'data.filter.filterBar.pinFilterButtonLabel',
defaultMessage: 'Pin across all apps',
}),
icon: 'pin',
@@ -104,7 +104,7 @@ class FilterItemUI extends Component<Props, State> {
},
{
name: this.props.intl.formatMessage({
id: 'common.ui.filterBar.editFilterButtonLabel',
id: 'data.filter.filterBar.editFilterButtonLabel',
defaultMessage: 'Edit filter',
}),
icon: 'pencil',
@@ -114,11 +114,11 @@ class FilterItemUI extends Component<Props, State> {
{
name: negate
? this.props.intl.formatMessage({
id: 'common.ui.filterBar.includeFilterButtonLabel',
id: 'data.filter.filterBar.includeFilterButtonLabel',
defaultMessage: 'Include results',
})
: this.props.intl.formatMessage({
id: 'common.ui.filterBar.excludeFilterButtonLabel',
id: 'data.filter.filterBar.excludeFilterButtonLabel',
defaultMessage: 'Exclude results',
}),
icon: negate ? 'plusInCircle' : 'minusInCircle',
@@ -131,11 +131,11 @@ class FilterItemUI extends Component<Props, State> {
{
name: disabled
? this.props.intl.formatMessage({
id: 'common.ui.filterBar.enableFilterButtonLabel',
id: 'data.filter.filterBar.enableFilterButtonLabel',
defaultMessage: 'Re-enable',
})
: this.props.intl.formatMessage({
id: 'common.ui.filterBar.disableFilterButtonLabel',
id: 'data.filter.filterBar.disableFilterButtonLabel',
defaultMessage: 'Temporarily disable',
}),
icon: `${disabled ? 'eye' : 'eyeClosed'}`,
@@ -147,7 +147,7 @@ class FilterItemUI extends Component<Props, State> {
},
{
name: this.props.intl.formatMessage({
id: 'common.ui.filterBar.deleteFilterButtonLabel',
id: 'data.filter.filterBar.deleteFilterButtonLabel',
defaultMessage: 'Delete',
}),
icon: 'trash',
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ class FilterOptionsUI extends Component<Props, State> {
items: [
{
name: this.props.intl.formatMessage({
id: 'common.ui.searchBar.enableAllFiltersButtonLabel',
id: 'data.filter.options.enableAllFiltersButtonLabel',
defaultMessage: 'Enable all',
}),
icon: 'eye',
@@ -70,7 +70,7 @@ class FilterOptionsUI extends Component<Props, State> {
},
{
name: this.props.intl.formatMessage({
id: 'common.ui.searchBar.disableAllFiltersButtonLabel',
id: 'data.filter.options.disableAllFiltersButtonLabel',
defaultMessage: 'Disable all',
}),
icon: 'eyeClosed',
@@ -82,7 +82,7 @@ class FilterOptionsUI extends Component<Props, State> {
},
{
name: this.props.intl.formatMessage({
id: 'common.ui.searchBar.pinAllFiltersButtonLabel',
id: 'data.filter.options.pinAllFiltersButtonLabel',
defaultMessage: 'Pin all',
}),
icon: 'pin',
@@ -94,7 +94,7 @@ class FilterOptionsUI extends Component<Props, State> {
},
{
name: this.props.intl.formatMessage({
id: 'common.ui.searchBar.unpinAllFiltersButtonLabel',
id: 'data.filter.options.unpinAllFiltersButtonLabel',
defaultMessage: 'Unpin all',
}),
icon: 'pin',
@@ -106,7 +106,7 @@ class FilterOptionsUI extends Component<Props, State> {
},
{
name: this.props.intl.formatMessage({
id: 'common.ui.searchBar.invertNegatedFiltersButtonLabel',
id: 'data.filter.options.invertNegatedFiltersButtonLabel',
defaultMessage: 'Invert inclusion',
}),
icon: 'invert',
@@ -118,7 +118,7 @@ class FilterOptionsUI extends Component<Props, State> {
},
{
name: this.props.intl.formatMessage({
id: 'common.ui.searchBar.invertDisabledFiltersButtonLabel',
id: 'data.filter.options.invertDisabledFiltersButtonLabel',
defaultMessage: 'Invert enabled/disabled',
}),
icon: 'eye',
@@ -130,7 +130,7 @@ class FilterOptionsUI extends Component<Props, State> {
},
{
name: this.props.intl.formatMessage({
id: 'common.ui.searchBar.deleteAllFiltersButtonLabel',
id: 'data.filter.options.deleteAllFiltersButtonLabel',
defaultMessage: 'Remove all',
}),
icon: 'trash',
@@ -155,11 +155,11 @@ class FilterOptionsUI extends Component<Props, State> {
color="text"
iconType="gear"
aria-label={this.props.intl.formatMessage({
id: 'common.ui.searchBar.changeAllFiltersButtonLabel',
id: 'data.filter.options.changeAllFiltersButtonLabel',
defaultMessage: 'Change all filters',
})}
title={this.props.intl.formatMessage({
id: 'common.ui.searchBar.changeAllFiltersButtonLabel',
id: 'data.filter.options.changeAllFiltersButtonLabel',
defaultMessage: 'Change all filters',
})}
data-test-subj="showFilterActions"
@@ -171,7 +171,7 @@ class FilterOptionsUI extends Component<Props, State> {
>
<EuiPopoverTitle>
<FormattedMessage
id="common.ui.searchBar.changeAllFiltersTitle"
id="data.filter.searchBar.changeAllFiltersTitle"
defaultMessage="Change all filters"
/>
</EuiPopoverTitle>
Original file line number Diff line number Diff line change
@@ -30,19 +30,19 @@ interface Props {

export const FilterView: SFC<Props> = ({ filter, ...rest }: Props) => {
let title = `Filter: ${getFilterDisplayText(filter)}. ${i18n.translate(
'common.ui.filterBar.moreFilterActionsMessage',
'data.filter.filterBar.moreFilterActionsMessage',
{
defaultMessage: 'Select for more filter actions.',
}
)}`;

if (isFilterPinned(filter)) {
title = `${i18n.translate('common.ui.filterBar.pinnedFilterPrefix', {
title = `${i18n.translate('data.filter.filterBar.pinnedFilterPrefix', {
defaultMessage: 'Pinned',
})} ${title}`;
}
if (filter.meta.disabled) {
title = `${i18n.translate('common.ui.filterBar.disabledFilterPrefix', {
title = `${i18n.translate('data.filter.filterBar.disabledFilterPrefix', {
defaultMessage: 'Disabled',
})} ${title}`;
}
@@ -58,10 +58,10 @@ export const FilterView: SFC<Props> = ({ filter, ...rest }: Props) => {
// Also, we may want to add a `DEL` keyboard press functionality
tabIndex: '-1',
}}
iconOnClickAriaLabel={i18n.translate('common.ui.filterBar.filterItemBadgeIconAriaLabel', {
iconOnClickAriaLabel={i18n.translate('data.filter.filterBar.filterItemBadgeIconAriaLabel', {
defaultMessage: 'Delete',
})}
onClickAriaLabel={i18n.translate('common.ui.filterBar.filterItemBadgeAriaLabel', {
onClickAriaLabel={i18n.translate('data.filter.filterBar.filterItemBadgeAriaLabel', {
defaultMessage: 'Filter actions',
})}
{...rest}
@@ -73,7 +73,7 @@ export const FilterView: SFC<Props> = ({ filter, ...rest }: Props) => {

export function getFilterDisplayText(filter: Filter) {
const prefix = filter.meta.negate
? ` ${i18n.translate('common.ui.filterBar.negatedFilterPrefix', {
? ` ${i18n.translate('data.filter.filterBar.negatedFilterPrefix', {
defaultMessage: 'NOT ',
})}`
: '';