From 2379cd3853d7af56478bae471f86d170e0c2acff Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Wed, 30 Jun 2021 14:13:37 -0400 Subject: [PATCH] Renaming registry for clarity --- x-pack/plugins/canvas/public/plugin.tsx | 4 ++-- x-pack/plugins/canvas/public/services/kibana/index.ts | 6 +++--- .../plugins/canvas/public/services/storybook/index.ts | 10 +++++----- x-pack/plugins/canvas/public/services/stubs/index.ts | 6 ++++-- .../canvas/storybook/decorators/services_decorator.tsx | 9 ++++++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/canvas/public/plugin.tsx b/x-pack/plugins/canvas/public/plugin.tsx index 0010e6ca95df4..543c159bae145 100644 --- a/x-pack/plugins/canvas/public/plugin.tsx +++ b/x-pack/plugins/canvas/public/plugin.tsx @@ -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 }; @@ -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); } } diff --git a/x-pack/plugins/canvas/public/services/kibana/index.ts b/x-pack/plugins/canvas/public/services/kibana/index.ts index 1c77c44ec2b72..99012003b3a15 100644 --- a/x-pack/plugins/canvas/public/services/kibana/index.ts +++ b/x-pack/plugins/canvas/public/services/kibana/index.ts @@ -18,14 +18,14 @@ import { CanvasStartDeps } from '../../plugin'; export { workpadServiceFactory } from './workpad'; -export const providers: PluginServiceProviders< +export const pluginServiceProviders: PluginServiceProviders< CanvasPluginServices, KibanaPluginServiceParams > = { workpad: new PluginServiceProvider(workpadServiceFactory), }; -export const registry = new PluginServiceRegistry< +export const pluginServiceRegistry = new PluginServiceRegistry< CanvasPluginServices, KibanaPluginServiceParams ->(providers); +>(pluginServiceProviders); diff --git a/x-pack/plugins/canvas/public/services/storybook/index.ts b/x-pack/plugins/canvas/public/services/storybook/index.ts index 4f7ab7d5a701f..de231f730faf5 100644 --- a/x-pack/plugins/canvas/public/services/storybook/index.ts +++ b/x-pack/plugins/canvas/public/services/storybook/index.ts @@ -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 { @@ -21,13 +20,14 @@ export interface StorybookParams { workpadCount?: number; } -export const providers: PluginServiceProviders = { +export const pluginServiceProviders: PluginServiceProviders< + CanvasPluginServices, + StorybookParams +> = { ...stubProviders, workpad: new PluginServiceProvider(workpadServiceFactory), }; -export const pluginServices = new PluginServices(); - export const argTypes = { hasTemplates: { name: 'Has templates?', diff --git a/x-pack/plugins/canvas/public/services/stubs/index.ts b/x-pack/plugins/canvas/public/services/stubs/index.ts index 75fb56ba94241..586007201db81 100644 --- a/x-pack/plugins/canvas/public/services/stubs/index.ts +++ b/x-pack/plugins/canvas/public/services/stubs/index.ts @@ -18,8 +18,10 @@ import { workpadServiceFactory } from './workpad'; export { workpadServiceFactory } from './workpad'; -export const providers: PluginServiceProviders = { +export const pluginServiceProviders: PluginServiceProviders = { workpad: new PluginServiceProvider(workpadServiceFactory), }; -export const registry = new PluginServiceRegistry(providers); +export const pluginServiceRegistry = new PluginServiceRegistry( + pluginServiceProviders +); diff --git a/x-pack/plugins/canvas/storybook/decorators/services_decorator.tsx b/x-pack/plugins/canvas/storybook/decorators/services_decorator.tsx index 3d0e504a8172f..fbc3f140bffcc 100644 --- a/x-pack/plugins/canvas/storybook/decorators/services_decorator.tsx +++ b/x-pack/plugins/canvas/storybook/decorators/services_decorator.tsx @@ -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(providers); - pluginServices.setRegistry(registry.start(storybook.args)); + const pluginServiceRegistry = new PluginServiceRegistry( + pluginServiceProviders + ); + + pluginServices.setRegistry(pluginServiceRegistry.start(storybook.args)); const ContextProvider = pluginServices.getContextProvider();