Skip to content

Commit

Permalink
Rename open flyout method
Browse files Browse the repository at this point in the history
  • Loading branch information
Heenawter committed Jul 7, 2023
1 parent c0c81e2 commit d71df9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import React from 'react';
import { Subject } from 'rxjs';
import { v4 as uuidv4 } from 'uuid';
import { skip, take, takeUntil } from 'rxjs/operators';

import { toMountPoint } from '@kbn/kibana-react-plugin/public';
Expand All @@ -21,15 +20,15 @@ import { NavigationEmbeddablePanelEditor } from '../components/navigation_embedd
/**
* @throws in case user cancels
*/
export async function openCreateNewFlyout(
export async function openEditorFlyout(
initialInput?: Omit<NavigationEmbeddableInput, 'id'>,
parentDashboard?: DashboardContainer
): Promise<Partial<NavigationEmbeddableInput>> {
return new Promise((resolve, reject) => {
const closed$ = new Subject<true>();

const onSave = (containerInput: Partial<NavigationEmbeddableInput>) => {
resolve(containerInput);
const onSave = (partialInput: Partial<NavigationEmbeddableInput>) => {
resolve(partialInput);
editorFlyout.close();
};

Expand All @@ -50,7 +49,7 @@ export async function openCreateNewFlyout(
const editorFlyout = coreServices.overlays.openFlyout(
toMountPoint(
<NavigationEmbeddablePanelEditor
initialInput={{ id: uuidv4(), ...initialInput }}
initialInput={initialInput ?? {}}
onClose={onCancel}
onSave={onSave}
parentDashboard={parentDashboard}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export class NavigationEmbeddableFactoryDefinition
) {
if (!parent) return {};

const { openCreateNewFlyout: createNavigationEmbeddable } = await import(
'../editor/open_create_new_flyout'
const { openEditorFlyout: createNavigationEmbeddable } = await import(
'../editor/open_editor_flyout'
);

const input = await createNavigationEmbeddable(
Expand Down

0 comments on commit d71df9e

Please sign in to comment.