Skip to content
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

[8.x] [embeddable] remove legacy embeddable test samples (#203678) #203841

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[embeddable] remove legacy embeddable test samples (#203678)
Remove legacy embeddable test constructs. PR removes tests that use test
samples and some code that could be easily removed.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit c59dddf)
  • Loading branch information
nreese committed Dec 11, 2024
commit 0468d4701113b8647a4e74a8d29427d8aba74a1c
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
Loading