Skip to content

Commit

Permalink
remove @kbn/presentation-containers from links page load bundle (elas…
Browse files Browse the repository at this point in the history
…tic#189595)

Same as elastic#189533 but for links
plugin
  • Loading branch information
nreese authored Jul 31, 2024
1 parent 8a60cd4 commit 817b320
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
16 changes: 16 additions & 0 deletions src/plugins/links/public/actions/compatibility_check.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* 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 { apiIsPresentationContainer, PresentationContainer } from '@kbn/presentation-containers';
import { EmbeddableApiContext } from '@kbn/presentation-publishing';

export const compatibilityCheck = (
api: EmbeddableApiContext['embeddable']
): api is PresentationContainer => {
return apiIsPresentationContainer(api);
};
9 changes: 4 additions & 5 deletions src/plugins/links/public/actions/create_links_panel_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

import { apiIsPresentationContainer } from '@kbn/presentation-containers';
import { EmbeddableApiContext } from '@kbn/presentation-publishing';
import { ADD_PANEL_TRIGGER, IncompatibleActionError } from '@kbn/ui-actions-plugin/public';
import { COMMON_EMBEDDABLE_GROUPING } from '@kbn/embeddable-plugin/public';
Expand All @@ -21,12 +20,12 @@ export const registerCreateLinksPanelAction = () => {
getIconType: () => APP_ICON,
order: 10,
isCompatible: async ({ embeddable }) => {
return apiIsPresentationContainer(embeddable);
const { compatibilityCheck } = await import('./compatibility_check');
return compatibilityCheck(embeddable);
},
execute: async ({ embeddable }) => {
if (!apiIsPresentationContainer(embeddable)) {
throw new IncompatibleActionError();
}
const { compatibilityCheck } = await import('./compatibility_check');
if (!compatibilityCheck(embeddable)) throw new IncompatibleActionError();
const { openEditorFlyout } = await import('../editor/open_editor_flyout');
const runtimeState = await openEditorFlyout({
parentDashboard: embeddable,
Expand Down

0 comments on commit 817b320

Please sign in to comment.