Skip to content

Commit

Permalink
Renaming registry for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
clintandrewhall committed Jun 30, 2021
1 parent f336566 commit 2379cd3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/canvas/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { PresentationUtilPluginStart } from '../../../../src/plugins/presentatio
import { getPluginApi, CanvasApi } from './plugin_api';
import { CanvasSrcPlugin } from '../canvas_plugin_src/plugin';
import { pluginServices } from './services';
import { registry } from './services/kibana';
import { pluginServiceRegistry } from './services/kibana';

export { CoreStart, CoreSetup };

Expand Down Expand Up @@ -146,7 +146,7 @@ export class CanvasPlugin

public start(coreStart: CoreStart, startPlugins: CanvasStartDeps) {
this.srcPlugin.start(coreStart, startPlugins);
pluginServices.setRegistry(registry.start({ coreStart, startPlugins }));
pluginServices.setRegistry(pluginServiceRegistry.start({ coreStart, startPlugins }));
initLoadingIndicator(coreStart.http.addLoadingCountSource);
}
}
6 changes: 3 additions & 3 deletions x-pack/plugins/canvas/public/services/kibana/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import { CanvasStartDeps } from '../../plugin';

export { workpadServiceFactory } from './workpad';

export const providers: PluginServiceProviders<
export const pluginServiceProviders: PluginServiceProviders<
CanvasPluginServices,
KibanaPluginServiceParams<CanvasStartDeps>
> = {
workpad: new PluginServiceProvider(workpadServiceFactory),
};

export const registry = new PluginServiceRegistry<
export const pluginServiceRegistry = new PluginServiceRegistry<
CanvasPluginServices,
KibanaPluginServiceParams<CanvasStartDeps>
>(providers);
>(pluginServiceProviders);
10 changes: 5 additions & 5 deletions x-pack/plugins/canvas/public/services/storybook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
*/

import {
PluginServices,
PluginServiceProviders,
PluginServiceProvider,
} from '../../../../../../src/plugins/presentation_util/public';

import { CanvasPluginServices } from '..';
import { providers as stubProviders } from '../stubs';
import { pluginServiceProviders as stubProviders } from '../stubs';
import { workpadServiceFactory } from './workpad';

export interface StorybookParams {
Expand All @@ -21,13 +20,14 @@ export interface StorybookParams {
workpadCount?: number;
}

export const providers: PluginServiceProviders<CanvasPluginServices, StorybookParams> = {
export const pluginServiceProviders: PluginServiceProviders<
CanvasPluginServices,
StorybookParams
> = {
...stubProviders,
workpad: new PluginServiceProvider(workpadServiceFactory),
};

export const pluginServices = new PluginServices<CanvasPluginServices>();

export const argTypes = {
hasTemplates: {
name: 'Has templates?',
Expand Down
6 changes: 4 additions & 2 deletions x-pack/plugins/canvas/public/services/stubs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import { workpadServiceFactory } from './workpad';

export { workpadServiceFactory } from './workpad';

export const providers: PluginServiceProviders<CanvasPluginServices> = {
export const pluginServiceProviders: PluginServiceProviders<CanvasPluginServices> = {
workpad: new PluginServiceProvider(workpadServiceFactory),
};

export const registry = new PluginServiceRegistry<CanvasPluginServices>(providers);
export const pluginServiceRegistry = new PluginServiceRegistry<CanvasPluginServices>(
pluginServiceProviders
);
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ import { I18nProvider } from '@kbn/i18n/react';
import { PluginServiceRegistry } from '../../../../../src/plugins/presentation_util/public';
import { pluginServices, LegacyServicesProvider } from '../../public/services';
import { CanvasPluginServices } from '../../public/services';
import { providers, StorybookParams } from '../../public/services/storybook';
import { pluginServiceProviders, StorybookParams } from '../../public/services/storybook';

export const servicesContextDecorator: DecoratorFn = (story: Function, storybook) => {
if (process.env.JEST_WORKER_ID !== undefined) {
storybook.args.useStaticData = true;
}

const registry = new PluginServiceRegistry<CanvasPluginServices, StorybookParams>(providers);
pluginServices.setRegistry(registry.start(storybook.args));
const pluginServiceRegistry = new PluginServiceRegistry<CanvasPluginServices, StorybookParams>(
pluginServiceProviders
);

pluginServices.setRegistry(pluginServiceRegistry.start(storybook.args));

const ContextProvider = pluginServices.getContextProvider();

Expand Down

0 comments on commit 2379cd3

Please sign in to comment.