-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Lens formula improvements #89457
Closed
Closed
Lens formula improvements #89457
Changes from 91 commits
Commits
Show all changes
123 commits
Select commit
Hold shift + click to select a range
5941b55
Lens formula
flash1293 c175dd9
Merge remote-tracking branch 'upstream/master' into lens/formula-erro…
dej611 71b0812
:alembic: Adding basic error handling + transferable
dej611 c89bbf7
:sparkles: Implement new features
dej611 7e0b149
Merge remote-tracking branch 'upstream/master' into lens/formula-erro…
dej611 cd83321
:bug: Fix isTransferable from Formula
dej611 7df6c2d
:sparkles: Add all fullReferences ops + initial params
dej611 0473cb8
Expand Tinymath grammar, including named arguments
wylieconlon 7897563
Merge remote-tracking branch 'upstream/master' into lens/formula-erro…
dej611 aaf5664
:sparkles: Add enhanced validation for fields, operations and parameters
dej611 66b7dde
Add tsconfig project
wylieconlon 0e8a7be
Fix tests
wylieconlon af6da20
:sparkles: Add id and name (optional) decoupling
dej611 7e5b825
:sparkles: Give Formula column custom label
dej611 d6df1e2
Merge branch 'pr/89795' into lens/formula-named-params
dej611 c558744
Merge branch 'master' into tinymath-named-arguments
kibanamachine bde55d3
Allow named arguments with numeric types
wylieconlon bf8f8c4
:label: Migrate AST to new format + types fix + extended validation
dej611 d02ee52
:bug: Improved validation
dej611 03b1bd4
:white_check_mark: Add first batch of validation tests
dej611 3f8d248
Merge branch 'pr/89795' into lens/formula-error-handling
dej611 b5ee6ab
:white_check_mark: Add more validation tests for formula
dej611 9c45213
Merge remote-tracking branch 'upstream/master' into lens/formula-erro…
dej611 d71c30c
:bug: Fix parsing issues + tests
dej611 973a569
Merge remote-tracking branch 'origin/master' into tinymath-named-argu…
wylieconlon c87277d
Merge branch 'tinymath-named-arguments' into HEAD
wylieconlon abcb1a4
Reorganize code to support autocomplete
wylieconlon 6c4855e
:sparkles: Refactor validation
dej611 1f9ebb9
Refactoring by dej611
wylieconlon 8ecde1d
Use real fields
wylieconlon 17f49fa
:bug: Fix most of test issues + hide Math op
dej611 c919670
Show errors in formula editor
wylieconlon 155a986
:label: fix types
dej611 8720257
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon a53d074
Fix types and parsing
wylieconlon 844692a
Merge branch lens/formula-error-handling-2 into lens/formula-error-ha…
dej611 d4c5998
:lipstick: Hack to fix suggestion box
dej611 bb37b7f
Merge branch 'master' into lens/formula-error-handling
kibanamachine 2420565
Merge branch 'master' into lens/formula-error-handling
kibanamachine 036415a
Merge branch 'master' into lens/formula-error-handling
kibanamachine 4d5dca2
:bug: Fix validation messages
dej611 7c38af3
:bug: Relax operations check for managedReferences
dej611 e90a5df
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon a695329
Change completion params
wylieconlon ea574f7
:label: Fix missing arg issue
dej611 28c0427
Merge remote-tracking branch 'upstream/master' into lens/formula-erro…
dej611 417edff
:sparkles: Add more tinymath fns
dej611 fcbdc74
:bug: Improved validation around math operations + multiple named arg…
dej611 55d3bc6
:bug: Use new onError feature in math expression
dej611 642fa53
:recycle: Refactor namedArguments validation
dej611 08b9b6f
:bug: Fix circular dependency issue in tests + minor fixes
dej611 530226c
Merge remote-tracking branch 'upstream/master' into lens/formula-erro…
dej611 586f6ef
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 7832aeb
Move formula into a tab
wylieconlon f05c647
:fire: Leftovers from previous merge
dej611 d050e6f
:sparkles: Move over namedArgs from previous function
dej611 37c9c5f
:white_check_mark: Add tests for transferable scenarios
dej611 006f569
Merge branch 'lens/formula-error-handling' of github.com:dej611/kiban…
dej611 135987c
:white_check_mark: Fixed broken test
dej611 28847f1
:sparkles: Use custom label for axis
dej611 5524cf2
Allow switching back and forth to formula tab
wylieconlon 6650f67
Add a section for the function reference
wylieconlon 1e32e0a
Add modal editor and markdown docs
wylieconlon cacf486
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 2bc7f6c
Change the way math nodes are validated
wylieconlon 367de12
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon d42d02e
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon e0cd7d4
Use custom portal to fix monaco positioning
wylieconlon a1e8412
Fix model sharing issues
wylieconlon 039a5c2
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 86f36dd
Provide signature help
wylieconlon dba216c
:bug: Fix small test issue
dej611 4d5ce24
:bug: Mark pow arguments as required
dej611 f47c5db
:bug: validate on first render only if a formula is present
dej611 e102ad2
:fire: Remove log10 fn for now
dej611 1483d9d
:sparkles: Improved math validation + add tests for math functions
dej611 1e510cc
Merge remote-tracking branch upstream/master into lens/formula-error-…
dej611 9069161
Merge branch 'master' into lens/formula-error-handling
kibanamachine c4e6be8
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 89bf4d2
Fix mount/unmount issues with Monaco
wylieconlon 2334c1b
[Lens] Fully unmount React when flyout closes
wylieconlon 3f2b10f
Merge remote-tracking branch 'origin/master' into lens/unmount-bug
wylieconlon 502f74d
Fix bug with editor frame unmounting
wylieconlon 5df313c
Fix type
wylieconlon dc20489
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 5c4b75f
Merge branch 'lens/unmount-bug' into lens/formulas
wylieconlon 7dfed34
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 2382797
Add tests for monaco providers, add hover provider
wylieconlon f746acf
Add test for last_value
wylieconlon 81eace1
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 387059e
Usability improvements
wylieconlon 1065a76
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 46bd80f
Add KQL and Lucene named parameters
wylieconlon 14ec327
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon bbf55a2
Add kql, lucene completion and validation
wylieconlon 9351572
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon c7e4154
Fix autocomplete on weird characters and properly connect KQL
wylieconlon 15ccac2
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 08a985c
Highlight functions that have additional requirements after validating
wylieconlon daa5685
Fix type error and move help text to popover
wylieconlon ccf7266
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 0c1cfa9
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 239c72d
Fix escape characters inside KQL
wylieconlon fa57951
:bug: Fix dataType issue when moving over to Formula
dej611 3da8f82
Merge branch 'lens/formula-error-handling' of github.com:dej611/kiban…
dej611 1fd06bf
Automatically insert single quotes on every named param
wylieconlon b62f96e
Only insert single quotes when typing kql= or lucene=
wylieconlon d563cb5
Reorganize help popover
wylieconlon 32fdfbf
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon c81b47c
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon edb522d
Fix merge issues
wylieconlon 87b435b
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 7169655
Update grammar for formulas
wylieconlon e01bca8
Fix bad merge
wylieconlon ec493d1
Rough fullscreen mode
wylieconlon 255a40f
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 90cff4a
Type updates
wylieconlon 12391f6
Pass through fullscreen state
wylieconlon 83ae9bf
Remove more chrome from full screen mode
wylieconlon f520d2f
Fix minor bugs in formula typing
wylieconlon 23f65d8
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon 5a26025
🐛 Decouple column order of references and output
wylieconlon e6ff6d7
🔧 Fix tests and types
wylieconlon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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 |
---|---|---|
|
@@ -37,6 +37,8 @@ const ofName = buildLabelFunction((name?: string) => { | |
}); | ||
}); | ||
|
||
const WINDOW_DEFAULT_VALUE = 5; | ||
|
||
export type MovingAverageIndexPatternColumn = FormattedIndexPatternColumn & | ||
ReferenceBasedIndexPatternColumn & { | ||
operationType: 'moving_average'; | ||
|
@@ -58,10 +60,11 @@ export const movingAverageOperation: OperationDefinition< | |
selectionStyle: 'full', | ||
requiredReferences: [ | ||
{ | ||
input: ['field'], | ||
input: ['field', 'managedReference'], | ||
validateMetadata: (meta) => meta.dataType === 'number' && !meta.isBucketed, | ||
}, | ||
], | ||
operationParams: [{ name: 'window', type: 'number', required: true }], | ||
getPossibleOperation: (indexPattern) => { | ||
if (hasDateField(indexPattern)) { | ||
return { | ||
|
@@ -79,8 +82,12 @@ export const movingAverageOperation: OperationDefinition< | |
window: [(layer.columns[columnId] as MovingAverageIndexPatternColumn).params.window], | ||
}); | ||
}, | ||
buildColumn: ({ referenceIds, previousColumn, layer }) => { | ||
buildColumn: ( | ||
{ referenceIds, previousColumn, layer }, | ||
columnParams = { window: WINDOW_DEFAULT_VALUE } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a default value for window, do we want to keep the named argument in the formula mandatory? I guess it would be OK to omit it and fall back to this default |
||
) => { | ||
const metric = layer.columns[referenceIds[0]]; | ||
const { window = WINDOW_DEFAULT_VALUE } = columnParams; | ||
return { | ||
label: ofName(metric?.label, previousColumn?.timeScale), | ||
dataType: 'number', | ||
|
@@ -91,7 +98,7 @@ export const movingAverageOperation: OperationDefinition< | |
timeScale: previousColumn?.timeScale, | ||
filter: previousColumn?.filter, | ||
params: { | ||
window: 5, | ||
window, | ||
...getFormatFromPreviousColumn(previousColumn), | ||
}, | ||
}; | ||
|
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
4 changes: 4 additions & 0 deletions
4
...k/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula.scss
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,4 @@ | ||
.lnsFormulaOverflow { | ||
// Needs to be higher than the modal and all flyouts | ||
z-index: $euiZLevel9 + 1; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this as a quick-fix to get the feature working - I guess it's fine to keep it in the long run, but we have to make sure there are no issues if an existing Lens vis already uses classical uuid ids and the user transitions to formula