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

[Embeddables Rebuild] Migrate Visualize #183197

Merged
merged 243 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 240 commits
Commits
Show all changes
243 commits
Select commit Hold shift + click to select a range
98ef1fd
Initial commit, register react visualize embeddable based on EUI mark…
Zacqary Apr 24, 2024
7d2c26f
Get initial expression updater logic working
Zacqary May 1, 2024
2ca806b
WIP
Zacqary May 2, 2024
1d86a45
Get visualizations rendering in embeddable
Zacqary May 6, 2024
806a98c
Add types to expression renderer props
Zacqary May 6, 2024
a9633f4
Add types and fix visualization saving
Zacqary May 7, 2024
9c7377a
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary May 8, 2024
d08e1f7
Implement actions
Zacqary May 8, 2024
48e51e6
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary May 9, 2024
8afa840
Get state serialization/deserialization working
Zacqary May 10, 2024
d655091
Deprecate legacy embeddable
Zacqary May 10, 2024
f87d0ac
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary May 10, 2024
6910163
Revert services reorg
Zacqary May 10, 2024
e39ca14
Revert dataViews dep
Zacqary May 10, 2024
0fa4d8f
Use existing apiPublishesSettings
Zacqary May 10, 2024
4add2da
Remove embeddable debugger flag
Zacqary May 10, 2024
1ca2ce3
Use existing start getter
Zacqary May 10, 2024
6b6e8ec
Remove unused savedObjects dep
Zacqary May 10, 2024
a590306
Add viewMode subject
Zacqary May 10, 2024
b9cc3a4
Merge branch 'main' into visualize-embeddable-react-converstion
kibanamachine May 13, 2024
3708ab0
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine May 13, 2024
347f066
Revert extractReferences type change
Zacqary May 13, 2024
5501a96
Revert injectReferences type change
Zacqary May 13, 2024
8b5bfe9
Merge remote-tracking branch 'origin/visualize-embeddable-react-conve…
Zacqary May 13, 2024
c1d56e3
Add savedobject deserialization
Zacqary May 14, 2024
3587f7c
Merge branch 'main' into visualize-embeddable-react-converstion
kibanamachine May 15, 2024
db5c257
WIP
Zacqary May 15, 2024
6c915cc
Port TSVB editor to React embeddable
Zacqary May 15, 2024
eae8f8d
Handle undefined state in deserializeState
Zacqary May 15, 2024
8a8c375
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary May 15, 2024
818f433
Use React embeddable in Default Editor, sidebar not yet migrated
Zacqary May 17, 2024
1997b37
Fix reference injection
Zacqary May 20, 2024
d4a3fec
Implement triggers in react embeddable
Zacqary May 20, 2024
6a57013
Implement inspector button in tsvb editor
Zacqary May 21, 2024
b3b5e22
Implement inspector on default editor
Zacqary May 21, 2024
7d1d93b
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine May 22, 2024
027bd97
Remove legacy visualizeembeddable
Zacqary May 22, 2024
8ab5b31
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary May 22, 2024
36ebfb1
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary May 22, 2024
0720581
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine May 22, 2024
5eee91d
Run i18n fix
Zacqary May 22, 2024
10da106
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary May 22, 2024
108003e
Update visualize editor parentApis
Zacqary May 23, 2024
5473d35
Typecheck fix
Zacqary May 23, 2024
76cdc32
Fix missing test subjs
Zacqary May 28, 2024
160e34d
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary May 28, 2024
2603dd7
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary May 29, 2024
dee7dde
Clean up subjects and move async deserialize logic into deserializeState
Zacqary May 29, 2024
0e80a0a
Fix markdown editor
Zacqary May 29, 2024
300686f
Add error prompt to broken vis loaders
Zacqary May 29, 2024
3a9aa48
Fix index pattern saving in agg embeddables
Zacqary May 29, 2024
aac4b63
Fetch index pattern from savedSearch
Zacqary May 29, 2024
57e2c57
Reinstate data-shared-item attr
Zacqary May 29, 2024
cf772ea
Fix missing data-shared-item props
Zacqary May 30, 2024
1921e9d
Fix emitting visdata
Zacqary May 30, 2024
714987c
Fix FTR 3 - data-rendering-complete
Zacqary May 30, 2024
06e4aa5
Fix reference migration
Zacqary May 30, 2024
fe39bd4
Reimplement hasInspector
Zacqary May 30, 2024
c377731
Fix navigate to lens from visualize
Zacqary May 30, 2024
b42a21b
Fix updating aggregation vis in editor
Zacqary May 30, 2024
46567d2
Force empty data-title and data-description
Zacqary May 30, 2024
986c432
Clear data-title when hidePanelTitle is true
Zacqary May 30, 2024
6cd153e
Catch error when searchSource ref is missing
Zacqary May 30, 2024
d52b1a6
Fix tag cloud test
Zacqary May 30, 2024
e3840c1
Move waitForVisualization into clickGo
Zacqary May 30, 2024
13f85f7
Implement add from library
Zacqary May 31, 2024
95eed5e
Fix saving title from visualize app
Zacqary May 31, 2024
270b560
Fix i18n
Zacqary May 31, 2024
149443d
Pass navigateToLensFn directly to visualize topnav
Zacqary May 31, 2024
c2d4582
Skip tag cloud tests
Zacqary May 31, 2024
aaa078c
Add library linking actions
Zacqary May 31, 2024
8e1cd68
Import index pattern references in default editor
Zacqary May 31, 2024
eb41aa2
WIP Visualize Editor refactor
Zacqary Jun 3, 2024
7f4f55f
Clean up top nav saving
Zacqary Jun 3, 2024
dd49ca4
Fix save and load from savedobject editor
Zacqary Jun 4, 2024
7ab95f3
Fix editor breadcrumbs for savedobject editor
Zacqary Jun 4, 2024
ec52b76
Commit breadcrumbs hook
Zacqary Jun 5, 2024
7a0bf7e
Restore working legacy tsvb editors
Zacqary Jun 6, 2024
20562a1
Fix imports
Zacqary Jun 6, 2024
9444ebe
Fix saving and loading on byvalue and default editors
Zacqary Jun 6, 2024
19cc33e
Cleanup types
Zacqary Jun 6, 2024
7a14da7
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Jun 25, 2024
9fb5586
Add uiState url parser
Zacqary Jul 2, 2024
3fd9d67
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Jul 2, 2024
afdd40a
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jul 2, 2024
ed65afe
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jul 2, 2024
b087b94
Typecheck fix
Zacqary Jul 3, 2024
aa9f9d2
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Jul 3, 2024
feae461
Fix save from visualize editor
Zacqary Jul 3, 2024
6f67794
Remove references from byValue dashboard panels
Zacqary Jul 8, 2024
c998350
Fix routing for editing library vis panels
Zacqary Jul 8, 2024
5078d5b
Fix saving tags and managed vis
Zacqary Jul 8, 2024
6c71992
Fix extracting savedObjectProperties in editor
Zacqary Jul 8, 2024
ca17fb4
Fix handleLinkedSearch
Zacqary Jul 8, 2024
7a83962
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jul 8, 2024
7cecf04
Fix navigate to lens link
Zacqary Jul 9, 2024
730a602
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Jul 9, 2024
fd37567
Fix TSVB setVis
Zacqary Jul 9, 2024
55d61ea
Begin implementing saveToLibrary action
Zacqary Jul 9, 2024
88c9679
WIP fix references
Zacqary Jul 9, 2024
c50fa14
make runtime state serializable
ThomThomson Jul 9, 2024
99c1c09
runtime state fixes
ThomThomson Jul 10, 2024
4c28c43
Merge pull request #5 from ThomThomson/visualizeEmbeddable/runtimeSta…
Zacqary Jul 10, 2024
107ea3e
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Jul 11, 2024
b07454a
Fix saved object loading
Zacqary Jul 11, 2024
78b2968
Implement add/unlink from library successfully
Zacqary Jul 11, 2024
4604cf8
Fix TSVB editor api imports
Zacqary Jul 12, 2024
7112b8d
Fix saved searches
Zacqary Jul 12, 2024
1159f06
Fix link/unlink/load saved search
Zacqary Jul 12, 2024
6b4b45c
Fix vis without saved search and editing TSVB vis
Zacqary Jul 15, 2024
ad5d4cc
Fix TSVB serialization
Zacqary Jul 15, 2024
4c4fe34
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Jul 16, 2024
a851d7d
Fix bad merge
Zacqary Jul 16, 2024
aa85125
Fix save to library
Zacqary Jul 16, 2024
249d088
Fix save TSVB to dashboard
Zacqary Jul 16, 2024
6443d14
Add search source serialization comment
Zacqary Jul 16, 2024
8446bc0
undo changes
ThomThomson Jul 16, 2024
aa61d4b
Fix add from library titles
Zacqary Jul 16, 2024
4a0e3b6
Merge remote-tracking branch 'refs/remotes/Zacqary/visualize-embeddab…
ThomThomson Jul 16, 2024
87d4db5
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Jul 16, 2024
b7825cd
Merge pull request #6 from ThomThomson/visualizeEmbeddable/removeChanges
Zacqary Jul 16, 2024
faabc35
Fix i18n
Zacqary Jul 17, 2024
f246104
Fix saved vis instance jest
Zacqary Jul 17, 2024
98d070b
Fix bad merge
Zacqary Jul 17, 2024
d804991
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Jul 17, 2024
deaffdd
Fix bad merge
Zacqary Jul 17, 2024
3678bb5
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Jul 17, 2024
8fe79a3
Fix editor breadcrumb title sync
Zacqary Jul 17, 2024
07c702d
Refactor url app state tracking
Zacqary Jul 19, 2024
9e8808a
Update byvalue editor with appstate changes
Zacqary Jul 19, 2024
a671353
Fix byvalue editor
Zacqary Jul 19, 2024
d03cd46
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jul 19, 2024
b1bd42b
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Jul 22, 2024
2d8df0b
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Jul 22, 2024
bc3920d
Add getInspectorAdapters to visualize embeddable
Zacqary Jul 23, 2024
fe312f4
Fully encode app state rison
Zacqary Jul 23, 2024
100cd7c
Add data views and default title to visualize embeddable. Re-set chan…
ThomThomson Jul 23, 2024
defa900
Merge remote-tracking branch 'refs/remotes/Zacqary/visualize-embeddab…
ThomThomson Jul 23, 2024
97d2199
Fix legacy code typechecks
Zacqary Jul 23, 2024
337b7d4
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Jul 23, 2024
362a544
Add missing test file
Zacqary Jul 24, 2024
476cca9
Wait for vis update before calling updateExpressionParams
Zacqary Jul 25, 2024
4594c83
Restore legacy embeddable to visualize app
Zacqary Jul 25, 2024
2bc47d0
Fix state transfer from visualize
Zacqary Jul 26, 2024
7cbb415
begin separating visualize embeddable class from legacy embeddable fr…
ThomThomson Jul 26, 2024
40636fe
Fix quick check
Zacqary Jul 26, 2024
36faec7
Merge remote-tracking branch 'refs/remotes/Zacqary/visualize-embeddab…
ThomThomson Jul 26, 2024
f6ecba6
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jul 26, 2024
4c9775f
remove attribute service from legacy embeddable and clean up types
ThomThomson Jul 26, 2024
4852cd9
Merge remote-tracking branch 'refs/remotes/Zacqary/visualize-embeddab…
ThomThomson Jul 26, 2024
2decc19
Remove unused hooks
Zacqary Jul 26, 2024
4222f35
Remove unused legacy components
Zacqary Jul 26, 2024
1c76810
Typecheck fix, remove unused api methods
Zacqary Jul 26, 2024
4790a72
make Canvas store runtime state of react embeddables.
ThomThomson Jul 29, 2024
6671dc4
Add drilldown action
Zacqary Jul 29, 2024
39d5532
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Jul 29, 2024
c7c0b2e
add time range api
ThomThomson Jul 29, 2024
334d6d0
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Jul 29, 2024
49f8a6a
Merge remote-tracking branch 'refs/remotes/Zacqary/visualize-embeddab…
ThomThomson Jul 30, 2024
79720c8
Fix visualize render count tests
Zacqary Jul 30, 2024
fb18006
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Jul 30, 2024
18c94dd
Revert "begin separating visualize embeddable class from legacy embed…
Zacqary Jul 31, 2024
4617626
Fix quick check
Zacqary Jul 31, 2024
31bed0a
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jul 31, 2024
9295992
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 2, 2024
e68fe77
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Aug 2, 2024
eabfcdc
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Aug 2, 2024
117b983
Fix comparators
Zacqary Aug 5, 2024
51765ce
Fix empty title/description comparator
Zacqary Aug 5, 2024
c532778
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Aug 5, 2024
be1f6e8
Update screenshot waitForRender to watch attribute change
Zacqary Aug 6, 2024
88df0ab
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 6, 2024
bd35717
Increase PNG baseline threshold, pdf timeout length
Zacqary Aug 7, 2024
446afb6
Restore runtime state changes to react_embeddable_renderer
Zacqary Aug 7, 2024
fa5a295
Add embeddableError data-test-subj to react vis errors
Zacqary Aug 7, 2024
975c5ed
Skip flaky Vega test
Zacqary Aug 7, 2024
7d7789c
Fix lint
Zacqary Aug 7, 2024
a05cb41
Increase screenshot diff threshold to 0.1
Zacqary Aug 8, 2024
722dc35
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 8, 2024
1bb1c29
Fix serializing enhancements
Zacqary Aug 8, 2024
a59642e
Fix loading drilldowns on panels linked to library
Zacqary Aug 8, 2024
60e2b68
Remove console error
Zacqary Aug 9, 2024
510796e
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 9, 2024
54b89ba
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 9, 2024
4bf09da
Fix tsvb serverless test
Zacqary Aug 9, 2024
c1136be
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Aug 9, 2024
8fd77a0
Fix missing index pattern test
Zacqary Aug 9, 2024
d642aff
Add trigger for go to dashboard drilldown
Zacqary Aug 12, 2024
75fdbeb
Fix editing permissions
Zacqary Aug 12, 2024
eb79469
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 12, 2024
f4d4df0
Fix i18n
Zacqary Aug 12, 2024
eb7789e
Restore embeddable api context for action triggers
Zacqary Aug 12, 2024
19e8786
Remove cosole logs
Zacqary Aug 12, 2024
d8e66ad
Fix tsvb lens convert tests
Zacqary Aug 13, 2024
b643f94
Fix UI state save/load
Zacqary Aug 13, 2024
0ce26fe
Fix byvalue save permissions
Zacqary Aug 14, 2024
38874c0
Fix save permissions again
Zacqary Aug 14, 2024
bd3fd14
Add select range trigger to embeddable supportedTriggers
Zacqary Aug 14, 2024
3d5b8c4
Fix type import linting
Zacqary Aug 14, 2024
0e46782
Fix custom time range saving
Zacqary Aug 15, 2024
2662dcf
Fix loading custom timerange on linked panels
Zacqary Aug 15, 2024
3d29ae2
Fix panel action test
Zacqary Aug 15, 2024
7830ff6
Fix telemetry tests
Zacqary Aug 19, 2024
0ca480f
Fix reference jest
Zacqary Aug 19, 2024
dd2fc2c
Fix type import
Zacqary Aug 19, 2024
5c145b0
Skip directly modifying url tests
Zacqary Aug 19, 2024
05936a5
Remove console logs
Zacqary Aug 19, 2024
f7de7e7
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 19, 2024
ea32301
Use string ViewModes instead of enum
Zacqary Aug 19, 2024
a0da8fb
Fix lint
Zacqary Aug 20, 2024
7ffbea5
Typecheck fix
Zacqary Aug 20, 2024
69990c8
Revert canvas runtime state changes
Zacqary Aug 20, 2024
ad8eab0
Type fix
Zacqary Aug 21, 2024
0d54a90
Restore saved_visualization_references changes
Zacqary Aug 21, 2024
0fef75e
Fix importing pre-passed runtime state into canvas
Zacqary Aug 21, 2024
5e9b594
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 21, 2024
b4cb319
Typecheck fix
Zacqary Aug 21, 2024
63c6b14
Add timeslice support
Zacqary Aug 21, 2024
0d9a723
Add deprecation statements to legacy embeddable
Zacqary Aug 22, 2024
465e97f
Clean up and comment embeddable code
Zacqary Aug 22, 2024
813d8ca
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 22, 2024
ee65895
Remove extraneous legacy edit path
Zacqary Aug 22, 2024
71476ee
Merge branch 'main' into visualize-embeddable-react-converstion
elasticmachine Aug 23, 2024
990185e
Revert unneeded canvas type change; comment dashboard state test skip
Zacqary Aug 23, 2024
08861d8
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Aug 23, 2024
7a0a88e
Remove PublishesDataView
Zacqary Aug 23, 2024
5ac4c77
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 23, 2024
0a2f67c
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Aug 23, 2024
7728b34
Merge branch 'main' into visualize-embeddable-react-converstion
mbondyra Aug 26, 2024
a6603b6
Merge branch 'main' into visualize-embeddable-react-converstion
mbondyra Aug 26, 2024
b8b9550
Remove convertSavedObjectAttributesToReferences export
Zacqary Aug 26, 2024
d09c0d8
Convert updateExpressionParams to getExpressionParams
Zacqary Aug 26, 2024
656120a
Convert switchMap to async instead of IIFE
Zacqary Aug 26, 2024
4be626d
Merge branch 'visualize-embeddable-react-converstion' of https://gith…
Zacqary Aug 26, 2024
d701179
Async import createVisEmbeddableFromObject
Zacqary Aug 27, 2024
b02a3ba
Use pipe/switchMap for serializedVis subscription
Zacqary Aug 27, 2024
7003cf3
Reinstate uiStateChange unsubscribe
Zacqary Aug 28, 2024
924d105
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 28, 2024
af5012d
Emit renderComplete from visualize embeddable on render
Zacqary Aug 28, 2024
f1ff79d
Remove savedObjectToRuntimeState
Zacqary Aug 28, 2024
48e9897
Add initialState to onAdd
Zacqary Aug 28, 2024
bbf95fb
Use util to dispatch renderComplete
Zacqary Aug 29, 2024
2f8f46f
Merge remote-tracking branch 'upstream/main' into visualize-embeddabl…
Zacqary Aug 29, 2024
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
13 changes: 7 additions & 6 deletions packages/presentation/presentation_containers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,24 @@ export {
type CanDuplicatePanels,
type CanExpandPanels,
} from './interfaces/panel_management';
export {
canTrackContentfulRender,
type TrackContentfulRender,
type TracksQueryPerformance,
} from './interfaces/performance_trackers';
export {
apiIsPresentationContainer,
combineCompatibleChildrenApis,
getContainerParentFromAPI,
listenForCompatibleApi,
combineCompatibleChildrenApis,
type PanelPackage,
type PresentationContainer,
} from './interfaces/presentation_container';
export { apiPublishesSettings, type PublishesSettings } from './interfaces/publishes_settings';
export {
apiHasSerializableState,
type HasSerializableState,
type HasSnapshottableState,
type SerializedPanelState,
} from './interfaces/serialized_state';
export { tracksOverlays, type TracksOverlays } from './interfaces/tracks_overlays';
export {
canTrackContentfulRender,
type TrackContentfulRender,
type TracksQueryPerformance,
} from './interfaces/performance_trackers';
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"@kbn/es-query",
"@kbn/data-views-plugin",
"@kbn/expressions-plugin",
"@kbn/core-execution-context-common",
"@kbn/core-execution-context-common"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ export type {
} from './latest';

