Skip to content

Commit

Permalink
Filter action icons (#64073) (#64167)
Browse files Browse the repository at this point in the history
* feat: 🎸 add filter icons to filter actions

* test: πŸ’ add unit test for icon type for createFilterAction()

* test: πŸ’ fix TypeScript error
  • Loading branch information
streamich authored Apr 22, 2020
1 parent a35d220 commit 2a8f6d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/plugins/data/public/actions/select_range_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function selectRangeAction(
return createAction<typeof ACTION_SELECT_RANGE>({
type: ACTION_SELECT_RANGE,
id: ACTION_SELECT_RANGE,
getIconType: () => 'filter',
getDisplayName: () => {
return i18n.translate('data.filter.applyFilterActionTitle', {
defaultMessage: 'Apply filter to current view',
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/public/actions/value_click_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function valueClickAction(
return createAction<typeof ACTION_VALUE_CLICK>({
type: ACTION_VALUE_CLICK,
id: ACTION_VALUE_CLICK,
getIconType: () => 'filter',
getDisplayName: () => {
return i18n.translate('data.filter.applyFilterActionTitle', {
defaultMessage: 'Apply filter to current view',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ test('has expected display name', () => {
expect(action.getDisplayName({} as any)).toMatchInlineSnapshot(`"Apply filter to current view"`);
});

describe('getIconType()', () => {
test('returns "filter" icon', async () => {
const action = createFilterAction();
const result = action.getIconType({} as any);
expect(result).toBe('filter');
});
});

describe('isCompatible()', () => {
test('when embeddable filters and filters exist, returns true', async () => {
const action = createFilterAction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function createFilterAction(): ActionByType<typeof ACTION_APPLY_FILTER> {
return createAction<typeof ACTION_APPLY_FILTER>({
type: ACTION_APPLY_FILTER,
id: ACTION_APPLY_FILTER,
getIconType: () => 'filter',
getDisplayName: () => {
return i18n.translate('embeddableApi.actions.applyFilterActionTitle', {
defaultMessage: 'Apply filter to current view',
Expand Down

0 comments on commit 2a8f6d0

Please sign in to comment.