diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 01bf0bab05c2b..2a7a56a468ee6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,7 +5,6 @@ ## `node scripts/generate codeowners`. #### -examples/bfetch_explorer @elastic/appex-sharedux examples/content_management_examples @elastic/appex-sharedux examples/controls_example @elastic/kibana-presentation examples/data_view_field_editor_example @elastic/kibana-data-discovery @@ -2617,7 +2616,6 @@ x-pack/plugins/observability_solution/observability_shared/public/components/pro /test/examples/state_sync/*.ts @elastic/appex-sharedux /test/examples/error_boundary/index.ts @elastic/appex-sharedux /test/examples/content_management/*.ts @elastic/appex-sharedux -/test/examples/bfetch_explorer/*.ts @elastic/appex-sharedux /test/api_integration/apis/guided_onboarding @elastic/appex-sharedux /x-pack/test/banners_functional @elastic/appex-sharedux /x-pack/test/custom_branding @elastic/appex-sharedux diff --git a/examples/bfetch_explorer/README.md b/examples/bfetch_explorer/README.md deleted file mode 100644 index 33723e7cabe07..0000000000000 --- a/examples/bfetch_explorer/README.md +++ /dev/null @@ -1,11 +0,0 @@ -## bfetch explorer - -bfetch is a service that allows you to batch HTTP requests and stream responses -back. - -This example app demonstrates: - - How you can create a streaming response route and consume it from the - client - - How you can create a batch processing route and consume it from the client - -To run this example, use the command `yarn start --run-examples`. diff --git a/examples/bfetch_explorer/kibana.jsonc b/examples/bfetch_explorer/kibana.jsonc deleted file mode 100644 index dbcd5c3496355..0000000000000 --- a/examples/bfetch_explorer/kibana.jsonc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "plugin", - "id": "@kbn/bfetch-explorer-plugin", - "owner": "@elastic/appex-sharedux", - "plugin": { - "id": "bfetchExplorer", - "server": true, - "browser": true, - "requiredPlugins": [ - "bfetch", - "developerExamples" - ], - "requiredBundles": [ - "kibanaReact" - ] - } -} diff --git a/examples/bfetch_explorer/public/components/count_until/index.tsx b/examples/bfetch_explorer/public/components/count_until/index.tsx deleted file mode 100644 index 3708fcc78193e..0000000000000 --- a/examples/bfetch_explorer/public/components/count_until/index.tsx +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React, { useState } from 'react'; -import useMountedState from 'react-use/lib/useMountedState'; -import useList from 'react-use/lib/useList'; -import { EuiForm, EuiSpacer, EuiFieldNumber, EuiFormRow, EuiButton } from '@elastic/eui'; -import { BfetchPublicSetup } from '@kbn/bfetch-plugin/public'; - -export interface Props { - fetchStreaming: BfetchPublicSetup['fetchStreaming']; -} - -export const CountUntil: React.FC = ({ fetchStreaming }) => { - const isMounted = useMountedState(); - const [data, setData] = useState(5); - const [showingResults, setShowingResults] = useState(false); - const [results, { push: pushResult, clear: clearList }] = useList([]); - const [completed, setCompleted] = useState(false); - const [error, setError] = useState(null); - - const handleSubmit = () => { - setShowingResults(true); - const { stream } = fetchStreaming({ - url: '/bfetch_explorer/count', - body: JSON.stringify({ data }), - }); - stream.subscribe({ - next: (next: string) => { - if (!isMounted()) return; - pushResult(next); - }, - error: (nextError: any) => { - if (!isMounted()) return; - setError(nextError); - }, - complete: () => { - if (!isMounted()) return; - setCompleted(true); - }, - }); - }; - - const handleReset = () => { - setShowingResults(false); - clearList(); - setError(null); - setCompleted(false); - }; - - if (showingResults) { - return ( - -
{JSON.stringify(error || results, null, 4)}
- - - Reset - -
- ); - } - - return ( - - - setData(Number(e.target.value))} - /> - - - Start - - - ); -}; diff --git a/examples/bfetch_explorer/public/components/double_integers/index.tsx b/examples/bfetch_explorer/public/components/double_integers/index.tsx deleted file mode 100644 index cf71bde62f09e..0000000000000 --- a/examples/bfetch_explorer/public/components/double_integers/index.tsx +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React, { useState } from 'react'; -import useMountedState from 'react-use/lib/useMountedState'; -import useList from 'react-use/lib/useList'; -import useCounter from 'react-use/lib/useCounter'; -import { EuiForm, EuiSpacer, EuiTextArea, EuiFormRow, EuiButton } from '@elastic/eui'; -import { ExplorerService } from '../../plugin'; - -interface ResultItem { - num: number; - result?: { - num: number; - }; - error?: any; -} - -const defaultNumbers = [2000, 300, -1, 1000].join('\n'); - -export interface Props { - double: ExplorerService['double']; -} - -export const DoubleIntegers: React.FC = ({ double }) => { - const isMounted = useMountedState(); - const [numbers, setNumbers] = useState(defaultNumbers); - const [showingResults, setShowingResults] = useState(false); - const [numberOfResultsAwaiting, counter] = useCounter(0); - const [results, { push: pushResult, clear: clearList }] = useList([]); - - const handleSubmit = () => { - setShowingResults(true); - const nums = numbers - .split('\n') - .map((num) => num.trim()) - .filter(Boolean) - .map(Number); - counter.set(nums.length); - nums.forEach((num) => { - double({ num }).then( - (result) => { - if (!isMounted()) return; - counter.dec(); - pushResult({ num, result }); - }, - (error) => { - if (!isMounted()) return; - counter.dec(); - pushResult({ num, error }); - } - ); - }); - }; - - const handleReset = () => { - setShowingResults(false); - counter.reset(); - clearList(); - }; - - if (showingResults) { - return ( - -
{JSON.stringify(results, null, 4)}
- - - Reset - -
- ); - } - - return ( - - - setNumbers(e.target.value)} - /> - - - Send - - - ); -}; diff --git a/examples/bfetch_explorer/public/components/page/index.tsx b/examples/bfetch_explorer/public/components/page/index.tsx deleted file mode 100644 index 2d17f9ba23dae..0000000000000 --- a/examples/bfetch_explorer/public/components/page/index.tsx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React, { FC, PropsWithChildren } from 'react'; -import { EuiPageTemplate, EuiPageSection, EuiPageHeader } from '@elastic/eui'; - -export interface PageProps { - title?: React.ReactNode; - sidebar?: React.ReactNode; -} - -export const Page: FC> = ({ - title = 'Untitled', - sidebar, - children, -}) => { - return ( - - {sidebar} - - - - - {children} - - - ); -}; diff --git a/examples/bfetch_explorer/public/containers/app/index.tsx b/examples/bfetch_explorer/public/containers/app/index.tsx deleted file mode 100644 index 9ddd1b44e4354..0000000000000 --- a/examples/bfetch_explorer/public/containers/app/index.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React from 'react'; -import { Redirect } from 'react-router-dom'; -import { BrowserRouter as Router, Route, Routes } from '@kbn/shared-ux-router'; -import { EuiPage } from '@elastic/eui'; -import { useDeps } from '../../hooks/use_deps'; -import { routes } from '../../routes'; - -export const App: React.FC = () => { - const { appBasePath } = useDeps(); - - const routeElements: React.ReactElement[] = []; - for (const { items } of routes) { - for (const { id, component } of items) { - routeElements.push( component} />); - } - } - - return ( - - - - {routeElements} - - - - - ); -}; diff --git a/examples/bfetch_explorer/public/containers/app/pages/page_count_until/index.tsx b/examples/bfetch_explorer/public/containers/app/pages/page_count_until/index.tsx deleted file mode 100644 index fdd5de83bf058..0000000000000 --- a/examples/bfetch_explorer/public/containers/app/pages/page_count_until/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import * as React from 'react'; -import { EuiPanel, EuiText } from '@elastic/eui'; -import { CountUntil } from '../../../../components/count_until'; -import { Page } from '../../../../components/page'; -import { useDeps } from '../../../../hooks/use_deps'; -import { Sidebar } from '../../sidebar'; - -export const PageCountUntil = () => { - const { plugins } = useDeps(); - - return ( - }> - - This demo sends a single number N using fetchStreaming to the server. The - server will stream back N number of messages with 1 second delay each containing a number - from 1 to N, after which it will close the stream. - -
- - - -
- ); -}; diff --git a/examples/bfetch_explorer/public/containers/app/pages/page_double_integers/index.tsx b/examples/bfetch_explorer/public/containers/app/pages/page_double_integers/index.tsx deleted file mode 100644 index 4e6b1864c638d..0000000000000 --- a/examples/bfetch_explorer/public/containers/app/pages/page_double_integers/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import * as React from 'react'; -import { EuiPanel, EuiText } from '@elastic/eui'; -import { DoubleIntegers } from '../../../../components/double_integers'; -import { Page } from '../../../../components/page'; -import { useDeps } from '../../../../hooks/use_deps'; -import { Sidebar } from '../../sidebar'; - -export const PageDoubleIntegers = () => { - const { explorer } = useDeps(); - - return ( - }> - - Below is a list of numbers in milliseconds. They are sent as a batch to the server. For each - number server waits given number of milliseconds then doubles the number and streams it - back. - -
- - - -
- ); -}; diff --git a/examples/bfetch_explorer/public/containers/app/sidebar/index.tsx b/examples/bfetch_explorer/public/containers/app/sidebar/index.tsx deleted file mode 100644 index 784c8b5a7b1fa..0000000000000 --- a/examples/bfetch_explorer/public/containers/app/sidebar/index.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React from 'react'; -import { EuiSideNav } from '@elastic/eui'; -import { useHistory } from 'react-router-dom'; -import { routes } from '../../../routes'; - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -interface SidebarProps {} - -export const Sidebar: React.FC = () => { - const history = useHistory(); - - return ( - ({ - id, - name: title, - isSelected: true, - items: items.map((route) => ({ - id: route.id, - name: route.title, - onClick: () => history.push(`/${route.id}`), - 'data-test-subj': route.id, - })), - })), - }, - ]} - /> - ); -}; diff --git a/examples/bfetch_explorer/public/hooks/use_deps.ts b/examples/bfetch_explorer/public/hooks/use_deps.ts deleted file mode 100644 index a212525d00eff..0000000000000 --- a/examples/bfetch_explorer/public/hooks/use_deps.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { BfetchDeps } from '../mount'; - -export const useDeps = () => useKibana().services as unknown as BfetchDeps; diff --git a/examples/bfetch_explorer/public/index.ts b/examples/bfetch_explorer/public/index.ts deleted file mode 100644 index ebc736cca673b..0000000000000 --- a/examples/bfetch_explorer/public/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { BfetchExplorerPlugin } from './plugin'; - -export const plugin = () => new BfetchExplorerPlugin(); diff --git a/examples/bfetch_explorer/public/mount.tsx b/examples/bfetch_explorer/public/mount.tsx deleted file mode 100644 index 525f7b21078f0..0000000000000 --- a/examples/bfetch_explorer/public/mount.tsx +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import * as React from 'react'; -import { render, unmountComponentAtNode } from 'react-dom'; -import { CoreSetup, CoreStart, AppMountParameters } from '@kbn/core/public'; -import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; -import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; -import { BfetchExplorerStartPlugins, ExplorerService } from './plugin'; -import { App } from './containers/app'; - -export interface BfetchDeps { - appBasePath: string; - core: CoreStart; - plugins: BfetchExplorerStartPlugins; - explorer: ExplorerService; -} - -export const mount = - (coreSetup: CoreSetup, explorer: ExplorerService) => - async ({ appBasePath, element }: AppMountParameters) => { - const [core, plugins] = await coreSetup.getStartServices(); - const deps: BfetchDeps = { appBasePath, core, plugins, explorer }; - const reactElement = ( - - - - - - ); - render(reactElement, element); - return () => unmountComponentAtNode(element); - }; diff --git a/examples/bfetch_explorer/public/plugin.tsx b/examples/bfetch_explorer/public/plugin.tsx deleted file mode 100644 index 2840f016b5d2b..0000000000000 --- a/examples/bfetch_explorer/public/plugin.tsx +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { Plugin, CoreSetup } from '@kbn/core/public'; -import { BfetchPublicSetup, BfetchPublicStart } from '@kbn/bfetch-plugin/public'; -import { DeveloperExamplesSetup } from '@kbn/developer-examples-plugin/public'; -import { mount } from './mount'; - -export interface ExplorerService { - double: (number: { num: number }) => Promise<{ num: number }>; -} - -export interface BfetchExplorerSetupPlugins { - bfetch: BfetchPublicSetup; - developerExamples: DeveloperExamplesSetup; -} - -export interface BfetchExplorerStartPlugins { - bfetch: BfetchPublicStart; -} - -export class BfetchExplorerPlugin implements Plugin { - public setup( - core: CoreSetup, - { bfetch, developerExamples }: BfetchExplorerSetupPlugins - ) { - const double = bfetch.batchedFunction<{ num: number }, { num: number }>({ - url: '/bfetch_explorer/double', - }); - - const explorer: ExplorerService = { - double, - }; - - core.application.register({ - id: 'bfetch-explorer', - title: 'bfetch explorer', - visibleIn: [], - mount: mount(core, explorer), - }); - - developerExamples.register({ - appId: 'bfetch-explorer', - title: 'bfetch', - description: - 'bfetch is a service that allows to batch HTTP requests and streams responses back.', - links: [ - { - label: 'README', - href: 'https://github.com/elastic/kibana/blob/main/src/plugins/bfetch/README.md', - iconType: 'logoGithub', - size: 's', - target: '_blank', - }, - ], - }); - } - - public start() {} - public stop() {} -} diff --git a/examples/bfetch_explorer/public/routes.tsx b/examples/bfetch_explorer/public/routes.tsx deleted file mode 100644 index 69ae6a8e94bbb..0000000000000 --- a/examples/bfetch_explorer/public/routes.tsx +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React from 'react'; -import { PageDoubleIntegers } from './containers/app/pages/page_double_integers'; -import { PageCountUntil } from './containers/app/pages/page_count_until'; - -interface RouteSectionDef { - title: string; - id: string; - items: RouteDef[]; -} - -interface RouteDef { - title: string; - id: string; - component: React.ReactNode; -} - -export const routes: RouteSectionDef[] = [ - { - title: 'fetchStreaming', - id: 'fetchStreaming', - items: [ - { - title: 'Count until', - id: 'count-until', - component: , - }, - ], - }, - { - title: 'batchedFunction', - id: 'batchedFunction', - items: [ - { - title: 'Double integers', - id: 'double-integers', - component: , - }, - ], - }, -]; diff --git a/examples/bfetch_explorer/server/index.ts b/examples/bfetch_explorer/server/index.ts deleted file mode 100644 index ef09a9627b139..0000000000000 --- a/examples/bfetch_explorer/server/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -export const plugin = async () => { - const { BfetchExplorerPlugin } = await import('./plugin'); - return new BfetchExplorerPlugin(); -}; diff --git a/examples/bfetch_explorer/server/plugin.ts b/examples/bfetch_explorer/server/plugin.ts deleted file mode 100644 index 41dd5ab4f4601..0000000000000 --- a/examples/bfetch_explorer/server/plugin.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { Subject } from 'rxjs'; -import { Plugin, CoreSetup, CoreStart } from '@kbn/core/server'; -import { BfetchServerSetup, BfetchServerStart } from '@kbn/bfetch-plugin/server'; - -export interface BfetchExplorerSetupPlugins { - bfetch: BfetchServerSetup; -} - -export interface BfetchExplorerStartPlugins { - bfetch: BfetchServerStart; -} - -export class BfetchExplorerPlugin implements Plugin { - public setup(core: CoreSetup, plugins: BfetchExplorerSetupPlugins) { - plugins.bfetch.addStreamingResponseRoute('/bfetch_explorer/count', () => ({ - getResponseStream: ({ data }: any) => { - const subject = new Subject(); - const countTo = Number(data); - for (let cnt = 1; cnt <= countTo; cnt++) { - setTimeout(() => { - subject.next(String(cnt)); - }, cnt * 1000); - } - setTimeout(() => { - subject.complete(); - }, countTo * 1000); - return subject; - }, - })); - - plugins.bfetch.addBatchProcessingRoute<{ num: number }, { num: number }>( - '/bfetch_explorer/double', - () => ({ - onBatchItem: async ({ num }) => { - // Validate inputs. - if (num < 0) throw new Error('Invalid number'); - // Wait number of specified milliseconds. - await new Promise((r) => setTimeout(r, num)); - // Double the number and send it back. - return { num: 2 * num }; - }, - }) - ); - } - - public start(core: CoreStart, plugins: BfetchExplorerStartPlugins) {} - - public stop() {} -} diff --git a/examples/bfetch_explorer/tsconfig.json b/examples/bfetch_explorer/tsconfig.json deleted file mode 100644 index c8417c734f58d..0000000000000 --- a/examples/bfetch_explorer/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "target/types", - }, - "include": [ - "index.ts", - "public/**/*.ts", - "public/**/*.tsx", - "server/**/*.ts", - "../../typings/**/*", - ], - "exclude": [ - "target/**/*", - ], - "kbn_references": [ - "@kbn/core", - "@kbn/developer-examples-plugin", - "@kbn/bfetch-plugin", - "@kbn/kibana-react-plugin", - "@kbn/shared-ux-router", - "@kbn/react-kibana-context-render", - ] -} diff --git a/package.json b/package.json index 200f385866858..ee2a594236eac 100644 --- a/package.json +++ b/package.json @@ -197,7 +197,6 @@ "@kbn/avc-banner": "link:src/platform/packages/shared/kbn-avc-banner", "@kbn/banners-plugin": "link:x-pack/plugins/banners", "@kbn/bfetch-error": "link:packages/kbn-bfetch-error", - "@kbn/bfetch-explorer-plugin": "link:examples/bfetch_explorer", "@kbn/bfetch-plugin": "link:src/plugins/bfetch", "@kbn/calculate-auto": "link:packages/kbn-calculate-auto", "@kbn/calculate-width-from-char-count": "link:packages/kbn-calculate-width-from-char-count", diff --git a/test/examples/bfetch_explorer/batched_function.ts b/test/examples/bfetch_explorer/batched_function.ts deleted file mode 100644 index 35b4123befc44..0000000000000 --- a/test/examples/bfetch_explorer/batched_function.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../functional/ftr_provider_context'; - -// eslint-disable-next-line import/no-default-export -export default function ({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - - describe('batchedFunction', () => { - beforeEach(async () => { - await testSubjects.click('count-until'); - await testSubjects.click('double-integers'); - }); - - it('executes all requests in a batch', async () => { - const form = await testSubjects.find('DoubleIntegers'); - const btn = await form.findByCssSelector('button'); - await btn.click(); - await new Promise((r) => setTimeout(r, 4000)); - const pre = await form.findByCssSelector('pre'); - const text = await pre.getVisibleText(); - const json = JSON.parse(text); - - expect(json).to.eql([ - { - num: -1, - error: { - message: 'Invalid number', - }, - }, - { - num: 300, - result: { - num: 600, - }, - }, - { - num: 1000, - result: { - num: 2000, - }, - }, - { - num: 2000, - result: { - num: 4000, - }, - }, - ]); - }); - - it('streams results back', async () => { - const form = await testSubjects.find('DoubleIntegers'); - const btn = await form.findByCssSelector('button'); - await btn.click(); - - await new Promise((r) => setTimeout(r, 500)); - const pre = await form.findByCssSelector('pre'); - - const text1 = await pre.getVisibleText(); - const json1 = JSON.parse(text1); - - expect(json1.length > 0).to.be(true); - expect(json1.length < 4).to.be(true); - - await new Promise((r) => setTimeout(r, 3500)); - - const text2 = await pre.getVisibleText(); - const json2 = JSON.parse(text2); - - expect(json2.length).to.be(4); - }); - }); -} diff --git a/test/examples/bfetch_explorer/index.ts b/test/examples/bfetch_explorer/index.ts deleted file mode 100644 index 19e7cb6f0a0a4..0000000000000 --- a/test/examples/bfetch_explorer/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the "Elastic License - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { FtrProviderContext } from '../../functional/ftr_provider_context'; - -// eslint-disable-next-line import/no-default-export -export default function ({ getService, getPageObjects, loadTestFile }: FtrProviderContext) { - const browser = getService('browser'); - const PageObjects = getPageObjects(['common', 'header']); - - describe('bfetch explorer', function () { - before(async () => { - await browser.setWindowSize(1300, 900); - await PageObjects.common.navigateToApp('bfetch-explorer', { insertTimestamp: false }); - }); - - loadTestFile(require.resolve('./batched_function')); - }); -} diff --git a/test/examples/config.js b/test/examples/config.js index cb1dd9dc308e8..7a3f9c4dfd265 100644 --- a/test/examples/config.js +++ b/test/examples/config.js @@ -19,7 +19,6 @@ export default async function ({ readConfigFile }) { rootTags: ['runOutsideOfCiGroups'], testFiles: [ require.resolve('./hello_world'), - require.resolve('./bfetch_explorer'), require.resolve('./ui_actions'), require.resolve('./state_sync'), require.resolve('./routing'), diff --git a/tsconfig.base.json b/tsconfig.base.json index 90f70f7b6605b..654e4c9e22357 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -118,8 +118,6 @@ "@kbn/bazel-runner/*": ["packages/kbn-bazel-runner/*"], "@kbn/bfetch-error": ["packages/kbn-bfetch-error"], "@kbn/bfetch-error/*": ["packages/kbn-bfetch-error/*"], - "@kbn/bfetch-explorer-plugin": ["examples/bfetch_explorer"], - "@kbn/bfetch-explorer-plugin/*": ["examples/bfetch_explorer/*"], "@kbn/bfetch-plugin": ["src/plugins/bfetch"], "@kbn/bfetch-plugin/*": ["src/plugins/bfetch/*"], "@kbn/calculate-auto": ["packages/kbn-calculate-auto"], diff --git a/yarn.lock b/yarn.lock index c282e3da6b5a9..a2ae508ba2ee2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4053,10 +4053,6 @@ version "0.0.0" uid "" -"@kbn/bfetch-explorer-plugin@link:examples/bfetch_explorer": - version "0.0.0" - uid "" - "@kbn/bfetch-plugin@link:src/plugins/bfetch": version "0.0.0" uid ""