export * as VisualizationV1 from './v1';
export type { Reference } from './v1';
4 changes: 3 additions & 1 deletion src/plugins/visualizations/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
BUCKET_TYPES,
} from '@kbn/data-plugin/common';
import type { SerializedFieldFormat } from '@kbn/field-formats-plugin/common';
import { Reference } from './content_management';

export interface VisParams {
[key: string]: any;
Expand All @@ -36,8 +37,9 @@ export type {
export interface SerializedVisData {
expression?: string;
aggs: AggConfigSerialized[];
searchSource: SerializedSearchSourceFields;
searchSource: SerializedSearchSourceFields & { indexRefName?: string };
savedSearchId?: string;
savedSearchRefName?: string | Reference;
}

export interface SerializedVis<T = VisParams> {
Expand Down
12 changes: 4 additions & 8 deletions src/plugins/visualizations/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,18 @@
"savedObjectsFinder",
"savedObjectsManagement",
"savedSearch",
"contentManagement",
"contentManagement"
],
"optionalPlugins": [
"home",
"share",
"spaces",
"savedObjectsTaggingOss",
"serverless",
"noDataPage"
],
"requiredBundles": [
"kibanaUtils",
"kibanaReact",
"charts",
"savedObjects",
"noDataPage",
"embeddableEnhanced"
],
"requiredBundles": ["kibanaUtils", "kibanaReact", "charts", "savedObjects"],
"extraPublicDirs": [
"common/constants",
"common/utils",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import { urlFor } from '../utils/saved_visualize_utils';
import { VisualizeEmbeddableFactoryDeps } from './visualize_embeddable_factory';
import { createVisualizeEmbeddableAsync } from './visualize_embeddable_async';

/** @deprecated
* VisualizeEmbeddable is no longer registered with the legacy embeddable system and is only
* used within the visualize editor.
*/
export const createVisEmbeddableFromObject =
(deps: VisualizeEmbeddableFactoryDeps) =>
async (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export type VisualizeSavedObjectAttributes = SavedObjectAttributes & {
export type VisualizeByValueInput = { attributes: VisualizeSavedObjectAttributes } & VisualizeInput;
export type VisualizeByReferenceInput = SavedObjectEmbeddableInput & VisualizeInput;

/** @deprecated
* VisualizeEmbeddable is no longer registered with the legacy embeddable system and is only
* used within the visualize editor.
*/
export class VisualizeEmbeddable
extends Embeddable<VisualizeInput, VisualizeOutput>
implements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

import type { VisualizeEmbeddable as VisualizeEmbeddableType } from './visualize_embeddable';

/** @deprecated
* VisualizeEmbeddable is no longer registered with the legacy embeddable system and is only
* used within the visualize editor.
*/
export const createVisualizeEmbeddableAsync = async (
...args: ConstructorParameters<typeof VisualizeEmbeddableType>
) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export interface VisualizeEmbeddableFactoryDeps {
>;
}

/** @deprecated
* VisualizeEmbeddable is no longer registered with the legacy embeddable system and is only
* used within the visualize editor.
*/
export class VisualizeEmbeddableFactory
implements
EmbeddableFactoryDefinition<
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/visualizations/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export function plugin(initializerContext: PluginInitializerContext) {
export { TypesService } from './vis_types/types_service';
export {
apiHasVisualizeConfig,
VISUALIZE_EMBEDDABLE_TYPE,
VIS_EVENT_TO_TRIGGER,
COMMON_VISUALIZATION_GROUPING,
} from './embeddable';
Expand All @@ -38,12 +37,13 @@ export type {
VisualizationClient,
SerializableAttributes,
} from './vis_types';
export type { VisualizeEditorInput } from './react_embeddable/types';
export type { Vis, SerializedVis, SerializedVisData, VisData } from './vis';
export type VisualizeEmbeddableFactoryContract = PublicContract<VisualizeEmbeddableFactory>;
export type VisualizeEmbeddableContract = PublicContract<VisualizeEmbeddable>;
export type { VisualizeInput, VisualizeEmbeddable, HasVisualizeConfig } from './embeddable';
export type { SchemaConfig } from '../common/types';
export { updateOldState } from './legacy/vis_update_state';
export type { VisualizeInput, VisualizeEmbeddable, HasVisualizeConfig } from './embeddable';
export type { PersistedState } from './persisted_state';
export type {
ISavedVis,
Expand All @@ -63,6 +63,7 @@ export {
LegendSize,
LegendSizeToPixels,
DEFAULT_LEGEND_SIZE,
VISUALIZE_EMBEDDABLE_TYPE,
} from '../common/constants';
export type { SavedVisState, VisParams, Dimension } from '../common';
export { prepareLogTable, XYCurveTypes } from '../common';
Expand Down
1 change: 0 additions & 1 deletion src/plugins/visualizations/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const createInstance = async () => {
application: applicationServiceMock.createStartContract(),
embeddable: embeddablePluginMock.createStartContract(),
spaces: spacesPluginMock.createStartContract(),
getAttributeService: jest.fn(),
savedObjectsClient: coreMock.createStart().savedObjects.client,
savedObjects: savedObjectsPluginMock.createStartContract(),
savedObjectsTaggingOss: savedObjectTaggingOssPluginMock.createStart(),
Expand Down
83 changes: 39 additions & 44 deletions src/plugins/visualizations/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ import {
ContentManagementPublicStart,
} from '@kbn/content-management-plugin/public';
import type { NoDataPagePluginStart } from '@kbn/no-data-page-plugin/public';
import { EmbeddableEnhancedPluginStart } from '@kbn/embeddable-enhanced-plugin/public';

import type { TypesSetup, TypesStart } from './vis_types';
import type { VisualizeServices } from './visualize_app/types';
import {
Expand All @@ -83,11 +85,6 @@ import { xyDimension as xyDimensionExpressionFunction } from '../common/expressi
import { visDimension as visDimensionExpressionFunction } from '../common/expression_functions/vis_dimension';
import { range as rangeExpressionFunction } from '../common/expression_functions/range';
import { TypesService } from './vis_types/types_service';
import {
createVisEmbeddableFromObject,
VISUALIZE_EMBEDDABLE_TYPE,
VisualizeEmbeddableFactory,
} from './embeddable';
import {
setUISettings,
setTypes,
Expand Down Expand Up @@ -115,18 +112,20 @@ import {
setSavedObjectsManagement,
setContentManagement,
setSavedSearch,
setDataViews,
setInspector,
getTypes,
} from './services';
import { VisualizeConstants } from '../common/constants';
import { VisualizeConstants, VISUALIZE_EMBEDDABLE_TYPE } from '../common/constants';
import { EditInLensAction } from './actions/edit_in_lens_action';
import { ListingViewRegistry, SerializedVis } from './types';
import { ListingViewRegistry } from './types';
import {
LATEST_VERSION,
CONTENT_ID,
VisualizationSavedObjectAttributes,
} from '../common/content_management';
import { SerializedVisData } from '../common';
import { VisualizeByValueInput } from './embeddable/visualize_embeddable';
import { AddAggVisualizationPanelAction } from './actions/add_agg_vis_action';
import { VisualizeSerializedState } from './react_embeddable/types';

/**
* Interface for this plugin's returned setup/start contracts.
Expand Down Expand Up @@ -163,7 +162,6 @@ export interface VisualizationsStartDeps {
inspector: InspectorStart;
uiActions: UiActionsStart;
application: ApplicationStart;
getAttributeService: EmbeddableStart['getAttributeService'];
navigation: NavigationStart;
presentationUtil: PresentationUtilPluginStart;
savedObjects: SavedObjectsStart;
Expand All @@ -181,6 +179,7 @@ export interface VisualizationsStartDeps {
contentManagement: ContentManagementPublicStart;
serverless?: ServerlessPluginStart;
noDataPage?: NoDataPagePluginStart;
embeddableEnhanced?: EmbeddableEnhancedPluginStart;
}

/**
Expand Down Expand Up @@ -308,6 +307,7 @@ export class VisualizationsPlugin
* this should be replaced to use only scoped history after moving legacy apps to browser routing
*/
const history = createHashHistory();
const { createVisEmbeddableFromObject } = await import('./embeddable');
const services: VisualizeServices = {
...coreStart,
history,
Expand All @@ -332,6 +332,7 @@ export class VisualizationsPlugin
embeddable: pluginsStart.embeddable,
stateTransferService: pluginsStart.embeddable.getStateTransfer(),
setActiveUrl,
/** @deprecated */
createVisEmbeddableFromObject: createVisEmbeddableFromObject({ start }),
scopedHistory: params.history,
restorePreviousUrl,
Expand Down Expand Up @@ -400,8 +401,30 @@ export class VisualizationsPlugin
uiActions.registerTrigger(dashboardVisualizationPanelTrigger);
const editInLensAction = new EditInLensAction(data.query.timefilter.timefilter);
uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, editInLensAction);
const embeddableFactory = new VisualizeEmbeddableFactory({ start });
embeddable.registerEmbeddableFactory(VISUALIZE_EMBEDDABLE_TYPE, embeddableFactory);
embeddable.registerReactEmbeddableFactory(VISUALIZE_EMBEDDABLE_TYPE, async () => {
const {
plugins: { embeddable: embeddableStart, embeddableEnhanced: embeddableEnhancedStart },
} = start();

const { getVisualizeEmbeddableFactory } = await import('./react_embeddable');
return getVisualizeEmbeddableFactory({ embeddableStart, embeddableEnhancedStart });
});
embeddable.registerReactEmbeddableSavedObject<VisualizationSavedObjectAttributes>({
onAdd: (container, savedObject) => {
container.addNewPanel<VisualizeSerializedState>({
nreese marked this conversation as resolved.
Show resolved Hide resolved
panelType: VISUALIZE_EMBEDDABLE_TYPE,
});
},
embeddableType: VISUALIZE_EMBEDDABLE_TYPE,
savedObjectType: VISUALIZE_EMBEDDABLE_TYPE,
savedObjectName: i18n.translate('visualizations.visualizeSavedObjectName', {
defaultMessage: 'Visualization',
}),
getIconForSavedObject: (savedObject) => {
const visState = JSON.parse(savedObject.attributes.visState ?? '{}');
return getTypes().get(visState.type)?.icon ?? '';
},
});

contentManagement.registry.register({
id: CONTENT_ID,
Expand All @@ -411,37 +434,6 @@ export class VisualizationsPlugin
name: 'Visualize Library',
});

embeddable.registerSavedObjectToPanelMethod<
VisualizationSavedObjectAttributes,
VisualizeByValueInput
>(CONTENT_ID, (savedObject) => {
const visState = savedObject.attributes.visState;

// not sure if visState actually is ever undefined, but following the type
if (!savedObject.managed || !visState) {
return {
savedObjectId: savedObject.id,
};
}

// data is not always defined, so I added a default value since the extract
// routine in the embeddable factory expects it to be there
const savedVis = JSON.parse(visState) as Omit<SerializedVis, 'data'> & {
data?: SerializedVisData;
};

if (!savedVis.data) {
savedVis.data = {
searchSource: {},
aggs: [],
};
}

return {
savedVis: savedVis as SerializedVis, // now we're sure we have "data" prop
};
});

return {
...this.types.setup(),
visEditorsRegistry,
Expand All @@ -456,14 +448,15 @@ export class VisualizationsPlugin
expressions,
uiActions,
embeddable,
savedObjects,
spaces,
savedObjectsTaggingOss,
fieldFormats,
usageCollection,
savedObjectsManagement,
contentManagement,
savedSearch,
dataViews,
inspector,
}: VisualizationsStartDeps
): VisualizationsStart {
const types = this.types.start();
Expand All @@ -488,6 +481,8 @@ export class VisualizationsPlugin
setSavedObjectsManagement(savedObjectsManagement);
setContentManagement(contentManagement);
setSavedSearch(savedSearch);
setDataViews(dataViews);
setInspector(inspector);

if (spaces) {
setSpaces(spaces);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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 { SerializedVis } from '../vis';
import { createVisAsync } from '../vis_async';
import { getSavedSearch } from '../services';

export const createVisInstance = async (serializedVis: SerializedVis) => {
const vis = await createVisAsync(serializedVis.type, serializedVis);
if (serializedVis.data.savedSearchId) {
const savedSearch = await getSavedSearch().get(serializedVis.data.savedSearchId);
const indexPattern = savedSearch.searchSource.getField('index');
if (indexPattern) {
vis.data.indexPattern = indexPattern;
vis.data.searchSource?.setField('index', indexPattern);
}
}
return vis;
};
Loading