Skip to content

Commit

Permalink
[embeddable] remove legacy embeddable test samples (elastic#203678)
Browse files Browse the repository at this point in the history
Remove legacy embeddable test constructs. PR removes tests that use test
samples and some code that could be easily removed.

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
nreese and kibanamachine authored Dec 11, 2024
1 parent 59d3ac6 commit c59dddf
Show file tree
Hide file tree
Showing 40 changed files with 14 additions and 3,101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import React from 'react';

import { mountWithIntl } from '@kbn/test-jest-helpers';
import { CONTACT_CARD_EMBEDDABLE } from '@kbn/embeddable-plugin/public/lib/test_samples/embeddables';

import { DashboardGrid } from './dashboard_grid';
import { buildMockDashboardApi } from '../../../mocks';
Expand Down Expand Up @@ -50,12 +49,12 @@ jest.mock('./dashboard_grid_item', () => {
const PANELS = {
'1': {
gridData: { x: 0, y: 0, w: 6, h: 6, i: '1' },
type: CONTACT_CARD_EMBEDDABLE,
type: 'lens',
explicitInput: { id: '1' },
},
'2': {
gridData: { x: 6, y: 6, w: 6, h: 6, i: '2' },
type: CONTACT_CARD_EMBEDDABLE,
type: 'lens',
explicitInput: { id: '2' },
},
};
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ import {
IEmbeddable,
LegacyEmbeddableAPI,
} from '../i_embeddable';
import { canEditEmbeddable, editLegacyEmbeddable } from './edit_legacy_embeddable';
import {
embeddableInputToSubject,
embeddableOutputToSubject,
viewModeToSubject,
} from './embeddable_compatibility_utils';
import { canLinkLegacyEmbeddable, linkLegacyEmbeddable } from './link_legacy_embeddable';
import { canUnlinkLegacyEmbeddable, unlinkLegacyEmbeddable } from './unlink_legacy_embeddable';

export type CommonLegacyInput = EmbeddableInput & { savedObjectId?: string; timeRange: TimeRange };
export type CommonLegacyOutput = EmbeddableOutput & { indexPatterns: DataView[] };
Expand Down Expand Up @@ -93,13 +90,15 @@ export const legacyEmbeddableToApi = (
/**
* Support editing of legacy embeddables
*/
const onEdit = () => editLegacyEmbeddable(embeddable);
const onEdit = () => {
throw new Error('Edit legacy embeddable not supported');
};
const getTypeDisplayName = () =>
embeddableStart.getEmbeddableFactory(embeddable.type)?.getDisplayName() ??
i18n.translate('embeddableApi.compatibility.defaultTypeDisplayName', {
defaultMessage: 'chart',
});
const isEditingEnabled = () => canEditEmbeddable(embeddable);
const isEditingEnabled = () => false;

/**
* Performance tracking
Expand Down Expand Up @@ -286,11 +285,15 @@ export const legacyEmbeddableToApi = (
panelDescription,
defaultPanelDescription,

canLinkToLibrary: () => canLinkLegacyEmbeddable(embeddable),
linkToLibrary: () => linkLegacyEmbeddable(embeddable),
canLinkToLibrary: async () => false,
linkToLibrary: () => {
throw new Error('Link to library not supported for legacy embeddable');
},

canUnlinkFromLibrary: () => canUnlinkLegacyEmbeddable(embeddable),
unlinkFromLibrary: () => unlinkLegacyEmbeddable(embeddable),
canUnlinkFromLibrary: async () => false,
unlinkFromLibrary: () => {
throw new Error('Unlink from library not supported for legacy embeddable');
},

savedObjectId,
},
Expand Down
Loading

0 comments on commit c59dddf

Please sign in to comment.