Skip to content

Commit

Permalink
✅ Add fieldformatMap field to test edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Oct 22, 2020
1 parent 04b391a commit 7a93683
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const indexPattern2 = ({
title: 'my-fake-restricted-pattern',
timeFieldName: 'timestamp',
hasRestrictions: true,
fieldFormatMap: {},
fields: [
{
name: 'timestamp',
Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugins/lens/public/indexpattern_datasource/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export async function loadIndexPatterns({
fieldFormatMap:
fieldFormatMap &&
Object.fromEntries(
Object.entries(fieldFormatMap).map(([id, format]) => [id, format.toJSON()])
Object.entries(fieldFormatMap)
.filter(([id, format]) => format)
.map(([id, format]) => [id, format.toJSON()])
),
fields: newFields,
hasRestrictions: !!typeMeta?.aggs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const createMockedRestrictedIndexPattern = () => ({
title: 'my-fake-restricted-pattern',
timeFieldName: 'timestamp',
hasRestrictions: true,
fieldFormatMap: { bytes: null },
fields: [
{
name: 'timestamp',
Expand Down

0 comments on commit 7a93683

Please sign in to comment.