Skip to content

Commit

Permalink
[Shared UX][packages] Move No Data Page components; model service com…
Browse files Browse the repository at this point in the history
…position (#133593)

* [Shared UX] Move No Data Page components to packages

* Fix type export.

* Fix Kibana dependency miss; exported type

* Address feedback; add docs

* More updates after merge

* Move comment

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
clintandrewhall and kibanamachine authored Jun 14, 2022
1 parent cde209b commit 8882a50
Show file tree
Hide file tree
Showing 41 changed files with 923 additions and 693 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
"@kbn/shared-ux-components": "link:bazel-bin/packages/kbn-shared-ux-components",
"@kbn/shared-ux-link-redirect-app": "link:bazel-bin/packages/shared-ux/link/redirect_app",
"@kbn/shared-ux-page-analytics-no-data": "link:bazel-bin/packages/shared-ux/page/analytics_no_data",
"@kbn/shared-ux-page-kibana-no-data": "link:bazel-bin/packages/shared-ux/page/kibana_no_data",
"@kbn/shared-ux-prompt-no-data-views": "link:bazel-bin/packages/shared-ux/prompt/no_data_views",
"@kbn/shared-ux-services": "link:bazel-bin/packages/kbn-shared-ux-services",
"@kbn/shared-ux-storybook": "link:bazel-bin/packages/kbn-shared-ux-storybook",
Expand Down Expand Up @@ -729,6 +730,7 @@
"@types/kbn__shared-ux-components": "link:bazel-bin/packages/kbn-shared-ux-components/npm_module_types",
"@types/kbn__shared-ux-link-redirect-app": "link:bazel-bin/packages/shared-ux/link/redirect_app/npm_module_types",
"@types/kbn__shared-ux-page-analytics-no-data": "link:bazel-bin/packages/shared-ux/page/analytics_no_data/npm_module_types",
"@types/kbn__shared-ux-page-kibana-no-data": "link:bazel-bin/packages/shared-ux/page/kibana_no_data/npm_module_types",
"@types/kbn__shared-ux-prompt-no-data-views": "link:bazel-bin/packages/shared-ux/prompt/no_data_views/npm_module_types",
"@types/kbn__shared-ux-services": "link:bazel-bin/packages/kbn-shared-ux-services/npm_module_types",
"@types/kbn__shared-ux-storybook": "link:bazel-bin/packages/kbn-shared-ux-storybook/npm_module_types",
Expand Down
2 changes: 2 additions & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ filegroup(
"//packages/shared-ux/button/exit_full_screen:build",
"//packages/shared-ux/link/redirect_app:build",
"//packages/shared-ux/page/analytics_no_data:build",
"//packages/shared-ux/page/kibana_no_data:build",
"//packages/shared-ux/prompt/no_data_views:build",
],
)
Expand Down Expand Up @@ -256,6 +257,7 @@ filegroup(
"//packages/shared-ux/button/exit_full_screen:build_types",
"//packages/shared-ux/link/redirect_app:build_types",
"//packages/shared-ux/page/analytics_no_data:build_types",
"//packages/shared-ux/page/kibana_no_data:build_types",
"//packages/shared-ux/prompt/no_data_views:build_types",
],
)
Expand Down

This file was deleted.

This file was deleted.

24 changes: 4 additions & 20 deletions packages/kbn-shared-ux-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,11 @@
* Side Public License, v 1.
*/

import React from 'react';
import { withSuspense } from '@kbn/shared-ux-utility';

export { ToolbarButton, IconButtonGroup, AddFromLibraryButton, ToolbarPopover } from './toolbar';
export { KibanaPageTemplateSolutionNav } from './page_template/solution_nav';
export type { KibanaPageTemplateProps } from './page_template';
export { KibanaPageTemplate } from './page_template';

