Skip to content

Commit

Permalink
addressing feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra committed Aug 26, 2020
1 parent be5ae8d commit 8d1227d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function BucketNestingEditor({
values: { field: fieldName },
}),
filters: i18n.translate('xpack.lens.indexPattern.groupingOverallFilters', {
defaultMessage: 'Filters overall',
defaultMessage: 'Search query overall',
}),
date_histogram: i18n.translate('xpack.lens.indexPattern.groupingOverallDateHistogram', {
defaultMessage: 'Dates overall',
Expand All @@ -80,7 +80,7 @@ export function BucketNestingEditor({
values: { target: target.fieldName },
}),
filters: i18n.translate('xpack.lens.indexPattern.groupingSecondFilters', {
defaultMessage: 'Filters for each {target}',
defaultMessage: 'Search query for each {target}',
values: { target: target.fieldName },
}),
date_histogram: i18n.translate('xpack.lens.indexPattern.groupingSecondDateHistogram', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

.lnsIndexPatternDimensionEditor__filtersEditor {
max-width: 100%;
width: $euiSize * 30;
width: $euiSize * 50;
}

// todo: remove after closing https://github.com/elastic/eui/issues/3548
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { FieldBasedIndexPatternColumn } from '../column_types';
import { FiltersList } from './filters_list';
import { DataType } from '../../../../types';

const searchQueryLabel = i18n.translate('xpack.lens.indexPattern.filters', {
const searchQueryLabel = i18n.translate('xpack.lens.indexPattern.searchQuery', {
defaultMessage: 'Search query',
});

Expand All @@ -23,6 +23,16 @@ export interface Filter {
label?: string;
}

const defaultSearchQuery: Filter = {
input: {
query: '*',
language: 'kuery',
},
label: i18n.translate('xpack.lens.indexPattern.searchQuery', {
defaultMessage: '* – all records',
}),
};

export interface FiltersIndexPatternColumn extends FieldBasedIndexPatternColumn {
operationType: 'filters';
params: {
Expand All @@ -32,9 +42,7 @@ export interface FiltersIndexPatternColumn extends FieldBasedIndexPatternColumn

export const filtersOperation: OperationDefinition<FiltersIndexPatternColumn> = {
type: 'filters',
displayName: i18n.translate('xpack.lens.indexPattern.filters', {
defaultMessage: 'Filters',
}),
displayName: searchQueryLabel,
priority: 3, // Higher than any metric
getPossibleOperationForField: ({ type }) => {
if (type === 'document') {
Expand Down Expand Up @@ -68,7 +76,7 @@ export const filtersOperation: OperationDefinition<FiltersIndexPatternColumn> =
type: 'filters',
schema: 'segment',
params: {
filters: column.params.filters.length > 0 ? column.params.filters : undefined,
filters: column.params.filters.length > 0 ? column.params.filters : [defaultSearchQuery],
},
}),
onFieldChange: (oldColumn, indexPattern, field) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ export const FilterPopover = ({
? (tempFilter.input.query as string)
: defaultPlaceholderMessage
}
prepend="Label*" // todo: is this tooltip?
prepend={i18n.translate('xpack.lens.indexPattern.filters.label', {
defaultMessage: 'Label',
})}
aria-label={i18n.translate('xpack.lens.indexPattern.filters.label.aria-message', {
defaultMessage: 'Label for your filter',
})}
Expand Down Expand Up @@ -213,7 +215,7 @@ export const FiltersList = ({
return (
<div>
<EuiDragDropContext onDragEnd={onDragEnd}>
<EuiDroppable droppableId="CUSTOM_HANDLE_DROPPABLE_AREA" spacing="s">
<EuiDroppable droppableId="FILTERS_DROPPABLE_AREA" spacing="s">
{filters?.map((filter: Filter, idx: number) => {
const { input, label } = filter;
const id = `${JSON.stringify(input.query)}_${label}`;
Expand All @@ -227,7 +229,7 @@ export const FiltersList = ({
>
{(provided) => (
<EuiPanel paddingSize="none">
<EuiFlexGroup gutterSize="xs" alignItems="center">
<EuiFlexGroup gutterSize="xs" alignItems="center" responsive={false}>
<EuiFlexItem grow={false}>
<div {...provided.dragHandleProps} className="lnsLayerPanel__dndGrab">
<EuiIcon
Expand Down Expand Up @@ -272,7 +274,7 @@ export const FiltersList = ({
aria-label={i18n.translate(
'xpack.lens.indexPattern.filters.deleteSearchQuery',
{
defaultMessage: 'Delete filter',
defaultMessage: 'Delete search query',
}
)}
/>
Expand Down

0 comments on commit 8d1227d

Please sign in to comment.