From 9aab5c46c1b0da5a4f44098067b037f168333170 Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Thu, 12 Oct 2023 14:18:03 -0700 Subject: [PATCH] Reorganize into src/services and src/ui --- packages/shared-ux/error_boundary/index.ts | 7 +++++-- packages/shared-ux/error_boundary/mocks/src/jest.ts | 4 ++-- packages/shared-ux/error_boundary/mocks/src/storybook.ts | 4 ++-- .../src/{ => services}/error_boundary_services.tsx | 2 +- .../error_boundary/src/{ => services}/error_service.ts | 0 .../error_boundary/src/{ => services}/toasts_service.tsx | 2 +- .../error_boundary/src/{ => ui}/error_boundary.stories.tsx | 6 +++--- .../error_boundary/src/{ => ui}/error_boundary.tsx | 6 +++--- packages/shared-ux/error_boundary/types.ts | 4 ++-- 9 files changed, 19 insertions(+), 16 deletions(-) rename packages/shared-ux/error_boundary/src/{ => services}/error_boundary_services.tsx (98%) rename packages/shared-ux/error_boundary/src/{ => services}/error_service.ts (100%) rename packages/shared-ux/error_boundary/src/{ => services}/toasts_service.tsx (98%) rename packages/shared-ux/error_boundary/src/{ => ui}/error_boundary.stories.tsx (95%) rename packages/shared-ux/error_boundary/src/{ => ui}/error_boundary.tsx (92%) diff --git a/packages/shared-ux/error_boundary/index.ts b/packages/shared-ux/error_boundary/index.ts index ae3dce0fc43ef..e288086548b51 100644 --- a/packages/shared-ux/error_boundary/index.ts +++ b/packages/shared-ux/error_boundary/index.ts @@ -6,5 +6,8 @@ * Side Public License, v 1. */ -export { ErrorBoundary } from './src/error_boundary'; -export { ErrorBoundaryKibanaProvider, ErrorBoundaryProvider } from './src/error_boundary_services'; +export { ErrorBoundary } from './src/ui/error_boundary'; +export { + ErrorBoundaryKibanaProvider, + ErrorBoundaryProvider, +} from './src/services/error_boundary_services'; diff --git a/packages/shared-ux/error_boundary/mocks/src/jest.ts b/packages/shared-ux/error_boundary/mocks/src/jest.ts index 8ae75c24fa224..653075e7da104 100644 --- a/packages/shared-ux/error_boundary/mocks/src/jest.ts +++ b/packages/shared-ux/error_boundary/mocks/src/jest.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { ErrorService } from '../../src/error_service'; -import { ToastsService } from '../../src/toasts_service'; +import { ErrorService } from '../../src/services/error_service'; +import { ToastsService } from '../../src/services/toasts_service'; import { ErrorBoundaryServices } from '../../types'; export const getServicesMock = (): ErrorBoundaryServices => { diff --git a/packages/shared-ux/error_boundary/mocks/src/storybook.ts b/packages/shared-ux/error_boundary/mocks/src/storybook.ts index a84992791e670..6d9b1871c0eba 100644 --- a/packages/shared-ux/error_boundary/mocks/src/storybook.ts +++ b/packages/shared-ux/error_boundary/mocks/src/storybook.ts @@ -8,8 +8,8 @@ import { AbstractStorybookMock } from '@kbn/shared-ux-storybook-mock'; import { action } from '@storybook/addon-actions'; -import { ErrorService } from '../../src/error_service'; -import { ToastsService } from '../../src/toasts_service'; +import { ErrorService } from '../../src/services/error_service'; +import { ToastsService } from '../../src/services/toasts_service'; import { ErrorBoundaryServices } from '../../types'; // eslint-disable-next-line @typescript-eslint/no-empty-interface diff --git a/packages/shared-ux/error_boundary/src/error_boundary_services.tsx b/packages/shared-ux/error_boundary/src/services/error_boundary_services.tsx similarity index 98% rename from packages/shared-ux/error_boundary/src/error_boundary_services.tsx rename to packages/shared-ux/error_boundary/src/services/error_boundary_services.tsx index e5aaf53efafce..ba5f44ea4d859 100644 --- a/packages/shared-ux/error_boundary/src/error_boundary_services.tsx +++ b/packages/shared-ux/error_boundary/src/services/error_boundary_services.tsx @@ -11,7 +11,7 @@ import React, { FC, useContext } from 'react'; import useObservable from 'react-use/lib/useObservable'; import * as Rx from 'rxjs'; -import { ErrorBoundaryKibanaDependencies, ErrorBoundaryServices, Toasts } from '../types'; +import { ErrorBoundaryKibanaDependencies, ErrorBoundaryServices, Toasts } from '../../types'; import { ErrorService } from './error_service'; import { ToastsService } from './toasts_service'; diff --git a/packages/shared-ux/error_boundary/src/error_service.ts b/packages/shared-ux/error_boundary/src/services/error_service.ts similarity index 100% rename from packages/shared-ux/error_boundary/src/error_service.ts rename to packages/shared-ux/error_boundary/src/services/error_service.ts diff --git a/packages/shared-ux/error_boundary/src/toasts_service.tsx b/packages/shared-ux/error_boundary/src/services/toasts_service.tsx similarity index 98% rename from packages/shared-ux/error_boundary/src/toasts_service.tsx rename to packages/shared-ux/error_boundary/src/services/toasts_service.tsx index ba7240916832c..41863b64baf2d 100644 --- a/packages/shared-ux/error_boundary/src/toasts_service.tsx +++ b/packages/shared-ux/error_boundary/src/services/toasts_service.tsx @@ -24,7 +24,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { ErrorBoundaryUIServices } from '../types'; +import { ErrorBoundaryUIServices } from '../../types'; const DATA_TEST_SUBJ_PAGE_REFRESH_BUTTON = 'pageReloadButton'; const DATA_TEST_SUBJ_PAGE_DETAILS_BUTTON = 'showDetailsButton'; diff --git a/packages/shared-ux/error_boundary/src/error_boundary.stories.tsx b/packages/shared-ux/error_boundary/src/ui/error_boundary.stories.tsx similarity index 95% rename from packages/shared-ux/error_boundary/src/error_boundary.stories.tsx rename to packages/shared-ux/error_boundary/src/ui/error_boundary.stories.tsx index abcebbca100a8..8c6a5e367a7a2 100644 --- a/packages/shared-ux/error_boundary/src/error_boundary.stories.tsx +++ b/packages/shared-ux/error_boundary/src/ui/error_boundary.stories.tsx @@ -16,9 +16,9 @@ import { import { action } from '@storybook/addon-actions'; import { Meta, Story } from '@storybook/react'; import React, { FC, useState } from 'react'; -import { ErrorBoundary, ErrorBoundaryProvider } from '..'; -import mdx from '../README.mdx'; -import { ErrorBoundaryStorybookMock } from '../mocks/src/storybook'; +import { ErrorBoundary, ErrorBoundaryProvider } from '../..'; +import mdx from '../../README.mdx'; +import { ErrorBoundaryStorybookMock } from '../../mocks/src/storybook'; const storybookMock = new ErrorBoundaryStorybookMock(); diff --git a/packages/shared-ux/error_boundary/src/error_boundary.tsx b/packages/shared-ux/error_boundary/src/ui/error_boundary.tsx similarity index 92% rename from packages/shared-ux/error_boundary/src/error_boundary.tsx rename to packages/shared-ux/error_boundary/src/ui/error_boundary.tsx index e1b1071d266e4..2efed9c909f91 100644 --- a/packages/shared-ux/error_boundary/src/error_boundary.tsx +++ b/packages/shared-ux/error_boundary/src/ui/error_boundary.tsx @@ -9,9 +9,9 @@ import React from 'react'; import useObservable from 'react-use/lib/useObservable'; -import { ErrorBoundaryServices, Toasts } from '../types'; -import { useErrorBoundary } from './error_boundary_services'; -import { ErrorCallout, ErrorInline } from './toasts_service'; +import { ErrorBoundaryServices, Toasts } from '../../types'; +import { useErrorBoundary } from '../services/error_boundary_services'; +import { ErrorCallout, ErrorInline } from '../services/toasts_service'; interface ErrorBoundaryState { error: null | Error; diff --git a/packages/shared-ux/error_boundary/types.ts b/packages/shared-ux/error_boundary/types.ts index 77b1660d924a0..24655b94ed438 100644 --- a/packages/shared-ux/error_boundary/types.ts +++ b/packages/shared-ux/error_boundary/types.ts @@ -7,8 +7,8 @@ */ import { EuiGlobalToastListProps } from '@elastic/eui'; -import { ErrorService } from './src/error_service'; -import { ToastsService } from './src/toasts_service'; +import { ErrorService } from './src/services/error_service'; +import { ToastsService } from './src/services/toasts_service'; export interface ErrorBoundaryUIServices { reloadWindow: () => void;