Skip to content

Commit

Permalink
remove from charts plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra committed Nov 11, 2024
1 parent 807bca6 commit 3abfc1d
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 641 deletions.
7 changes: 2 additions & 5 deletions src/plugins/charts/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import { ChartsPlugin } from './plugin';
import { themeServiceMock } from './services/theme/mock';
import { activeCursorMock } from './services/active_cursor/mock';
import { colorsServiceMock } from './services/legacy_colors/mock';
import { getPaletteRegistry, paletteServiceMock } from './services/palettes/mock';

export { MOCK_SPARKLINE_THEME } from './services/theme/mock';
Expand All @@ -19,16 +18,14 @@ export type Setup = jest.Mocked<ReturnType<ChartsPlugin['setup']>>;
export type Start = jest.Mocked<ReturnType<ChartsPlugin['start']>>;

const createSetupContract = (): Setup => ({
legacyColors: colorsServiceMock,
theme: themeServiceMock,
palettes: paletteServiceMock.setup({} as any),
palettes: paletteServiceMock.setup(),
});

const createStartContract = (): Start => ({
legacyColors: colorsServiceMock,
theme: themeServiceMock,
activeCursor: activeCursorMock,
palettes: paletteServiceMock.setup({} as any),
palettes: paletteServiceMock.setup(),
});

export const chartPluginMock = {
Expand Down
9 changes: 2 additions & 7 deletions src/plugins/charts/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Plugin, CoreSetup } from '@kbn/core/public';
import { ExpressionsSetup } from '@kbn/expressions-plugin/public';
import { palette, systemPalette } from '../common';

import { ThemeService, LegacyColorsService } from './services';
import { ThemeService } from './services';
import { PaletteService } from './services/palettes/service';
import { ActiveCursor } from './services/active_cursor';

Expand All @@ -21,7 +21,6 @@ interface SetupDependencies {

/** @public */
export interface ChartsPluginSetup {
legacyColors: Omit<LegacyColorsService, 'init'>;
theme: Omit<ThemeService, 'init'>;
palettes: ReturnType<PaletteService['setup']>;
}
Expand All @@ -34,7 +33,6 @@ export type ChartsPluginStart = ChartsPluginSetup & {
/** @public */
export class ChartsPlugin implements Plugin<ChartsPluginSetup, ChartsPluginStart> {
private readonly themeService = new ThemeService();
private readonly legacyColorsService = new LegacyColorsService();
private readonly paletteService = new PaletteService();
private readonly activeCursor = new ActiveCursor();

Expand All @@ -44,21 +42,18 @@ export class ChartsPlugin implements Plugin<ChartsPluginSetup, ChartsPluginStart
dependencies.expressions.registerFunction(palette);
dependencies.expressions.registerFunction(systemPalette);
this.themeService.init(core.theme);
this.legacyColorsService.init();
this.palettes = this.paletteService.setup(this.legacyColorsService);
this.palettes = this.paletteService.setup();

this.activeCursor.setup();

return {
legacyColors: this.legacyColorsService,
theme: this.themeService,
palettes: this.palettes,
};
}

public start(): ChartsPluginStart {
return {
legacyColors: this.legacyColorsService,
theme: this.themeService,
palettes: this.palettes!,
activeCursor: this.activeCursor,
Expand Down
1 change: 0 additions & 1 deletion src/plugins/charts/public/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export { LegacyColorsService } from './legacy_colors';
export { ThemeService } from './theme';
export { ActiveCursor, useActiveCursor } from './active_cursor';
136 changes: 0 additions & 136 deletions src/plugins/charts/public/services/legacy_colors/colors.test.ts

This file was deleted.

62 changes: 0 additions & 62 deletions src/plugins/charts/public/services/legacy_colors/colors.ts

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions src/plugins/charts/public/services/legacy_colors/index.ts

This file was deleted.

Loading

0 comments on commit 3abfc1d

Please sign in to comment.