From 80ab0d9792fecb775a93b319a15c12a663134e50 Mon Sep 17 00:00:00 2001 From: MadameSheema Date: Mon, 15 Jun 2020 16:58:47 +0200 Subject: [PATCH 01/89] fixes 'Configures a new connector' flaky test (#69011) Co-authored-by: Elastic Machine --- .../cypress/integration/cases_connectors.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/cypress/integration/cases_connectors.spec.ts b/x-pack/plugins/security_solution/cypress/integration/cases_connectors.spec.ts index ae4bb82ebfee6..266d183ea1b85 100644 --- a/x-pack/plugins/security_solution/cypress/integration/cases_connectors.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/cases_connectors.spec.ts @@ -17,8 +17,7 @@ import { loginAndWaitForPageWithoutDateRange } from '../tasks/login'; import { CASES } from '../urls/navigation'; -// FLAKY: https://github.com/elastic/kibana/issues/65278 -describe.skip('Cases connectors', () => { +describe('Cases connectors', () => { before(() => { cy.server(); cy.route('POST', '**/api/actions/action').as('createConnector'); @@ -33,6 +32,7 @@ describe.skip('Cases connectors', () => { cy.wait('@createConnector').its('status').should('eql', 200); cy.get(TOASTER).should('have.text', "Created 'New connector'"); + cy.get(TOASTER).should('not.exist'); selectLastConnectorCreated(); From 3d0552e03ce1ff2112a7ca50555575c2cd828c1b Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 15 Jun 2020 17:13:31 +0200 Subject: [PATCH 02/89] Embed dashboard by value example & some embeddable clean up (#67783) Added example for using dashboard container by value 1.1 Refactored embeddable explorer e2e test to use new example, removed not needed kbn_tp_embeddable_explorer plugin. For embeddable explorer examples went away from using getFactoryById() to improve type checks There is new component a replacement for EmbeddableFactoryRenderer with slightly more flexible api: EmbeddableRenderer. 3.1 We can improve it going forward to support more use case --- .../dashboard_embeddable_examples/README.md | 1 + .../dashboard_embeddable_examples/kibana.json | 9 + .../public/app.tsx | 112 ++++++++++++ .../public/by_value/embeddable.tsx | 120 +++++++++++++ .../public/by_value/input_editor.tsx | 56 ++++++ .../public}/index.ts | 4 +- .../public/plugin.tsx | 64 +++++++ .../tsconfig.json | 15 ++ .../hello_world_embeddable_factory.ts | 4 +- examples/embeddable_examples/public/index.ts | 13 +- .../public/list_container/index.ts | 2 +- .../public/list_container/list_container.tsx | 2 +- .../list_container/list_container_factory.ts | 6 +- .../multi_task_todo_embeddable_factory.ts | 17 +- examples/embeddable_examples/public/plugin.ts | 69 +++++--- .../public/searchable_list_container/index.ts | 5 +- .../searchable_list_container_factory.ts | 9 +- .../public/todo/todo_embeddable_factory.tsx | 10 +- .../todo/todo_ref_embeddable_factory.tsx | 10 +- examples/embeddable_explorer/public/app.tsx | 33 ++-- .../public/embeddable_panel_example.tsx | 8 +- .../public/hello_world_embeddable_example.tsx | 36 ++-- .../public/list_container_example.tsx | 41 +++-- .../embeddable_explorer/public/plugin.tsx | 1 + .../public/todo_embeddable_example.tsx | 89 +++------- package.json | 1 + renovate.json5 | 8 + .../embeddable/dashboard_container.tsx | 2 +- .../dashboard_container_by_value_renderer.tsx | 37 ++-- .../dashboard_container_factory.tsx | 9 +- .../public/application/embeddable/index.ts | 7 +- src/plugins/dashboard/public/index.ts | 2 +- src/plugins/dashboard/public/plugin.tsx | 37 ++-- src/plugins/embeddable/README.md | 8 +- src/plugins/embeddable/docs/README.md | 5 + .../docs/containers_and_inherited_state.md | 33 ++++ src/plugins/embeddable/public/index.ts | 3 +- .../embeddable_factory_renderer.test.tsx | 71 -------- .../embeddable_factory_renderer.tsx | 80 --------- .../embeddables/embeddable_renderer.test.tsx | 56 ++++++ .../lib/embeddables/embeddable_renderer.tsx | 164 ++++++++++++++++++ .../lib/embeddables/embeddable_root.test.tsx | 9 + .../lib/embeddables/embeddable_root.tsx | 22 ++- .../public/lib/embeddables/index.ts | 2 +- src/plugins/embeddable/public/plugin.tsx | 30 +++- .../embeddable/public/tests/container.test.ts | 6 +- .../public/tests/explicit_input.test.ts | 7 +- test/examples/embeddables/adding_children.ts | 2 +- .../embeddables/dashboard.ts} | 70 ++++++-- test/examples/embeddables/index.ts | 1 + test/plugin_functional/config.js | 1 - .../kbn_tp_embeddable_explorer/README.md | 17 -- .../kbn_tp_embeddable_explorer/kibana.json | 16 -- .../kbn_tp_embeddable_explorer/package.json | 22 --- .../public/README.md | 21 --- .../public/app/app.tsx | 79 --------- .../app/dashboard_container_example.tsx | 102 ----------- .../public/embeddable_api.ts | 25 --- .../public/index.ts | 30 ---- .../public/plugin.tsx | 98 ----------- .../kbn_tp_embeddable_explorer/tsconfig.json | 20 --- .../test_suites/embeddable_explorer/index.js | 42 ----- .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - yarn.lock | 7 + 65 files changed, 1029 insertions(+), 861 deletions(-) create mode 100644 examples/dashboard_embeddable_examples/README.md create mode 100644 examples/dashboard_embeddable_examples/kibana.json create mode 100644 examples/dashboard_embeddable_examples/public/app.tsx create mode 100644 examples/dashboard_embeddable_examples/public/by_value/embeddable.tsx create mode 100644 examples/dashboard_embeddable_examples/public/by_value/input_editor.tsx rename {test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app => examples/dashboard_embeddable_examples/public}/index.ts (86%) create mode 100644 examples/dashboard_embeddable_examples/public/plugin.tsx create mode 100644 examples/dashboard_embeddable_examples/tsconfig.json rename test/plugin_functional/test_suites/embeddable_explorer/dashboard_container.js => src/plugins/dashboard/public/application/embeddable/dashboard_container_by_value_renderer.tsx (55%) create mode 100644 src/plugins/embeddable/docs/README.md create mode 100644 src/plugins/embeddable/docs/containers_and_inherited_state.md delete mode 100644 src/plugins/embeddable/public/lib/embeddables/embeddable_factory_renderer.test.tsx delete mode 100644 src/plugins/embeddable/public/lib/embeddables/embeddable_factory_renderer.tsx create mode 100644 src/plugins/embeddable/public/lib/embeddables/embeddable_renderer.test.tsx create mode 100644 src/plugins/embeddable/public/lib/embeddables/embeddable_renderer.tsx rename test/{plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/dashboard_input.ts => examples/embeddables/dashboard.ts} (56%) delete mode 100644 test/plugin_functional/plugins/kbn_tp_embeddable_explorer/README.md delete mode 100644 test/plugin_functional/plugins/kbn_tp_embeddable_explorer/kibana.json delete mode 100644 test/plugin_functional/plugins/kbn_tp_embeddable_explorer/package.json delete mode 100644 test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/README.md delete mode 100644 test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/app.tsx delete mode 100644 test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/dashboard_container_example.tsx delete mode 100644 test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/embeddable_api.ts delete mode 100644 test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/index.ts delete mode 100644 test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/plugin.tsx delete mode 100644 test/plugin_functional/plugins/kbn_tp_embeddable_explorer/tsconfig.json delete mode 100644 test/plugin_functional/test_suites/embeddable_explorer/index.js diff --git a/examples/dashboard_embeddable_examples/README.md b/examples/dashboard_embeddable_examples/README.md new file mode 100644 index 0000000000000..e1528e36f4c4b --- /dev/null +++ b/examples/dashboard_embeddable_examples/README.md @@ -0,0 +1 @@ +Example of using dashboard container embeddable outside of dashboard app diff --git a/examples/dashboard_embeddable_examples/kibana.json b/examples/dashboard_embeddable_examples/kibana.json new file mode 100644 index 0000000000000..bb2ced569edb5 --- /dev/null +++ b/examples/dashboard_embeddable_examples/kibana.json @@ -0,0 +1,9 @@ +{ + "id": "dashboardEmbeddableExamples", + "version": "0.0.1", + "kibanaVersion": "kibana", + "server": false, + "ui": true, + "requiredPlugins": ["embeddable", "embeddableExamples", "dashboard", "developerExamples"], + "optionalPlugins": [] +} diff --git a/examples/dashboard_embeddable_examples/public/app.tsx b/examples/dashboard_embeddable_examples/public/app.tsx new file mode 100644 index 0000000000000..b166b8444f080 --- /dev/null +++ b/examples/dashboard_embeddable_examples/public/app.tsx @@ -0,0 +1,112 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import ReactDOM from 'react-dom'; +import { BrowserRouter as Router, Route, RouteComponentProps, withRouter } from 'react-router-dom'; + +import { + EuiPage, + EuiPageContent, + EuiPageContentBody, + EuiPageSideBar, + EuiSideNav, +} from '@elastic/eui'; +import 'brace/mode/json'; +import { AppMountParameters } from '../../../src/core/public'; +import { DashboardEmbeddableByValue } from './by_value/embeddable'; +import { DashboardStart } from '../../../src/plugins/dashboard/public'; + +interface PageDef { + title: string; + id: string; + component: React.ReactNode; +} + +type NavProps = RouteComponentProps & { + pages: PageDef[]; +}; + +const Nav = withRouter(({ history, pages }: NavProps) => { + const navItems = pages.map((page) => ({ + id: page.id, + name: page.title, + onClick: () => history.push(`/${page.id}`), + 'data-test-subj': page.id, + })); + + return ( + + ); +}); + +interface Props { + basename: string; + DashboardContainerByValueRenderer: DashboardStart['DashboardContainerByValueRenderer']; +} + +const DashboardEmbeddableExplorerApp = ({ basename, DashboardContainerByValueRenderer }: Props) => { + const pages: PageDef[] = [ + { + title: 'By value dashboard embeddable', + id: 'dashboardEmbeddableByValue', + component: ( + + ), + }, + { + title: 'By ref dashboard embeddable', + id: 'dashboardEmbeddableByRef', + component:
TODO: Not implemented, but coming soon...
, + }, + ]; + + const routes = pages.map((page, i) => ( + page.component} /> + )); + + return ( + + + +