-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Dashboard First] Lens By Value #70272
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
Changes from 68 commits
297dba0
168825a
0039a97
8ec8020
681625f
473a052
3ee8263
a34d585
b7ff957
5d05ac9
adc1298
a3d0adc
3ecb3d9
72a068a
d1ab683
9cb9a7c
a0fffd0
4d64d5e
9e5f7a9
580fbba
df5fad0
c6d87c7
cd61dfc
7f86d23
43657f9
888ca49
b9d9c5c
c823217
87a780c
d3d2cfd
b793ca3
ef65220
ee625ec
4e39564
ed461d3
c9878c5
cb72a3e
a5910f2
ac5c91a
068ebaf
c1435e0
ac94aec
642eea8
9af2c06
8b43747
df876af
aeb25ee
6fc1f00
9598011
10d98e3
e85caeb
2ef26c6
ff13e40
3411c36
1d5b123
f497244
5b6d397
d345571
0dee8a7
12b9aa4
e3dc91a
29ae393
719d67c
3470c63
566500c
8796ab0
216fd7f
d0e3fd8
6f28a7f
cf74955
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,6 @@ import { | |
| ViewMode, | ||
| ContainerOutput, | ||
| EmbeddableInput, | ||
| SavedObjectEmbeddableInput, | ||
| } from '../../../embeddable/public'; | ||
| import { NavAction, SavedDashboardPanel } from '../types'; | ||
|
|
||
|
|
@@ -168,7 +167,7 @@ export class DashboardAppController { | |
| chrome.docTitle.change(dash.title); | ||
| } | ||
|
|
||
| const incomingEmbeddable = embeddable | ||
| let incomingEmbeddable = embeddable | ||
| .getStateTransfer(scopedHistory()) | ||
| .getIncomingEmbeddablePackage(); | ||
|
|
||
|
|
@@ -328,6 +327,22 @@ export class DashboardAppController { | |
| dashboardStateManager.getPanels().forEach((panel: SavedDashboardPanel) => { | ||
| embeddablesMap[panel.panelIndex] = convertSavedDashboardPanelToPanelState(panel); | ||
| }); | ||
|
|
||
| // If the incoming embeddable state's id already exists in the embeddables map, replace the input, retaining the existing gridData for that panel. | ||
| if (incomingEmbeddable?.embeddableId && embeddablesMap[incomingEmbeddable.embeddableId]) { | ||
| const originalPanelState = { ...embeddablesMap[incomingEmbeddable.embeddableId] }; | ||
ThomThomson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| embeddablesMap[incomingEmbeddable.embeddableId] = { | ||
| gridData: originalPanelState.gridData, | ||
| type: incomingEmbeddable.type, | ||
| explicitInput: { | ||
| ...originalPanelState.explicitInput, | ||
| ...incomingEmbeddable.input, | ||
| id: incomingEmbeddable.embeddableId, | ||
| }, | ||
| }; | ||
| incomingEmbeddable = undefined; | ||
| } | ||
|
|
||
| let expandedPanelId; | ||
| if (dashboardContainer && !isErrorEmbeddable(dashboardContainer)) { | ||
| expandedPanelId = dashboardContainer.getInput().expandedPanelId; | ||
|
|
@@ -454,31 +469,16 @@ export class DashboardAppController { | |
| refreshDashboardContainer(); | ||
| }); | ||
|
|
||
| if (incomingEmbeddable) { | ||
| if ('id' in incomingEmbeddable) { | ||
| container.addOrUpdateEmbeddable<SavedObjectEmbeddableInput>( | ||
| incomingEmbeddable.type, | ||
| { | ||
| savedObjectId: incomingEmbeddable.id, | ||
| } | ||
| ); | ||
| } else if ('input' in incomingEmbeddable) { | ||
| const input = incomingEmbeddable.input; | ||
| delete input.id; | ||
| const explicitInput = { | ||
| savedVis: input, | ||
| }; | ||
| const embeddableId = | ||
| 'embeddableId' in incomingEmbeddable | ||
| ? incomingEmbeddable.embeddableId | ||
| : undefined; | ||
| container.addOrUpdateEmbeddable<EmbeddableInput>( | ||
| incomingEmbeddable.type, | ||
| // This ugly solution is temporary - https://github.com/elastic/kibana/pull/70272 fixes this whole section | ||
| (explicitInput as unknown) as EmbeddableInput, | ||
| embeddableId | ||
| ); | ||
| } | ||
| // If the incomingEmbeddable does not yet exist in the panels listing, create a new panel using the container's addEmbeddable method. | ||
| if ( | ||
|
Contributor
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. I already started making this change in implementing attribute service for visualize, so again - the question is who goes first with this 😬
Contributor
Author
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. I was hoping to sneak this one in before you started work on using attribute service. Seems like I was too slow on the draw! |
||
| incomingEmbeddable && | ||
| (!incomingEmbeddable.embeddableId || | ||
| !container.getInput().panels[incomingEmbeddable.embeddableId]) | ||
| ) { | ||
| container.addNewEmbeddable<EmbeddableInput>( | ||
| incomingEmbeddable.type, | ||
| incomingEmbeddable.input | ||
| ); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.