/**
* A `KibanaNoDataPage` component, with service hooks. Consumers should use `React.Suspennse` or the
* `withSuspense` HOC to load this component.
*/
export const KibanaNoDataPageLazy = React.lazy(() =>
import('./empty_state').then(({ KibanaNoDataPage }) => ({
default: KibanaNoDataPage,
}))
);
// TODO: clintandrewhall - NoDataPageProps is a temporary addition until it is split into its own package
export type { KibanaPageTemplateProps, NoDataPageProps } from './page_template';

/**
* A `KibanaNoDataPage` component. The component is wrapped by the `withSuspense` HOC.
* This component can be used directly by consumers and will load the `KibanaNoDataPageLazy` lazily with
* a predefined fallback and error boundary.
*/
export const KibanaNoDataPage = withSuspense(KibanaNoDataPageLazy);
// TODO: clintandrewhall - NoDataConfigPage is a temporary addition until it is split into its own package
export { KibanaPageTemplate, NoDataConfigPage } from './page_template';
1 change: 1 addition & 0 deletions packages/kbn-shared-ux-services/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

export type { ServiceFactory, SharedUxServices, SharedUxServicesContext } from './types';
export type {
MockServicesFactoryParams,
SharedUxApplicationService,
SharedUxDocLinksService,
SharedUxEditorsService,
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-shared-ux-services/src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type { SharedUxHttpService } from './http';
export type { SharedUxUserPermissionsService } from './permissions';
export type { SharedUxPlatformService } from './platform';
export type { SharedUxDataService } from './data';
export type { MockServicesFactoryParams } from './mock';

export { mockServicesFactory, mockServiceFactories } from './mock';
export { stubServicesFactory, stubServiceFactories } from './stub';
10 changes: 3 additions & 7 deletions packages/shared-ux/page/analytics_no_data/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ NPM_MODULE_EXTRA_FILES = [
# eg. "@npm//lodash"
RUNTIME_DEPS = [
"@npm//react",
"@npm//rxjs",
"@npm//@testing-library",
"//packages/kbn-i18n",
"//packages/kbn-shared-ux-services",
"//packages/kbn-shared-ux-components",
"//packages/kbn-shared-ux-storybook"
"//packages/shared-ux/page/kibana_no_data",
]

# In this array place dependencies necessary to build the types, which will include the
Expand All @@ -60,9 +58,7 @@ TYPES_DEPS = [
"@npm//@types/jest",
"@npm//@types/react",
"//packages/kbn-i18n:npm_module_types",
"//packages/kbn-shared-ux-services:npm_module_types",
"//packages/kbn-shared-ux-storybook:npm_module_types",
"//packages/kbn-shared-ux-components:npm_module_types",
"//packages/shared-ux/page/kibana_no_data:npm_module_types",
"//packages/kbn-ambient-ui-types",
]

Expand Down
15 changes: 11 additions & 4 deletions packages/shared-ux/page/analytics_no_data/README.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
---
id: sharedUX/Components/AnalyticsNoDataPage
slug: /shared-ux/components/analytics-no-data-page
id: sharedUX/Page/AnalyticsNoDataPage
slug: /shared-ux/page/analytics-no-data-page
title: Analytics "No Data" Page
summary: An entire page that can be displayed when Kibana "has no data", specifically for Analytics.
tags: ['shared-ux', 'component']
date: 2021-12-28
---

## Description
This is an Analytics-specific version of `KibanaNoDataPage`, which defaults most of the fields appropriate for Analytics solutions.

This is an Analytics-specific version of `KibanaNoDataPage`, which defaults most of the fields to give a consistent set of terms for Analytics solutions.
## API

| Export | Description |
|---|---|
| `AnalyticsNoDataPageProvider` | Provides contextual services to `AnalyticsNoDataPage`. |
| `AnalyticsNoDataPageKibanaProvider` | Maps Kibana dependencies to provide contextual services to `AnalyticsNoDataPage`. |
| `AnalyticsNoDataPage` | Uses a `Provider` to access contextual services to populate props on the `AnalyticsNoDataPageComponent`. |
| `AnalyticsNoDataPageComponent` | The pure component. |

## EUI Promotion Status

Expand Down
Loading

0 comments on commit 8882a50

Please sign in to comment.