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

[Lens] Formula editor #99297

Merged
merged 288 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
288 commits
Select commit Hold shift + click to select a range
844692a
Merge branch lens/formula-error-handling-2 into lens/formula-error-ha…
dej611 Feb 10, 2021
d4c5998
:lipstick: Hack to fix suggestion box
dej611 Feb 10, 2021
bb37b7f
Merge branch 'master' into lens/formula-error-handling
kibanamachine Feb 15, 2021
2420565
Merge branch 'master' into lens/formula-error-handling
kibanamachine Feb 18, 2021
036415a
Merge branch 'master' into lens/formula-error-handling
kibanamachine Feb 19, 2021
4d5dca2
:bug: Fix validation messages
dej611 Feb 19, 2021
7c38af3
:bug: Relax operations check for managedReferences
dej611 Feb 19, 2021
e90a5df
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Feb 19, 2021
a695329
Change completion params
wylieconlon Feb 19, 2021
ea574f7
:label: Fix missing arg issue
dej611 Feb 22, 2021
28c0427
Merge remote-tracking branch 'upstream/master' into lens/formula-erro…
dej611 Mar 2, 2021
417edff
:sparkles: Add more tinymath fns
dej611 Mar 3, 2021
fcbdc74
:bug: Improved validation around math operations + multiple named arg…
dej611 Mar 3, 2021
55d3bc6
:bug: Use new onError feature in math expression
dej611 Mar 3, 2021
642fa53
:recycle: Refactor namedArguments validation
dej611 Mar 3, 2021
08b9b6f
:bug: Fix circular dependency issue in tests + minor fixes
dej611 Mar 3, 2021
530226c
Merge remote-tracking branch 'upstream/master' into lens/formula-erro…
dej611 Mar 3, 2021
586f6ef
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 3, 2021
7832aeb
Move formula into a tab
wylieconlon Mar 4, 2021
f05c647
:fire: Leftovers from previous merge
dej611 Mar 4, 2021
d050e6f
:sparkles: Move over namedArgs from previous function
dej611 Mar 4, 2021
37c9c5f
:white_check_mark: Add tests for transferable scenarios
dej611 Mar 4, 2021
006f569
Merge branch 'lens/formula-error-handling' of github.com:dej611/kiban…
dej611 Mar 4, 2021
135987c
:white_check_mark: Fixed broken test
dej611 Mar 4, 2021
28847f1
:sparkles: Use custom label for axis
dej611 Mar 4, 2021
5524cf2
Allow switching back and forth to formula tab
wylieconlon Mar 4, 2021
6650f67
Add a section for the function reference
wylieconlon Mar 4, 2021
1e32e0a
Add modal editor and markdown docs
wylieconlon Mar 5, 2021
cacf486
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 5, 2021
2bc7f6c
Change the way math nodes are validated
wylieconlon Mar 5, 2021
367de12
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 8, 2021
d42d02e
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 9, 2021
e0cd7d4
Use custom portal to fix monaco positioning
wylieconlon Mar 10, 2021
a1e8412
Fix model sharing issues
wylieconlon Mar 10, 2021
039a5c2
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 10, 2021
86f36dd
Provide signature help
wylieconlon Mar 11, 2021
dba216c
:bug: Fix small test issue
dej611 Mar 11, 2021
4d5ce24
:bug: Mark pow arguments as required
dej611 Mar 11, 2021
f47c5db
:bug: validate on first render only if a formula is present
dej611 Mar 11, 2021
e102ad2
:fire: Remove log10 fn for now
dej611 Mar 11, 2021
1483d9d
:sparkles: Improved math validation + add tests for math functions
dej611 Mar 11, 2021
1e510cc
Merge remote-tracking branch upstream/master into lens/formula-error-…
dej611 Mar 17, 2021
9069161
Merge branch 'master' into lens/formula-error-handling
kibanamachine Mar 18, 2021
c4e6be8
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 23, 2021
89bf4d2
Fix mount/unmount issues with Monaco
wylieconlon Mar 24, 2021
2334c1b
[Lens] Fully unmount React when flyout closes
wylieconlon Mar 24, 2021
3f2b10f
Merge remote-tracking branch 'origin/master' into lens/unmount-bug
wylieconlon Mar 25, 2021
502f74d
Fix bug with editor frame unmounting
wylieconlon Mar 25, 2021
5df313c
Fix type
wylieconlon Mar 25, 2021
dc20489
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 25, 2021
5c4b75f
Merge branch 'lens/unmount-bug' into lens/formulas
wylieconlon Mar 25, 2021
7dfed34
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 26, 2021
2382797
Add tests for monaco providers, add hover provider
wylieconlon Mar 26, 2021
f746acf
Add test for last_value
wylieconlon Mar 26, 2021
81eace1
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 29, 2021
387059e
Usability improvements
wylieconlon Mar 29, 2021
1065a76
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 30, 2021
46bd80f
Add KQL and Lucene named parameters
wylieconlon Mar 30, 2021
14ec327
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Mar 31, 2021
bbf55a2
Add kql, lucene completion and validation
wylieconlon Mar 31, 2021
9351572
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Apr 1, 2021
c7e4154
Fix autocomplete on weird characters and properly connect KQL
wylieconlon Apr 1, 2021
15ccac2
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Apr 2, 2021
08a985c
Highlight functions that have additional requirements after validating
wylieconlon Apr 2, 2021
daa5685
Fix type error and move help text to popover
wylieconlon Apr 2, 2021
ccf7266
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Apr 5, 2021
0c1cfa9
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Apr 5, 2021
239c72d
Fix escape characters inside KQL
wylieconlon Apr 5, 2021
fa57951
:bug: Fix dataType issue when moving over to Formula
dej611 Apr 6, 2021
3da8f82
Merge branch 'lens/formula-error-handling' of github.com:dej611/kiban…
dej611 Apr 6, 2021
1fd06bf
Automatically insert single quotes on every named param
wylieconlon Apr 6, 2021
b62f96e
Only insert single quotes when typing kql= or lucene=
wylieconlon Apr 8, 2021
d563cb5
Reorganize help popover
wylieconlon Apr 8, 2021
32fdfbf
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Apr 21, 2021
c81b47c
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Apr 21, 2021
edb522d
Fix merge issues
wylieconlon Apr 21, 2021
87b435b
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Apr 27, 2021
7169655
Update grammar for formulas
wylieconlon Apr 27, 2021
e01bca8
Fix bad merge
wylieconlon Apr 27, 2021
ec493d1
Rough fullscreen mode
wylieconlon Apr 28, 2021
255a40f
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon Apr 28, 2021
90cff4a
Type updates
wylieconlon Apr 28, 2021
12391f6
Pass through fullscreen state
wylieconlon Apr 28, 2021
83ae9bf
Remove more chrome from full screen mode
wylieconlon Apr 29, 2021
f520d2f
Fix minor bugs in formula typing
wylieconlon Apr 30, 2021
23f65d8
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon May 4, 2021
5a26025
🐛 Decouple column order of references and output
wylieconlon May 4, 2021
e6ff6d7
🔧 Fix tests and types
wylieconlon May 4, 2021
198ca29
✅ Add first functional test
wylieconlon May 5, 2021
ddd5515
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon May 5, 2021
d335aa3
Fix copying formulas and empty formula
wylieconlon May 6, 2021
bf264ed
Trigger suggestion prompt when hitting enter on function or typing kql=
wylieconlon May 6, 2021
a317738
🐛 Prevent flyout from closing while interacting with monaco
wylieconlon May 7, 2021
b2272f9
Merge branch 'master' into lens/formula-error-handling
kibanamachine May 10, 2021
bd87d98
refactoring
flash1293 May 10, 2021
571501a
move main column generation into parse module
flash1293 May 10, 2021
70a6b86
fix tests
flash1293 May 10, 2021
1883964
refactor small formula styles and markup
MichaelMarcialis May 10, 2021
96988e8
Merge branch 'lens/formula-error-handling' of github.com:wylieconlon/…
MichaelMarcialis May 10, 2021
40c43e4
documentation
flash1293 May 10, 2021
203b622
adjustments in formula footer
MichaelMarcialis May 10, 2021
b4a36ad
Formula refactoring (#12)
flash1293 May 10, 2021
2088c8e
Merge remote-tracking branch 'origin/master' into lens/formulas
wylieconlon May 10, 2021
9655e7d
more style and markup tweak for custom formula
MichaelMarcialis May 10, 2021
09659a2
Fix tests
wylieconlon May 10, 2021
03563b4
[Expressions] Use table column ID instead of name when set
wylieconlon May 10, 2021
f3ba457
[Lens] Create managedReference type for formulas
flash1293 Jan 21, 2021
2fce117
Merge branch 'lens/formula-error-handling' of github.com:wylieconlon/…
MichaelMarcialis May 11, 2021
c210c4b
Fix test failures
wylieconlon May 11, 2021
e8ef7e8
Fix i18n types
wylieconlon May 11, 2021
16387e8
fix fullscreen flex issues
MichaelMarcialis May 11, 2021
9114256
Delete managedReference when replacing
wylieconlon May 11, 2021
4ea324d
refactor css and markup; add button placeholders
MichaelMarcialis May 11, 2021
394555c
[Lens] Formulas
wylieconlon May 11, 2021
a33545e
Tests for formula
wylieconlon May 11, 2021
b06888e
Merge branch 'lens/managed-reference' into lens/formula-editor
wylieconlon May 11, 2021
1a74b65
added error count placeholder
MichaelMarcialis May 12, 2021
c0577f0
Add tooltips
MichaelMarcialis May 12, 2021
557b3a8
Merge branch 'lens/formula-error-handling' into formula-documentation
flash1293 May 12, 2021
51a8f62
Merge remote-tracking branch 'wylieconlon/lens/formula-error-handling…
flash1293 May 12, 2021
614b357
Merge remote-tracking branch 'MichaelMarcialis/lens/formula-error-han…
flash1293 May 12, 2021
c2f23a4
Merge remote-tracking branch 'origin/master' into lens/managed-reference
wylieconlon May 12, 2021
0b347ff
Refactoring from code review
wylieconlon May 12, 2021
9b6515c
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon May 12, 2021
2471c1f
Merge branch 'lens/managed-reference' into lens/formula-editor
wylieconlon May 12, 2021
bac5fd6
Merge remote-tracking branch 'MichaelMarcialis/lens/formula-error-han…
wylieconlon May 12, 2021
64ee982
Fix some editor issues
wylieconlon May 12, 2021
41789fb
Merge remote-tracking branch 'origin/master' into map-column-id
wylieconlon May 13, 2021
628cf8d
Update ID matching to match by name sometimes
wylieconlon May 13, 2021
cf51972
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon May 13, 2021
5421775
Improve performance of Monaco, fix formulas with 0, update labels
wylieconlon May 13, 2021
4d25851
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon May 14, 2021
8f6a6a0
Improve performance of full screen toggle
wylieconlon May 14, 2021
dd27759
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon May 14, 2021
a6a6fae
Fix formula tests
wylieconlon May 14, 2021
5413d7a
Merge branch 'master' into map-column-id
kibanamachine May 17, 2021
a85d91c
Merge remote-tracking branch 'wylieconlon/lens/formula-error-handling…
flash1293 May 17, 2021
5c97610
Merge remote-tracking branch 'upstream/master' into formula-documenta…
flash1293 May 17, 2021
507dd53
fix stuff
flash1293 May 17, 2021
468cfcf
Add an extra case to prevent insertion of duplicate column
wylieconlon May 18, 2021
d222796
Merge remote-tracking branch 'origin/master' into map-column-id
wylieconlon May 18, 2021
9f4d647
Simplify logic and add test for output ID
wylieconlon May 18, 2021
c0d28a9
add telemetry for Lens formula (#15)
flash1293 May 18, 2021
7f1df87
Respond to review comments
wylieconlon May 19, 2021
65e61a1
:sparkles: Improve the signatures with better documentation and examples
dej611 May 19, 2021
e4a5bcc
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon May 19, 2021
9abe037
Merge remote-tracking branch 'joe/formula-documentation' into lens/fo…
wylieconlon May 19, 2021
371703c
adjust border styles to account for docs collapse
MichaelMarcialis May 19, 2021
eb658fe
refactor docs markup; restructure docs obj; styles
MichaelMarcialis May 19, 2021
01af0b6
Merge branch 'lens/formula-error-handling' of github.com:wylieconlon/…
MichaelMarcialis May 19, 2021
f8cab62
Formula signature + doc improvements (https://github.com/wylieconlon/…
wylieconlon May 19, 2021
342c23d
Merge remote-tracking branch 'MichaelMarcialis/formula-documentation-…
wylieconlon May 19, 2021
4d7d2ba
Fix formula auto reordering (#18)
flash1293 May 20, 2021
c97f6f6
Fix and improve suggestion experience in Formula (#19)
dej611 May 24, 2021
4aac893
:sparkles: Add query validation for quotes
dej611 May 24, 2021
97a2457
Usability updates & type fixes
wylieconlon May 24, 2021
969ffd9
Merge branch 'master' into map-column-id
kibanamachine May 25, 2021
934d3bb
Merge branch 'master' into lens/formula-error-handling
kibanamachine May 25, 2021
b84faf9
add search to formula
flash1293 May 25, 2021
1ade3f3
fix form styles to match designs
MichaelMarcialis May 25, 2021
a8f4ec8
fix text styles; revert to Markdown for control
MichaelMarcialis May 25, 2021
f419cb6
:ok_hand: Integrated more feedback
dej611 May 26, 2021
4b4bf18
Merge pull request #13 from MichaelMarcialis/lens/formula-doc-3-mm
flash1293 May 26, 2021
72d25ce
improve search
flash1293 May 26, 2021
12ddbf7
improve suggestions
flash1293 May 26, 2021
d086cca
improve suggestions even more
flash1293 May 26, 2021
d07dae3
:bug: Fix i18n issues (#22)
dej611 May 26, 2021
faca9e2
Persist formula on leave, fix fullscreen and popovers
wylieconlon May 26, 2021
232e02d
Fix documentation tests
wylieconlon May 26, 2021
f7bcefd
Merge remote-tracking branch 'joe/lens/formula-doc-3' into lens/formu…
wylieconlon May 26, 2021
c0b7da0
Merge remote-tracking branch 'dej611/lens/formula-kql-validation' int…
wylieconlon May 26, 2021
c41b932
Merge remote-tracking branch 'joe/lens/formula-suggestions' into lens…
wylieconlon May 26, 2021
759e168
:label: fix type issue
dej611 May 27, 2021
0542a10
:bug: Remove hidden operations from valid functions list
dej611 May 27, 2021
195a5a6
:bug: Fix empty string query edge case
dej611 May 27, 2021
c51e8e0
:bug: Enable more suggestions + extends validation
dej611 May 28, 2021
cc41fc5
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon May 28, 2021
bbf5aac
Fix tests that depended on setState being called without function
wylieconlon May 28, 2021
7de19c9
Merge remote-tracking branch 'dej611/lens/formula-more-fixes' into le…
wylieconlon May 28, 2021
4ab340b
Error state and text wrapping updates
wylieconlon May 28, 2021
32713dd
:sparkles: Add new module to CodeEditor for brackets matching (#25)
dej611 May 28, 2021
fc2c3c9
Fix type
wylieconlon May 28, 2021
3637ee6
show warning
flash1293 May 31, 2021
ed47705
keep current quick function
flash1293 May 31, 2021
e56ef54
:sparkles: Improve suggestions within kql query
dej611 May 31, 2021
fcc775f
:camera: Fix snapshot editor test
dej611 May 31, 2021
ad50a7e
:bug: Improved suggestion for single quote and refactored debounce
dej611 May 31, 2021
7c897dc
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon Jun 1, 2021
290627c
:wqerge remote-tracking branch 'dej611/lens/formula-more-suggestions'…
wylieconlon Jun 1, 2021
8e1934d
Fix lodash usage
wylieconlon Jun 1, 2021
8d4778b
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon Jun 1, 2021
8d04687
Merge branch 'master' into map-column-id
kibanamachine Jun 1, 2021
068d8dc
Merge remote-tracking branch 'fork/map-column-id' into lens/formula-e…
wylieconlon Jun 1, 2021
dfb8cb5
Fix tests
wylieconlon Jun 1, 2021
e12c711
Merge remote-tracking branch 'joe/lens/keep-quick-function-around' in…
wylieconlon Jun 1, 2021
a610e37
Revert "keep current quick function"
wylieconlon Jun 1, 2021
dd2fb49
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon Jun 1, 2021
710061a
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon Jun 2, 2021
507a421
Improve performance of dispatch by using timeout
wylieconlon Jun 2, 2021
b92c8e6
Improve memoization of datapanel
wylieconlon Jun 2, 2021
e00bd4a
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon Jun 2, 2021
48e22ba
Fix escape characters
wylieconlon Jun 2, 2021
b349a1c
fix reduced suggestions
flash1293 Jun 3, 2021
6426034
fix responsiveness
flash1293 Jun 3, 2021
e4a9535
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon Jun 3, 2021
548f7f1
Merge remote-tracking branch 'joe/fix-doc-help-responsiveness' into l…
wylieconlon Jun 3, 2021
5d17588
fix unit test
flash1293 Jun 3, 2021
5222093
Merge remote-tracking branch 'joe/fix-suggestions' into lens/formula-…
wylieconlon Jun 3, 2021
12192a2
Merge remote-tracking branch 'joe/fix-unit-test' into lens/formula-ed…
wylieconlon Jun 3, 2021
3e9ebdb
Fix autocomplete on nested math
wylieconlon Jun 3, 2021
ae81c0e
Show errors and warnings on first render
wylieconlon Jun 3, 2021
2b44b2f
fix transposing column crash
flash1293 Jun 4, 2021
3096a2e
Merge remote-tracking branch 'origin/master' into lens/formula-editor
wylieconlon Jun 4, 2021
08a1f80
Merge remote-tracking branch 'joe/fix-async-state-update' into lens/f…
wylieconlon Jun 4, 2021
d1628b7
Update comment
wylieconlon Jun 4, 2021
48d7ff7
:bug: Fix field error message
dej611 Jun 4, 2021
1b97e8b
fix test types
flash1293 Jun 4, 2021
5cd99fe
:memo: Fix i18n name
dej611 Jun 4, 2021
881592a
:lipstick: Manage wordwrap via react component
dej611 Jun 4, 2021
1d16ef9
Fix selector for palettes that interferes with quick functions
wylieconlon Jun 4, 2021
5bf9c14
Merge remote-tracking branch 'dej611/lens/formula-field-message' into…
wylieconlon Jun 4, 2021
bbfd225
Merge remote-tracking branch 'dej611/lens/formula-word-wrap' into len…
wylieconlon Jun 4, 2021
fd2ea82
Use word wrapping by default
wylieconlon Jun 4, 2021
6f79509
Errors for managed references are handled at the top level
wylieconlon Jun 4, 2021
2e3cdd1
:bug: Move the cursor just next to new inserted text
dej611 Jun 7, 2021
1e422fa
:alembic: First pass for performance
dej611 Jun 7, 2021
bf66960
Merge branch 'master' into lens/formula-error-handling
kibanamachine Jun 7, 2021
0578cc5
:bug: Fix unwanted change
dej611 Jun 7, 2021
0b76853
:zap: Memoize as many combobox props as possible
dej611 Jun 7, 2021
affc0b3
:zap: More memoization
dej611 Jun 7, 2021
0762f2f
Show errors in hover
wylieconlon Jun 7, 2021
304fb64
Use temporary invalid state when moving away from formula
wylieconlon Jun 7, 2021
c3be427
Merge remote-tracking branch 'dej611/lens/formula-autocomplete-escape…
wylieconlon Jun 7, 2021
57e67f5
Remove setActiveDimension and shouldClose, fixed by async setters
wylieconlon Jun 7, 2021
875dd04
Merge remote-tracking branch 'dej611/lens/formula-performance-attempt…
wylieconlon Jun 7, 2021
199eece
Fix test dependency
wylieconlon Jun 7, 2021
b0e4dda
Merge branch 'master' into lens/formula-error-handling
kibanamachine Jun 8, 2021
aca7aba
do not show quick functions tab
flash1293 Jun 8, 2021
16b0d40
increase documentation popover width
flash1293 Jun 8, 2021
7e7b91e
Merge branch 'master' into lens/formula-error-handling
kibanamachine Jun 8, 2021
9a7b4bc
fix functional test
flash1293 Jun 8, 2021
7f5dbea
Call setActiveDimension when updating visualization
wylieconlon Jun 8, 2021
4b81e5d
Simplify handling of flyout with incomplete columns
wylieconlon Jun 8, 2021
f9a9c9a
Fix test issues
wylieconlon Jun 8, 2021
bca4cb5
Merge remote-tracking branch 'upstream/master' into lens/formula-erro…
flash1293 Jun 9, 2021
93da501
add description to formula telemetry
flash1293 Jun 9, 2021
fd8bbc9
fix schema
flash1293 Jun 9, 2021
e2e4e6d
Update from design feedback
wylieconlon Jun 9, 2021
28cf06e
More review comments
wylieconlon Jun 9, 2021
9ec3c9a
Hide callout border from v7 theme
wylieconlon Jun 9, 2021
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 packages/kbn-monaco/src/monaco_imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ import 'monaco-editor/esm/vs/editor/contrib/folding/folding.js'; // Needed for f
import 'monaco-editor/esm/vs/editor/contrib/suggest/suggestController.js'; // Needed for suggestions
import 'monaco-editor/esm/vs/editor/contrib/hover/hover.js'; // Needed for hover
import 'monaco-editor/esm/vs/editor/contrib/parameterHints/parameterHints.js'; // Needed for signature
import 'monaco-editor/esm/vs/editor/contrib/bracketMatching/bracketMatching.js'; // Needed for brackets matching highlight

export { monaco };
44 changes: 26 additions & 18 deletions packages/kbn-tinymath/grammar/grammar.peggy
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// tinymath parsing grammar

{
function simpleLocation (location) {
// Returns an object representing the position of the function within the expression,
// demarcated by the position of its first character and last character. We calculate these values
// using the offset because the expression could span multiple lines, and we don't want to deal
// with column and line values.
return {
min: location.start.offset,
max: location.end.offset
function simpleLocation (location) {
// Returns an object representing the position of the function within the expression,
// demarcated by the position of its first character and last character. We calculate these values
// using the offset because the expression could span multiple lines, and we don't want to deal
// with column and line values.
return {
min: location.start.offset,
max: location.end.offset
}
}
}
}

start
Expand Down Expand Up @@ -74,26 +74,34 @@ Expression
= AddSubtract

AddSubtract
= _ left:MultiplyDivide rest:(('+' / '-') MultiplyDivide)* _ {
return rest.reduce((acc, curr) => ({
= _ left:MultiplyDivide rest:(('+' / '-') MultiplyDivide)+ _ {
const topLevel = rest.reduce((acc, curr) => ({
type: 'function',
name: curr[0] === '+' ? 'add' : 'subtract',
args: [acc, curr[1]],
location: simpleLocation(location()),
text: text()
}), left)
}), left);
if (typeof topLevel === 'object') {
topLevel.location = simpleLocation(location());
topLevel.text = text();
}
return topLevel;
}
/ MultiplyDivide

MultiplyDivide
= _ left:Factor rest:(('*' / '/') Factor)* _ {
return rest.reduce((acc, curr) => ({
const topLevel = rest.reduce((acc, curr) => ({
type: 'function',
name: curr[0] === '*' ? 'multiply' : 'divide',
args: [acc, curr[1]],
location: simpleLocation(location()),
text: text()
}), left)
}), left);
if (typeof topLevel === 'object') {
topLevel.location = simpleLocation(location());
topLevel.text = text();
}
return topLevel;
}
/ Factor

Factor
= Group
Expand Down
6 changes: 4 additions & 2 deletions packages/kbn-tinymath/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ export interface TinymathLocation {
export interface TinymathFunction {
type: 'function';
name: string;
text: string;
args: TinymathAST[];
location: TinymathLocation;
// Location is not guaranteed because PEG grammars are not left-recursive
location?: TinymathLocation;
// Text is not guaranteed because PEG grammars are not left-recursive
text?: string;
}

export interface TinymathVariable {
Expand Down
31 changes: 31 additions & 0 deletions packages/kbn-tinymath/test/library.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,35 @@ describe('Parser', () => {
});
});

describe('Math', () => {
it('converts basic symbols into left-to-right pairs', () => {
expect(parse('a + b + c - d')).toEqual({
args: [
{
name: 'add',
type: 'function',
args: [
{
name: 'add',
type: 'function',
args: [
expect.objectContaining({ location: { min: 0, max: 2 } }),
expect.objectContaining({ location: { min: 3, max: 6 } }),
],
},
expect.objectContaining({ location: { min: 7, max: 10 } }),
],
},
expect.objectContaining({ location: { min: 11, max: 13 } }),
],
name: 'subtract',
type: 'function',
text: 'a + b + c - d',
location: { min: 0, max: 13 },
});
});
});

describe('Variables', () => {
it('strings', () => {
expect(parse('f')).toEqual(variableEqual('f'));
Expand Down Expand Up @@ -263,6 +292,8 @@ describe('Evaluate', () => {
expect(evaluate('5/20')).toEqual(0.25);
expect(evaluate('1 + 1 + 2 + 3 + 12')).toEqual(19);
expect(evaluate('100 / 10 / 10')).toEqual(1);
expect(evaluate('0 * 1 - 100 / 10 / 10')).toEqual(-1);
expect(evaluate('100 / (10 / 10)')).toEqual(100);
});

it('equations with functions', () => {
Expand Down
17 changes: 17 additions & 0 deletions src/plugins/dashboard/server/usage/dashboard_telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ const lensXYSeriesB = ({
visualization: {
preferredSeriesType: 'seriesB',
},
datasourceStates: {
indexpattern: {
layers: {
first: {
columns: {
first: {
operationType: 'terms',
},
second: {
operationType: 'formula',
},
},
},
},
},
},
},
},
},
Expand Down Expand Up @@ -144,6 +160,7 @@ describe('dashboard telemetry', () => {
expect(collectorData.lensByValue.a).toBe(3);
expect(collectorData.lensByValue.seriesA).toBe(2);
expect(collectorData.lensByValue.seriesB).toBe(1);
expect(collectorData.lensByValue.formula).toBe(1);
});

it('handles misshapen lens panels', () => {
Expand Down
23 changes: 23 additions & 0 deletions src/plugins/dashboard/server/usage/dashboard_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ interface LensPanel extends SavedDashboardPanel730ToLatest {
visualization?: {
preferredSeriesType?: string;
};
datasourceStates?: {
indexpattern?: {
layers: Record<
string,
{
columns: Record<string, { operationType: string }>;
}
>;
};
};
};
};
};
Expand Down Expand Up @@ -109,6 +119,19 @@ export const collectByValueLensInfo: DashboardCollectorFunction = (panels, colle
}

collectorData.lensByValue[type] = collectorData.lensByValue[type] + 1;

const hasFormula = Object.values(
lensPanel.embeddableConfig.attributes.state?.datasourceStates?.indexpattern?.layers || {}
).some((layer) =>
Object.values(layer.columns).some((column) => column.operationType === 'formula')
);

if (hasFormula && !collectorData.lensByValue.formula) {
collectorData.lensByValue.formula = 0;
}
if (hasFormula) {
collectorData.lensByValue.formula++;
}
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { i18n } from '@kbn/i18n';
import { ExpressionFunctionDefinition } from '../types';
import { Datatable, getType } from '../../expression_types';
import { Datatable, DatatableColumn, getType } from '../../expression_types';

export interface MapColumnArguments {
id?: string | null;
Expand Down Expand Up @@ -110,10 +110,10 @@ export const mapColumn: ExpressionFunctionDefinition<

return Promise.all(rowPromises).then((rows) => {
const type = rows.length ? getType(rows[0][columnId]) : 'null';
const newColumn = {
const newColumn: DatatableColumn = {
id: columnId,
name: args.name,
meta: { type },
meta: { type, params: { id: type } },
};
if (args.copyMetaFrom) {
const metaSourceFrom = columns.find(({ id }) => id === args.copyMetaFrom);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ describe('mapColumn', () => {
expect(result.type).toBe('datatable');
expect(result.columns).toEqual([
...testTable.columns,
{ id: 'pricePlusTwo', name: 'pricePlusTwo', meta: { type: 'number' } },
{
id: 'pricePlusTwo',
name: 'pricePlusTwo',
meta: { type: 'number', params: { id: 'number' } },
},
]);
expect(result.columns[result.columns.length - 1]).toHaveProperty('name', 'pricePlusTwo');
expect(result.rows[arbitraryRowIndex]).toHaveProperty('pricePlusTwo');
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/plugins/kibana_react/public/code_editor/code_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,16 @@ export class CodeEditor extends React.Component<Props, {}> {
wordBasedSuggestions: false,
wordWrap: 'on',
wrappingIndent: 'indent',
matchBrackets: 'never',
...options,
}}
/>
<ReactResizeDetector handleWidth handleHeight onResize={this._updateDimensions} />
<ReactResizeDetector
handleWidth
handleHeight
onResize={this._updateDimensions}
refreshMode="debounce"
/>
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/shareable_runtime/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = {
'src/plugins/data/public/expressions/interpreter'
),
'kbn/interpreter': path.resolve(KIBANA_ROOT, 'packages/kbn-interpreter/target/common'),
tinymath: path.resolve(KIBANA_ROOT, 'node_modules/tinymath/lib/tinymath.es5.js'),
tinymath: path.resolve(KIBANA_ROOT, 'node_modules/tinymath/lib/tinymath.min.js'),
core_app_image_assets: path.resolve(KIBANA_ROOT, 'src/core/public/core_app/images'),
},
extensions: ['.js', '.json', '.ts', '.tsx', '.scss'],
Expand Down
Loading