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] [Lens] Fix suffix field format leaks to index pattern management (#107139) #107383

Merged
merged 2 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions x-pack/plugins/lens/common/suffix_formatter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const unitSuffixesLong: Record<TimeScaleUnit, string> = {
export function getSuffixFormatter(formatFactory: FormatFactory): FieldFormatInstanceType {
return class SuffixFormatter extends FieldFormat {
static id = 'suffix';
static hidden = true; // Don't want this format to appear in index pattern editor
static title = i18n.translate('xpack.lens.fieldFormats.suffix.title', {
defaultMessage: 'Suffix',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,11 @@ describe('suffix formatter', () => {

expect(result).toEqual('');
});

it('should be a hidden formatter', () => {
const convertMock = jest.fn((x) => '');
const formatFactory = jest.fn(() => ({ convert: convertMock }));
const SuffixFormatter = getSuffixFormatter((formatFactory as unknown) as FormatFactory);
expect(SuffixFormatter.hidden).toBe(true);
});
});