Skip to content

Commit

Permalink
[Portable Dashboards] Remove Saved Object Class (#138774)
Browse files Browse the repository at this point in the history
* Removed dashboard saved object class, replaced with dashboard saved object service
  • Loading branch information
ThomThomson authored Sep 28, 2022
1 parent 0e6d079 commit f5b6a2c
Show file tree
Hide file tree
Showing 144 changed files with 2,575 additions and 3,151 deletions.
11 changes: 5 additions & 6 deletions src/plugins/controls/public/services/plugin_services.stub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ import { themeServiceFactory } from './theme/theme.story';
import { registry as stubRegistry } from './plugin_services.story';

export const providers: PluginServiceProviders<ControlsServices> = {
http: new PluginServiceProvider(httpServiceFactory),
controls: new PluginServiceProvider(controlsServiceFactory),
data: new PluginServiceProvider(dataServiceFactory),
overlays: new PluginServiceProvider(overlaysServiceFactory),
dataViews: new PluginServiceProvider(dataViewsServiceFactory),
http: new PluginServiceProvider(httpServiceFactory),
optionsList: new PluginServiceProvider(optionsListServiceFactory),
overlays: new PluginServiceProvider(overlaysServiceFactory),
settings: new PluginServiceProvider(settingsServiceFactory),
unifiedSearch: new PluginServiceProvider(unifiedSearchServiceFactory),
theme: new PluginServiceProvider(themeServiceFactory),

controls: new PluginServiceProvider(controlsServiceFactory),
optionsList: new PluginServiceProvider(optionsListServiceFactory),
unifiedSearch: new PluginServiceProvider(unifiedSearchServiceFactory),
};

export const pluginServices = new PluginServices<ControlsServices>();
Expand Down
11 changes: 5 additions & 6 deletions src/plugins/controls/public/services/plugin_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ export const providers: PluginServiceProviders<
ControlsServices,
KibanaPluginServiceParams<ControlsPluginStartDeps>
> = {
http: new PluginServiceProvider(httpServiceFactory),
controls: new PluginServiceProvider(controlsServiceFactory),
data: new PluginServiceProvider(dataServiceFactory),
unifiedSearch: new PluginServiceProvider(unifiedSearchServiceFactory),
overlays: new PluginServiceProvider(overlaysServiceFactory),
dataViews: new PluginServiceProvider(dataViewsServiceFactory),
http: new PluginServiceProvider(httpServiceFactory),
optionsList: new PluginServiceProvider(optionsListServiceFactory, ['data', 'http']),
overlays: new PluginServiceProvider(overlaysServiceFactory),
settings: new PluginServiceProvider(settingsServiceFactory),
theme: new PluginServiceProvider(themeServiceFactory),

optionsList: new PluginServiceProvider(optionsListServiceFactory, ['data', 'http']),
controls: new PluginServiceProvider(controlsServiceFactory),
unifiedSearch: new PluginServiceProvider(unifiedSearchServiceFactory),
};

export const pluginServices = new PluginServices<ControlsServices>();
Expand Down

This file was deleted.

69 changes: 0 additions & 69 deletions src/plugins/dashboard/common/embeddable/embeddable_references.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/plugins/dashboard/common/embeddable/types.ts

This file was deleted.

32 changes: 18 additions & 14 deletions src/plugins/dashboard/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@
* Side Public License, v 1.
*/

export type { GridData } from './embeddable/types';
export type {
RawSavedDashboardPanel730ToLatest,
DashboardDoc730ToLatest,
DashboardDoc700To720,
DashboardDocPre700,
} from './bwc/types';
export type {
GridData,
DashboardPanelMap,
SavedDashboardPanel,
DashboardAttributes,
DashboardPanelState,
DashboardContainerStateWithType,
SavedDashboardPanelTo60,
SavedDashboardPanel610,
SavedDashboardPanel620,
SavedDashboardPanel630,
SavedDashboardPanel640To720,
SavedDashboardPanel730ToLatest,
} from './types';

export { migratePanelsTo730 } from './migrate_to_730_panels';
export {
injectReferences,
extractReferences,
} from './persistable_state/dashboard_saved_object_references';

export { createInject, createExtract } from './persistable_state/dashboard_container_references';

export {
convertPanelStateToSavedDashboardPanel,
convertSavedDashboardPanelToPanelState,
convertSavedPanelsToPanelMap,
convertPanelMapToSavedPanels,
} from './lib/dashboard_panel_converters';

export const UI_SETTINGS = {
ENABLE_LABS_UI: 'labs:dashboard:enable_ui',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {
convertSavedDashboardPanelToPanelState,
convertPanelStateToSavedDashboardPanel,
} from './embeddable_saved_object_converters';
} from './dashboard_panel_converters';
import { SavedDashboardPanel, DashboardPanelState } from '../types';
import { EmbeddableInput } from '@kbn/embeddable-plugin/common/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { omit } from 'lodash';
import { EmbeddableInput, SavedObjectEmbeddableInput } from '@kbn/embeddable-plugin/common';
import { DashboardPanelState, SavedDashboardPanel } from '../types';
import { DashboardPanelMap, DashboardPanelState, SavedDashboardPanel } from '../types';

export function convertSavedDashboardPanelToPanelState<
TEmbeddableInput extends EmbeddableInput | SavedObjectEmbeddableInput = SavedObjectEmbeddableInput
Expand Down Expand Up @@ -42,3 +42,17 @@ export function convertPanelStateToSavedDashboardPanel(
...(panelState.panelRefName !== undefined && { panelRefName: panelState.panelRefName }),
};
}

export const convertSavedPanelsToPanelMap = (panels?: SavedDashboardPanel[]): DashboardPanelMap => {
const panelsMap: DashboardPanelMap = {};
panels?.forEach((panel, idx) => {
panelsMap![panel.panelIndex ?? String(idx)] = convertSavedDashboardPanelToPanelState(panel);
});
return panelsMap;
};

export const convertPanelMapToSavedPanels = (panels: DashboardPanelMap, version: string) => {
return Object.values(panels).map((panel) =>
convertPanelStateToSavedDashboardPanel(panel, version)
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { createExtract, createInject } from './dashboard_container_persistable_state';
import { createExtract, createInject } from './dashboard_container_references';
import { createEmbeddablePersistableStateServiceMock } from '@kbn/embeddable-plugin/common/mocks';
import { DashboardContainerStateWithType } from '../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
injectReferences,
InjectDeps,
ExtractDeps,
} from './saved_dashboard_references';
} from './dashboard_saved_object_references';

import { createExtract, createInject } from './embeddable/dashboard_container_persistable_state';
import { createExtract, createInject } from './dashboard_container_references';
import { createEmbeddablePersistableStateServiceMock } from '@kbn/embeddable-plugin/common/mocks';

const embeddablePersistableStateServiceMock = createEmbeddablePersistableStateServiceMock();
Expand Down
Loading

0 comments on commit f5b6a2c

Please sign in to comment.