-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into kbn-104081-split-multiple-indices-logic
- Loading branch information
Showing
174 changed files
with
6,242 additions
and
1,976 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
export type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {}; | ||
|
||
// Overrides should not expose Functions, React nodes and children props | ||
// So filter out any type which is not serializable | ||
export type MakeOverridesSerializable<T> = { | ||
[KeyType in keyof T]: NonNullable<T[KeyType]> extends Function | ||
? // cannot use boolean here as it would be challenging to distinguish | ||
// between a "native" boolean props and a disabled callback | ||
// so use a specific keyword | ||
'ignore' | ||
: // be careful here to not filter out string/number types | ||
NonNullable<T[KeyType]> extends React.ReactChildren | React.ReactElement | ||
? never | ||
: // make it recursive | ||
NonNullable<T[KeyType]> extends object | ||
? MakeOverridesSerializable<T[KeyType]> | ||
: NonNullable<T[KeyType]>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { getOverridesFor } from './utils'; | ||
|
||
describe('Overrides utilities', () => { | ||
describe('getOverridesFor', () => { | ||
it('should return an empty object for undefined values', () => { | ||
expect(getOverridesFor(undefined, 'settings')).toEqual({}); | ||
// @ts-expect-error | ||
expect(getOverridesFor({}, 'settings')).toEqual({}); | ||
// @ts-expect-error | ||
expect(getOverridesFor({ otherOverride: {} }, 'settings')).toEqual({}); | ||
}); | ||
|
||
it('should return only the component specific overrides', () => { | ||
expect( | ||
getOverridesFor({ otherOverride: { a: 15 }, settings: { b: 10 } }, 'settings') | ||
).toEqual({ b: 10 }); | ||
}); | ||
|
||
it('should swap any "ignore" value into undefined value', () => { | ||
expect( | ||
getOverridesFor({ otherOverride: { a: 15 }, settings: { b: 10, c: 'ignore' } }, 'settings') | ||
).toEqual({ b: 10, c: undefined }); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ns/expression_gauge/common/expression_functions/__snapshots__/gauge_function.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...xpression_heatmap/common/expression_functions/__snapshots__/heatmap_function.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.