mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Embeddable] Always send value input from edit panel action (#155283)
ensures that the by value input is passed into the editors regardless of whether the panel is by value or by reference.
This commit is contained in:
parent
f0106b1817
commit
8039fec178
3 changed files with 4 additions and 34 deletions
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import { EditPanelAction } from './edit_panel_action';
|
||||
import { Embeddable, EmbeddableInput, SavedObjectEmbeddableInput } from '../embeddables';
|
||||
import { Embeddable, EmbeddableInput } from '../embeddables';
|
||||
import { ViewMode } from '../types';
|
||||
import { ContactCardEmbeddable } from '../test_samples';
|
||||
import { embeddablePluginMock } from '../../mocks';
|
||||
|
@ -42,7 +42,7 @@ test('is compatible when edit url is available, in edit mode and editable', asyn
|
|||
).toBe(true);
|
||||
});
|
||||
|
||||
test('redirects to app using state transfer with by value mode', async () => {
|
||||
test('redirects to app using state transfer', async () => {
|
||||
applicationMock.currentAppId$ = of('superCoolCurrentApp');
|
||||
const testPath = '/test-path';
|
||||
const action = new EditPanelAction(
|
||||
|
@ -78,32 +78,6 @@ test('redirects to app using state transfer with by value mode', async () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('redirects to app using state transfer without by value mode', async () => {
|
||||
applicationMock.currentAppId$ = of('superCoolCurrentApp');
|
||||
const testPath = '/test-path';
|
||||
const action = new EditPanelAction(
|
||||
getFactory,
|
||||
applicationMock,
|
||||
stateTransferMock,
|
||||
() => testPath
|
||||
);
|
||||
const embeddable = new EditableEmbeddable(
|
||||
{ id: '123', viewMode: ViewMode.EDIT, savedObjectId: '1234' } as SavedObjectEmbeddableInput,
|
||||
true
|
||||
);
|
||||
embeddable.getOutput = jest.fn(() => ({ editApp: 'ultraVisualize', editPath: '/123' }));
|
||||
await action.execute({ embeddable });
|
||||
expect(stateTransferMock.navigateToEditor).toHaveBeenCalledWith('ultraVisualize', {
|
||||
path: '/123',
|
||||
state: {
|
||||
originatingApp: 'superCoolCurrentApp',
|
||||
embeddableId: '123',
|
||||
valueInput: undefined,
|
||||
originatingPath: testPath,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('getHref returns the edit urls', async () => {
|
||||
const action = new EditPanelAction(getFactory, applicationMock, stateTransferMock);
|
||||
expect(action.getHref).toBeDefined();
|
||||
|
|
|
@ -17,7 +17,6 @@ import {
|
|||
IEmbeddable,
|
||||
EmbeddableEditorState,
|
||||
EmbeddableStateTransfer,
|
||||
SavedObjectEmbeddableInput,
|
||||
EmbeddableInput,
|
||||
Container,
|
||||
} from '../..';
|
||||
|
@ -124,13 +123,11 @@ export class EditPanelAction implements Action<ActionContext> {
|
|||
|
||||
if (app && path) {
|
||||
if (this.currentAppId) {
|
||||
const byValueMode = !(embeddable.getInput() as SavedObjectEmbeddableInput).savedObjectId;
|
||||
|
||||
const originatingPath = this.getOriginatingPath?.();
|
||||
|
||||
const state: EmbeddableEditorState = {
|
||||
originatingApp: this.currentAppId,
|
||||
valueInput: byValueMode ? this.getExplicitInput({ embeddable }) : undefined,
|
||||
valueInput: this.getExplicitInput({ embeddable }),
|
||||
embeddableId: embeddable.id,
|
||||
searchSessionId: embeddable.getInput().searchSessionId,
|
||||
originatingPath,
|
||||
|
|
|
@ -86,8 +86,7 @@ export async function renderApp(
|
|||
mapEmbeddableInput = {
|
||||
savedObjectId: routeProps.match.params.savedMapId,
|
||||
} as MapByReferenceInput;
|
||||
}
|
||||
if (valueInput) {
|
||||
} else if (valueInput) {
|
||||
mapEmbeddableInput = valueInput as MapByValueInput;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue