diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a9af160d02084..accc99170bb70 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -26,7 +26,7 @@ /src/plugins/kibana_legacy/ @elastic/kibana-app /src/plugins/timelion/ @elastic/kibana-app /src/plugins/dev_tools/ @elastic/kibana-app -/src/plugins/dashboard_embeddable_container/ @elastic/kibana-app +/src/plugins/dashboard/ @elastic/kibana-app # App Architecture /packages/kbn-interpreter/ @elastic/kibana-app-arch diff --git a/.i18nrc.json b/.i18nrc.json index 6874d02304e49..07878ed3c15fb 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -3,7 +3,7 @@ "common.ui": "src/legacy/ui", "console": "src/plugins/console", "core": "src/core", - "dashboardEmbeddableContainer": "src/plugins/dashboard_embeddable_container", + "dashboard": "src/plugins/dashboard", "data": [ "src/legacy/core_plugins/data", "src/plugins/data" diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/index.ts b/src/legacy/core_plugins/dashboard_embeddable_container/index.ts deleted file mode 100644 index 4a609225e6d7f..0000000000000 --- a/src/legacy/core_plugins/dashboard_embeddable_container/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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. - */ - -// eslint-disable-next-line import/no-default-export -export default function(kibana: any) { - return new kibana.Plugin({}); -} diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/package.json b/src/legacy/core_plugins/dashboard_embeddable_container/package.json deleted file mode 100644 index 7555895e8d71b..0000000000000 --- a/src/legacy/core_plugins/dashboard_embeddable_container/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "dashboard_embeddable_container", - "version": "kibana" -} diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/public/initialize.ts b/src/legacy/core_plugins/dashboard_embeddable_container/public/initialize.ts deleted file mode 100644 index 9880b336e76e5..0000000000000 --- a/src/legacy/core_plugins/dashboard_embeddable_container/public/initialize.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/index.ts b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/index.ts deleted file mode 100644 index d8c0de2bce3f4..0000000000000 --- a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ - -export * from '../../../../../../plugins/dashboard_embeddable_container/public'; diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/legacy.ts b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/legacy.ts deleted file mode 100644 index 9880b336e76e5..0000000000000 --- a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/legacy.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ diff --git a/src/legacy/core_plugins/kibana/public/dashboard/migrations/migrate_to_730_panels.test.ts b/src/legacy/core_plugins/kibana/public/dashboard/migrations/migrate_to_730_panels.test.ts index ad4feacde0815..2189b53ac81ee 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/migrations/migrate_to_730_panels.test.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/migrations/migrate_to_730_panels.test.ts @@ -48,7 +48,7 @@ import { import { DEFAULT_PANEL_WIDTH, DEFAULT_PANEL_HEIGHT, -} from '../../../../dashboard_embeddable_container/public/np_ready/public'; +} from '../../../../../../plugins/dashboard/public'; test('6.0 migrates uiState, sort, scales, and gridData', async () => { const uiState = { diff --git a/src/legacy/core_plugins/kibana/public/dashboard/migrations/migrate_to_730_panels.ts b/src/legacy/core_plugins/kibana/public/dashboard/migrations/migrate_to_730_panels.ts index b0d20b4482728..6b037fa63cf68 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/migrations/migrate_to_730_panels.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/migrations/migrate_to_730_panels.ts @@ -18,7 +18,7 @@ */ import { i18n } from '@kbn/i18n'; import semver from 'semver'; -import { GridData } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public'; +import { GridData } from 'src/plugins/dashboard/public'; import uuid from 'uuid'; import { @@ -113,7 +113,7 @@ function migratePre61PanelToLatest( ? PANEL_HEIGHT_SCALE_FACTOR_WITH_MARGINS : PANEL_HEIGHT_SCALE_FACTOR; - // These are snapshotted here instead of imported form dashboard_embeddable_container because + // These are snapshotted here instead of imported from dashboard because // this function is called from both client and server side, and having an import from a public // folder will cause errors for the server side version. Also, this is only run for the point in time // from panels created in < 7.3 so maybe using a snapshot of the default values when this migration was diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx index af3347afa9c5f..54436b8d785a0 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx +++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx @@ -51,7 +51,7 @@ import { DashboardContainerFactory, DashboardContainerInput, DashboardPanelState, -} from '../../../../dashboard_embeddable_container/public/np_ready/public'; +} from '../../../../../../plugins/dashboard/public'; import { EmbeddableFactoryNotFoundError, ErrorEmbeddable, diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_state_manager.ts b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_state_manager.ts index fe7beafcad18c..f29721e3c3d5c 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_state_manager.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_state_manager.ts @@ -23,7 +23,7 @@ import { Observable, Subscription } from 'rxjs'; import { Moment } from 'moment'; import { History } from 'history'; -import { DashboardContainer } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public'; +import { DashboardContainer } from 'src/plugins/dashboard/public'; import { ViewMode } from '../../../../../../plugins/embeddable/public'; import { migrateLegacyQuery } from '../legacy_imports'; import { diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/embeddable_saved_object_converters.test.ts b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/embeddable_saved_object_converters.test.ts index 3f04cad4f322b..b2a2f43b9152d 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/embeddable_saved_object_converters.test.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/embeddable_saved_object_converters.test.ts @@ -23,7 +23,7 @@ import { convertPanelStateToSavedDashboardPanel, } from './embeddable_saved_object_converters'; import { SavedDashboardPanel } from '../types'; -import { DashboardPanelState } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public'; +import { DashboardPanelState } from 'src/plugins/dashboard/public'; import { EmbeddableInput } from 'src/legacy/core_plugins/embeddable_api/public/np_ready/public'; interface CustomInput extends EmbeddableInput { diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/embeddable_saved_object_converters.ts b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/embeddable_saved_object_converters.ts index 2d42609e1e25f..7d5a378885470 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/embeddable_saved_object_converters.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/embeddable_saved_object_converters.ts @@ -17,7 +17,7 @@ * under the License. */ import { omit } from 'lodash'; -import { DashboardPanelState } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public'; +import { DashboardPanelState } from 'src/plugins/dashboard/public'; import { SavedDashboardPanel } from '../types'; export function convertSavedDashboardPanelToPanelState( diff --git a/src/plugins/dashboard_embeddable_container/kibana.json b/src/plugins/dashboard/kibana.json similarity index 81% rename from src/plugins/dashboard_embeddable_container/kibana.json rename to src/plugins/dashboard/kibana.json index 70e37ea6a6d7d..e5a657555819a 100644 --- a/src/plugins/dashboard_embeddable_container/kibana.json +++ b/src/plugins/dashboard/kibana.json @@ -1,5 +1,5 @@ { - "id": "dashboard_embeddable_container", + "id": "dashboard", "version": "kibana", "requiredPlugins": [ "data", diff --git a/src/plugins/dashboard_embeddable_container/public/actions/expand_panel_action.test.tsx b/src/plugins/dashboard/public/actions/expand_panel_action.test.tsx similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/actions/expand_panel_action.test.tsx rename to src/plugins/dashboard/public/actions/expand_panel_action.test.tsx diff --git a/src/plugins/dashboard_embeddable_container/public/actions/expand_panel_action.tsx b/src/plugins/dashboard/public/actions/expand_panel_action.tsx similarity index 87% rename from src/plugins/dashboard_embeddable_container/public/actions/expand_panel_action.tsx rename to src/plugins/dashboard/public/actions/expand_panel_action.tsx index cf245178306d5..27d4078411564 100644 --- a/src/plugins/dashboard_embeddable_container/public/actions/expand_panel_action.tsx +++ b/src/plugins/dashboard/public/actions/expand_panel_action.tsx @@ -53,18 +53,12 @@ export class ExpandPanelAction implements ActionByType { } this.lastToast = this.props.notifications.toasts.addSuccess({ - title: i18n.translate( - 'dashboardEmbeddableContainer.addPanel.savedObjectAddedToContainerSuccessMessageTitle', - { - defaultMessage: '{savedObjectName} was added', - values: { - savedObjectName: name, - }, - } - ), + title: i18n.translate('dashboard.addPanel.savedObjectAddedToContainerSuccessMessageTitle', { + defaultMessage: '{savedObjectName} was added', + values: { + savedObjectName: name, + }, + }), 'data-test-subj': 'addObjectToContainerSuccess', }); }; @@ -97,12 +94,9 @@ export class ReplacePanelFlyout extends React.Component { const SavedObjectFinder = this.props.savedObjectsFinder; const savedObjectsFinder = ( diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_constants.ts b/src/plugins/dashboard/public/embeddable/dashboard_constants.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_constants.ts rename to src/plugins/dashboard/public/embeddable/dashboard_constants.ts diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.test.tsx b/src/plugins/dashboard/public/embeddable/dashboard_container.test.tsx similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.test.tsx rename to src/plugins/dashboard/public/embeddable/dashboard_container.test.tsx diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.tsx b/src/plugins/dashboard/public/embeddable/dashboard_container.tsx similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.tsx rename to src/plugins/dashboard/public/embeddable/dashboard_container.tsx diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container_factory.tsx b/src/plugins/dashboard/public/embeddable/dashboard_container_factory.tsx similarity index 97% rename from src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container_factory.tsx rename to src/plugins/dashboard/public/embeddable/dashboard_container_factory.tsx index d08fcfef3529e..a358e41f7b507 100644 --- a/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container_factory.tsx +++ b/src/plugins/dashboard/public/embeddable/dashboard_container_factory.tsx @@ -65,7 +65,7 @@ export class DashboardContainerFactory extends EmbeddableFactory< } public getDisplayName() { - return i18n.translate('dashboardEmbeddableContainer.factory.displayName', { + return i18n.translate('dashboard.factory.displayName', { defaultMessage: 'dashboard', }); } diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/_dashboard_grid.scss b/src/plugins/dashboard/public/embeddable/grid/_dashboard_grid.scss similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/grid/_dashboard_grid.scss rename to src/plugins/dashboard/public/embeddable/grid/_dashboard_grid.scss diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/_index.scss b/src/plugins/dashboard/public/embeddable/grid/_index.scss similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/grid/_index.scss rename to src/plugins/dashboard/public/embeddable/grid/_index.scss diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.test.tsx b/src/plugins/dashboard/public/embeddable/grid/dashboard_grid.test.tsx similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.test.tsx rename to src/plugins/dashboard/public/embeddable/grid/dashboard_grid.test.tsx diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.tsx b/src/plugins/dashboard/public/embeddable/grid/dashboard_grid.tsx similarity index 99% rename from src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.tsx rename to src/plugins/dashboard/public/embeddable/grid/dashboard_grid.tsx index 40db43427339d..3f1f1056cf1b4 100644 --- a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.tsx +++ b/src/plugins/dashboard/public/embeddable/grid/dashboard_grid.tsx @@ -164,7 +164,7 @@ class DashboardGridUi extends React.Component { isLayoutInvalid = true; this.props.kibana.notifications.toasts.danger({ title: this.props.intl.formatMessage({ - id: 'dashboardEmbeddableContainer.dashboardGrid.toast.unableToLoadDashboardDangerMessage', + id: 'dashboard.dashboardGrid.toast.unableToLoadDashboardDangerMessage', defaultMessage: 'Unable to load dashboard.', }), body: error.message, diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/index.ts b/src/plugins/dashboard/public/embeddable/grid/index.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/grid/index.ts rename to src/plugins/dashboard/public/embeddable/grid/index.ts diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/index.ts b/src/plugins/dashboard/public/embeddable/index.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/index.ts rename to src/plugins/dashboard/public/embeddable/index.ts diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/panel/_dashboard_panel.scss b/src/plugins/dashboard/public/embeddable/panel/_dashboard_panel.scss similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/panel/_dashboard_panel.scss rename to src/plugins/dashboard/public/embeddable/panel/_dashboard_panel.scss diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/panel/_index.scss b/src/plugins/dashboard/public/embeddable/panel/_index.scss similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/panel/_index.scss rename to src/plugins/dashboard/public/embeddable/panel/_index.scss diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/panel/create_panel_state.test.ts b/src/plugins/dashboard/public/embeddable/panel/create_panel_state.test.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/panel/create_panel_state.test.ts rename to src/plugins/dashboard/public/embeddable/panel/create_panel_state.test.ts diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/panel/create_panel_state.ts b/src/plugins/dashboard/public/embeddable/panel/create_panel_state.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/panel/create_panel_state.ts rename to src/plugins/dashboard/public/embeddable/panel/create_panel_state.ts diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/panel/index.ts b/src/plugins/dashboard/public/embeddable/panel/index.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/panel/index.ts rename to src/plugins/dashboard/public/embeddable/panel/index.ts diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/types.ts b/src/plugins/dashboard/public/embeddable/types.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/types.ts rename to src/plugins/dashboard/public/embeddable/types.ts diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/viewport/_dashboard_viewport.scss b/src/plugins/dashboard/public/embeddable/viewport/_dashboard_viewport.scss similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/viewport/_dashboard_viewport.scss rename to src/plugins/dashboard/public/embeddable/viewport/_dashboard_viewport.scss diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/viewport/_index.scss b/src/plugins/dashboard/public/embeddable/viewport/_index.scss similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/viewport/_index.scss rename to src/plugins/dashboard/public/embeddable/viewport/_index.scss diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/viewport/dashboard_viewport.test.tsx b/src/plugins/dashboard/public/embeddable/viewport/dashboard_viewport.test.tsx similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/viewport/dashboard_viewport.test.tsx rename to src/plugins/dashboard/public/embeddable/viewport/dashboard_viewport.test.tsx diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/viewport/dashboard_viewport.tsx b/src/plugins/dashboard/public/embeddable/viewport/dashboard_viewport.tsx similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable/viewport/dashboard_viewport.tsx rename to src/plugins/dashboard/public/embeddable/viewport/dashboard_viewport.tsx diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable_plugin.ts b/src/plugins/dashboard/public/embeddable_plugin.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable_plugin.ts rename to src/plugins/dashboard/public/embeddable_plugin.ts diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable_plugin_test_samples.ts b/src/plugins/dashboard/public/embeddable_plugin_test_samples.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/embeddable_plugin_test_samples.ts rename to src/plugins/dashboard/public/embeddable_plugin_test_samples.ts diff --git a/src/plugins/dashboard_embeddable_container/public/index.scss b/src/plugins/dashboard/public/index.scss similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/index.scss rename to src/plugins/dashboard/public/index.scss diff --git a/src/plugins/dashboard_embeddable_container/public/index.ts b/src/plugins/dashboard/public/index.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/index.ts rename to src/plugins/dashboard/public/index.ts diff --git a/src/plugins/dashboard_embeddable_container/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/plugin.tsx rename to src/plugins/dashboard/public/plugin.tsx diff --git a/src/plugins/dashboard_embeddable_container/public/test_helpers/get_sample_dashboard_input.ts b/src/plugins/dashboard/public/test_helpers/get_sample_dashboard_input.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/test_helpers/get_sample_dashboard_input.ts rename to src/plugins/dashboard/public/test_helpers/get_sample_dashboard_input.ts diff --git a/src/plugins/dashboard_embeddable_container/public/test_helpers/index.ts b/src/plugins/dashboard/public/test_helpers/index.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/test_helpers/index.ts rename to src/plugins/dashboard/public/test_helpers/index.ts diff --git a/src/plugins/dashboard_embeddable_container/public/tests/dashboard_container.test.tsx b/src/plugins/dashboard/public/tests/dashboard_container.test.tsx similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/tests/dashboard_container.test.tsx rename to src/plugins/dashboard/public/tests/dashboard_container.test.tsx diff --git a/src/plugins/dashboard_embeddable_container/public/types.ts b/src/plugins/dashboard/public/types.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/types.ts rename to src/plugins/dashboard/public/types.ts diff --git a/src/plugins/dashboard_embeddable_container/public/ui_actions_plugin.ts b/src/plugins/dashboard/public/ui_actions_plugin.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/ui_actions_plugin.ts rename to src/plugins/dashboard/public/ui_actions_plugin.ts diff --git a/src/plugins/dashboard_embeddable_container/public/url_generator.test.ts b/src/plugins/dashboard/public/url_generator.test.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/url_generator.test.ts rename to src/plugins/dashboard/public/url_generator.test.ts diff --git a/src/plugins/dashboard_embeddable_container/public/url_generator.ts b/src/plugins/dashboard/public/url_generator.ts similarity index 100% rename from src/plugins/dashboard_embeddable_container/public/url_generator.ts rename to src/plugins/dashboard/public/url_generator.ts diff --git a/test/functional/apps/dashboard/dashboard_state.js b/test/functional/apps/dashboard/dashboard_state.js index b9172990c501d..a643a9ee40aa2 100644 --- a/test/functional/apps/dashboard/dashboard_state.js +++ b/test/functional/apps/dashboard/dashboard_state.js @@ -24,7 +24,7 @@ import { PIE_CHART_VIS_NAME, AREA_CHART_VIS_NAME } from '../../page_objects/dash // eslint-disable-next-line import { DEFAULT_PANEL_WIDTH -} from '../../../../src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_constants'; +} from '../../../../src/plugins/dashboard/public/embeddable/dashboard_constants'; export default function({ getService, getPageObjects }) { const PageObjects = getPageObjects([ diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/index.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/index.ts index dfce45671483f..99f54277be5d2 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/index.ts +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/index.ts @@ -29,7 +29,6 @@ export default function(kibana: any) { order: 1, main: 'plugins/kbn_tp_embeddable_explorer/np_ready/public/legacy', }, - hacks: ['plugins/dashboard_embeddable_container/initialize'], }, init(server: Legacy.Server) { server.injectUiAppVars('kbn_tp_embeddable_explorer', async () => diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx index df0c00fb48b2e..7cc9c1df1c948 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx @@ -30,7 +30,7 @@ import { DASHBOARD_CONTAINER_TYPE, DashboardContainer, DashboardContainerFactory, -} from '../../../../../../../../src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public'; +} from '../../../../../../../../src/plugins/dashboard/public'; import { CoreStart } from '../../../../../../../../src/core/public'; import { dashboardInput } from './dashboard_input'; diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts index 3c8468a3d8ed3..bb8951680be35 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts @@ -18,7 +18,7 @@ */ import { ViewMode, CONTACT_CARD_EMBEDDABLE, HELLO_WORLD_EMBEDDABLE } from '../embeddable_api'; -import { DashboardContainerInput } from '../../../../../../../../src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public'; +import { DashboardContainerInput } from '../../../../../../../../src/plugins/dashboard/public'; export const dashboardInput: DashboardContainerInput = { panels: { diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx index d636f8b1f4d52..ae6b06b10fd1d 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx @@ -63,7 +63,7 @@ function getLayoutOptions( ): cytoscape.LayoutOptions { return { name: 'breadthfirst', - roots: selectedRoots, + roots: selectedRoots.length ? selectedRoots : undefined, fit: true, padding: nodeHeight, spacingFactor: 0.85, @@ -111,18 +111,28 @@ export function Cytoscape({ const dataHandler = useCallback( event => { if (cy) { + cy.edges().removeClass('highlight'); + + if (serviceName) { + const focusedNode = cy.getElementById(serviceName); + focusedNode.connectedEdges().addClass('highlight'); + } + // Add the "primary" class to the node if its id matches the serviceName. if (cy.nodes().length > 0 && serviceName) { cy.nodes().removeClass('primary'); cy.getElementById(serviceName).addClass('primary'); } - if (event.cy.elements().length > 0) { const selectedRoots = selectRoots(event.cy); const layout = cy.layout( getLayoutOptions(selectedRoots, height, width) ); layout.one('layoutstop', () => { + if (serviceName) { + const focusedNode = cy.getElementById(serviceName); + cy.center(focusedNode); + } // show elements after layout is applied cy.elements().removeClass('invisible'); }); diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.tsx index a8c45c83a382a..8041554756adc 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/Buttons.tsx @@ -11,30 +11,29 @@ import { i18n } from '@kbn/i18n'; import React, { MouseEvent } from 'react'; import { useUrlParams } from '../../../../hooks/useUrlParams'; import { getAPMHref } from '../../../shared/Links/apm/APMLink'; +import { APMQueryParams } from '../../../shared/Links/url_helpers'; interface ButtonsProps { - focusedServiceName?: string; onFocusClick?: (event: MouseEvent) => void; selectedNodeServiceName: string; } export function Buttons({ - focusedServiceName, onFocusClick = () => {}, selectedNodeServiceName }: ButtonsProps) { - const currentSearch = useUrlParams().urlParams.kuery ?? ''; + const urlParams = useUrlParams().urlParams as APMQueryParams; const detailsUrl = getAPMHref( `/services/${selectedNodeServiceName}/transactions`, - currentSearch + '', + urlParams ); const focusUrl = getAPMHref( `/services/${selectedNodeServiceName}/service-map`, - currentSearch + '', + urlParams ); - const isAlreadyFocused = focusedServiceName === selectedNodeServiceName; - return ( <> @@ -45,19 +44,7 @@ export function Buttons({ - + {i18n.translate('xpack.apm.serviceMap.focusMapButtonText', { defaultMessage: 'Focus map' })} diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/Contents.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/Contents.tsx index 405bd855898b7..7db064632a7f1 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/Contents.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/Contents.tsx @@ -19,7 +19,6 @@ import { ServiceMetricFetcher } from './ServiceMetricFetcher'; const popoverMinWidth = 280; interface ContentsProps { - focusedServiceName?: string; isService: boolean; label: string; onFocusClick: () => void; @@ -29,7 +28,6 @@ interface ContentsProps { export function Contents({ selectedNodeData, - focusedServiceName, isService, label, onFocusClick, @@ -60,7 +58,6 @@ export function Contents({ {isService && ( diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/index.tsx index 377496f370667..f9dc4d4b14aab 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/index.tsx @@ -85,6 +85,14 @@ export function Popover({ focusedServiceName }: PopoverProps) { } }, [popoverRef, x, y]); + const centerSelectedNode = useCallback(() => { + if (cy) { + cy.center(cy.getElementById(selectedNodeServiceName)); + } + }, [cy, selectedNodeServiceName]); + + const isAlreadyFocused = focusedServiceName === selectedNodeServiceName; + return ( ); diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/cytoscapeOptions.ts b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/cytoscapeOptions.ts index 1a2feb5a097e5..87008d8790788 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/cytoscapeOptions.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/cytoscapeOptions.ts @@ -13,6 +13,10 @@ export const animationOptions: cytoscape.AnimationOptions = { easing: theme.euiAnimSlightBounce }; const lineColor = '#C5CCD7'; +const zIndexNode = 200; +const zIndexEdge = 100; +const zIndexEdgeHighlight = 110; +const zIndexEdgeHover = 120; export const nodeHeight = parseInt(theme.avatarSizing.l.size, 10); function isService(el: cytoscape.NodeSingular) { @@ -62,7 +66,8 @@ const style: cytoscape.Stylesheet[] = [ 'text-max-width': '200px', 'text-valign': 'bottom', 'text-wrap': 'ellipsis', - width: theme.avatarSizing.l.size + width: theme.avatarSizing.l.size, + 'z-index': zIndexNode } }, { @@ -81,7 +86,8 @@ const style: cytoscape.Stylesheet[] = [ // @ts-ignore 'target-distance-from-node': theme.paddingSizes.xs, width: 1, - 'source-arrow-shape': 'none' + 'source-arrow-shape': 'none', + 'z-index': zIndexEdge } }, { @@ -103,7 +109,9 @@ const style: cytoscape.Stylesheet[] = [ { selector: 'edge.nodeHover', style: { - width: 4 + width: 4, + // @ts-ignore + 'z-index': zIndexEdgeHover } }, { @@ -111,6 +119,17 @@ const style: cytoscape.Stylesheet[] = [ style: { 'border-width': 4 } + }, + { + selector: 'edge.highlight', + style: { + width: 2, + 'line-color': theme.euiColorPrimary, + 'source-arrow-color': theme.euiColorPrimary, + 'target-arrow-color': theme.euiColorPrimary, + // @ts-ignore + 'z-index': zIndexEdgeHighlight + } } ]; diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js index da95ff1ac17fd..c147617140a5d 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js @@ -10,7 +10,7 @@ import rison from 'rison-node'; import url from 'url'; import { npStart } from 'ui/new_platform'; -import { DASHBOARD_APP_URL_GENERATOR } from '../../../../../../../../../src/plugins/dashboard_embeddable_container/public'; +import { DASHBOARD_APP_URL_GENERATOR } from '../../../../../../../../../src/plugins/dashboard/public'; import { ML_RESULTS_INDEX_PATTERN } from '../../../../../common/constants/index_patterns'; import { getPartitioningFieldNames } from '../../../../../common/util/job_utils'; diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx index 308487c601a69..cec51f570f95d 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx @@ -18,6 +18,7 @@ import { appStoreFactory } from './store'; import { AlertIndex } from './view/alerts'; import { ManagementList } from './view/managing'; import { PolicyList } from './view/policy'; +import { PolicyDetails } from './view/policy'; import { HeaderNavigation } from './components/header_nav'; /** @@ -70,6 +71,7 @@ const AppRoot: React.FunctionComponent = React.memo( + ( globalState.policyList, policyListMiddlewareFactory(coreStart, depsStart) ), + substateMiddlewareFactory( + globalState => globalState.policyDetails, + policyDetailsMiddlewareFactory(coreStart, depsStart) + ), substateMiddlewareFactory( globalState => globalState.alertList, alertMiddlewareFactory(coreStart, depsStart) diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/action.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/action.ts new file mode 100644 index 0000000000000..cf875e01a6fde --- /dev/null +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/action.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { PolicyData } from '../../types'; + +interface ServerReturnedPolicyDetailsData { + type: 'serverReturnedPolicyDetailsData'; + payload: { + policyItem: PolicyData | undefined; + }; +} + +export type PolicyDetailsAction = ServerReturnedPolicyDetailsData; diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/index.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/index.ts new file mode 100644 index 0000000000000..39f0f13d2daa2 --- /dev/null +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { policyDetailsMiddlewareFactory } from './middleware'; +export { PolicyDetailsAction } from './action'; +export { policyDetailsReducer } from './reducer'; diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/middleware.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/middleware.ts new file mode 100644 index 0000000000000..92a1c036c0211 --- /dev/null +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/middleware.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { MiddlewareFactory, PolicyDetailsState } from '../../types'; +import { selectPolicyIdFromParams, isOnPolicyDetailsPage } from './selectors'; + +export const policyDetailsMiddlewareFactory: MiddlewareFactory = coreStart => { + return ({ getState, dispatch }) => next => async action => { + next(action); + const state = getState(); + + if (action.type === 'userChangedUrl' && isOnPolicyDetailsPage(state)) { + const id = selectPolicyIdFromParams(state); + + const { getFakeDatasourceDetailsApiResponse } = await import('../policy_list/fake_data'); + const policyItem = await getFakeDatasourceDetailsApiResponse(id); + + dispatch({ + type: 'serverReturnedPolicyDetailsData', + payload: { + policyItem, + }, + }); + } + }; +}; diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/reducer.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/reducer.ts new file mode 100644 index 0000000000000..1d37e4aa24b65 --- /dev/null +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/reducer.ts @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Reducer } from 'redux'; +import { PolicyDetailsState } from '../../types'; +import { AppAction } from '../action'; + +const initialPolicyDetailsState = (): PolicyDetailsState => { + return { + policyItem: { + name: '', + total: 0, + pending: 0, + failed: 0, + id: '', + created_by: '', + created: '', + updated_by: '', + updated: '', + }, + isLoading: false, + }; +}; + +export const policyDetailsReducer: Reducer = ( + state = initialPolicyDetailsState(), + action +) => { + if (action.type === 'serverReturnedPolicyDetailsData') { + return { + ...state, + ...action.payload, + isLoading: false, + }; + } + + if (action.type === 'userChangedUrl') { + return { + ...state, + location: action.payload, + }; + } + + return state; +}; diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/selectors.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/selectors.ts new file mode 100644 index 0000000000000..a08130d0f4b30 --- /dev/null +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/selectors.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { createSelector } from 'reselect'; +import { PolicyDetailsState } from '../../types'; + +export const selectPolicyDetails = (state: PolicyDetailsState) => state.policyItem; + +export const isOnPolicyDetailsPage = (state: PolicyDetailsState) => { + if (state.location) { + const pathnameParts = state.location.pathname.split('/'); + return pathnameParts[1] === 'policy' && pathnameParts[2]; + } else { + return false; + } +}; + +export const selectPolicyIdFromParams: (state: PolicyDetailsState) => string = createSelector( + (state: PolicyDetailsState) => state.location, + (location: PolicyDetailsState['location']) => { + if (location) { + return location.pathname.split('/')[2]; + } + return ''; + } +); diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_list/fake_data.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_list/fake_data.ts index 62bdd28f30be1..2312d3397f7be 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_list/fake_data.ts +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/policy_list/fake_data.ts @@ -29,25 +29,35 @@ const getRandomNumber = () => { return randomNumbers[randomIndex]; }; +const policyItem = (id: string) => { + return { + name: `policy with some protections ${id}`, + total: getRandomNumber(), + pending: getRandomNumber(), + failed: getRandomNumber(), + id: `${id}`, + created_by: `admin ABC`, + created: getRandomDateIsoString(), + updated_by: 'admin 123', + updated: getRandomDateIsoString(), + }; +}; + export const getFakeDatasourceApiResponse = async (page: number, pageSize: number) => { await new Promise(resolve => setTimeout(resolve, 500)); // Emulates the API response - see PR: // https://github.com/elastic/kibana/pull/56567/files#diff-431549a8739efe0c56763f164c32caeeR25 return { - items: Array.from({ length: pageSize }, (x, i) => ({ - name: `policy with some protections ${i + 1}`, - total: getRandomNumber(), - pending: getRandomNumber(), - failed: getRandomNumber(), - created_by: `admin ABC`, - created: getRandomDateIsoString(), - updated_by: 'admin 123', - updated: getRandomDateIsoString(), - })), + items: Array.from({ length: pageSize }, (x, i) => policyItem(`${i + 1}`)), success: true, total: pageSize * 10, page, perPage: pageSize, }; }; + +export const getFakeDatasourceDetailsApiResponse = async (id: string) => { + await new Promise(resolve => setTimeout(resolve, 500)); + return policyItem(id); +}; diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/reducer.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/reducer.ts index 3d9d21c0da9c3..e655a8d5e46db 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/store/reducer.ts +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/reducer.ts @@ -9,9 +9,11 @@ import { AppAction } from './action'; import { alertListReducer } from './alerts'; import { GlobalState } from '../types'; import { policyListReducer } from './policy_list'; +import { policyDetailsReducer } from './policy_details'; export const appReducer: Reducer = combineReducers({ managementList: managementListReducer, alertList: alertListReducer, policyList: policyListReducer, + policyDetails: policyDetailsReducer, }); diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/types.ts b/x-pack/plugins/endpoint/public/applications/endpoint/types.ts index 3b70a580436fe..91be6e4936dbe 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/types.ts +++ b/x-pack/plugins/endpoint/public/applications/endpoint/types.ts @@ -56,6 +56,7 @@ export interface PolicyData { total: number; pending: number; failed: number; + id: string; created_by: string; created: string; updated_by: string; @@ -78,10 +79,23 @@ export interface PolicyListState { isLoading: boolean; } +/** + * Policy list store state + */ +export interface PolicyDetailsState { + /** A single policy item */ + policyItem: PolicyData | undefined; + /** data is being retrieved from server */ + isLoading: boolean; + /** current location of the application */ + location?: Immutable; +} + export interface GlobalState { readonly managementList: ManagementListState; readonly alertList: AlertListState; readonly policyList: PolicyListState; + readonly policyDetails: PolicyDetailsState; } /** diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/index.ts b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/index.ts index d561da7574de0..9c227ca81a426 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/index.ts +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/index.ts @@ -5,3 +5,4 @@ */ export * from './policy_list'; +export * from './policy_details'; diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_details.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_details.tsx new file mode 100644 index 0000000000000..bdbd323eaab72 --- /dev/null +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_details.tsx @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { EuiTitle } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { usePolicyDetailsSelector } from './policy_hooks'; +import { selectPolicyDetails } from '../../store/policy_details/selectors'; + +export const PolicyDetails = React.memo(() => { + const policyItem = usePolicyDetailsSelector(selectPolicyDetails); + + function policyName() { + if (policyItem) { + return {policyItem.name}; + } else { + return ( + + + + ); + } + } + + return ( + +

{policyName()}

+
+ ); +}); diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_hooks.ts b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_hooks.ts index 14558fb6504bb..5bfce15d680bf 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_hooks.ts +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_hooks.ts @@ -5,8 +5,14 @@ */ import { useSelector } from 'react-redux'; -import { GlobalState, PolicyListState } from '../../types'; +import { GlobalState, PolicyListState, PolicyDetailsState } from '../../types'; export function usePolicyListSelector(selector: (state: PolicyListState) => TSelected) { return useSelector((state: GlobalState) => selector(state.policyList)); } + +export function usePolicyDetailsSelector( + selector: (state: PolicyDetailsState) => TSelected +) { + return useSelector((state: GlobalState) => selector(state.policyDetails)); +} diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_list.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_list.tsx index 75ffa5e8806e9..cf573da3703cc 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_list.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_list.tsx @@ -17,6 +17,7 @@ import { EuiText, EuiTableFieldDataColumnType, EuiToolTip, + EuiLink, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { @@ -28,6 +29,7 @@ import { } from '@kbn/i18n/react'; import { useDispatch } from 'react-redux'; import styled from 'styled-components'; +import { useHistory } from 'react-router-dom'; import { usePageId } from '../use_page_id'; import { selectIsLoading, @@ -70,6 +72,25 @@ const FormattedDateAndTime: React.FC<{ date: Date }> = ({ date }) => { ); }; +const PolicyLink: React.FC<{ name: string; route: string }> = ({ name, route }) => { + const history = useHistory(); + + return ( + { + event.preventDefault(); + history.push(route); + }} + > + {name} + + ); +}; + +const renderPolicyNameLink = (value: string, _item: PolicyData) => { + return ; +}; + const renderDate = (date: string, _item: PolicyData) => ( @@ -124,6 +145,7 @@ export const PolicyList = React.memo(() => { name: i18n.translate('xpack.endpoint.policyList.nameField', { defaultMessage: 'Policy Name', }), + render: renderPolicyNameLink, truncateText: true, }, { diff --git a/x-pack/plugins/ingest_manager/server/services/api_keys/index.ts b/x-pack/plugins/ingest_manager/server/services/api_keys/index.ts index 6482c2a045a17..a7c74f279d169 100644 --- a/x-pack/plugins/ingest_manager/server/services/api_keys/index.ts +++ b/x-pack/plugins/ingest_manager/server/services/api_keys/index.ts @@ -22,8 +22,8 @@ export async function generateOutputApiKey( cluster: ['monitor'], index: [ { - names: ['logs-*', 'metrics-*'], - privileges: ['write'], + names: ['logs-*', 'metrics-*', 'events-*', 'metricbeat*'], + privileges: ['write', 'create_index'], }, ], }, diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 4ea5d6708b8cd..7b7692e9f2756 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -621,10 +621,10 @@ "core.ui.overlays.banner.attentionTitle": "注意", "core.ui.overlays.banner.closeButtonLabel": "閉じる", "core.ui.recentLinks.linkItem.screenReaderLabel": "{recentlyAccessedItemLinklabel}、タイプ: {pageType}", - "dashboardEmbeddableContainer.actions.toggleExpandPanelMenuItem.expandedDisplayName": "最小化", - "dashboardEmbeddableContainer.actions.toggleExpandPanelMenuItem.notExpandedDisplayName": "全画面", - "dashboardEmbeddableContainer.dashboardGrid.toast.unableToLoadDashboardDangerMessage": "ダッシュボードが読み込めません。", - "dashboardEmbeddableContainer.factory.displayName": "ダッシュボード", + "dashboard.actions.toggleExpandPanelMenuItem.expandedDisplayName": "最小化", + "dashboard.actions.toggleExpandPanelMenuItem.notExpandedDisplayName": "全画面", + "dashboard.dashboardGrid.toast.unableToLoadDashboardDangerMessage": "ダッシュボードが読み込めません。", + "dashboard.factory.displayName": "ダッシュボード", "embeddableApi.actions.applyFilterActionTitle": "現在のビューにフィルターを適用", "embeddableApi.addPanel.createNewDefaultOption": "新規作成...", "embeddableApi.addPanel.displayName": "パネルの追加", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 7dd4a876d580d..1dce461aadf78 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -621,10 +621,10 @@ "core.ui.overlays.banner.attentionTitle": "注意", "core.ui.overlays.banner.closeButtonLabel": "关闭", "core.ui.recentLinks.linkItem.screenReaderLabel": "{recentlyAccessedItemLinklabel},类型:{pageType}", - "dashboardEmbeddableContainer.actions.toggleExpandPanelMenuItem.expandedDisplayName": "最小化", - "dashboardEmbeddableContainer.actions.toggleExpandPanelMenuItem.notExpandedDisplayName": "全屏", - "dashboardEmbeddableContainer.dashboardGrid.toast.unableToLoadDashboardDangerMessage": "无法加载仪表板。", - "dashboardEmbeddableContainer.factory.displayName": "仪表板", + "dashboard.actions.toggleExpandPanelMenuItem.expandedDisplayName": "最小化", + "dashboard.actions.toggleExpandPanelMenuItem.notExpandedDisplayName": "全屏", + "dashboard.dashboardGrid.toast.unableToLoadDashboardDangerMessage": "无法加载仪表板。", + "dashboard.factory.displayName": "仪表板", "embeddableApi.actions.applyFilterActionTitle": "将筛选应用于当前视图", "embeddableApi.addPanel.createNewDefaultOption": "创建新的......", "embeddableApi.addPanel.displayName": "添加面板", diff --git a/x-pack/test/functional/apps/endpoint/index.ts b/x-pack/test/functional/apps/endpoint/index.ts index 0c9179c23ea6c..c6a7f723bfa2d 100644 --- a/x-pack/test/functional/apps/endpoint/index.ts +++ b/x-pack/test/functional/apps/endpoint/index.ts @@ -14,6 +14,7 @@ export default function({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./header_nav')); loadTestFile(require.resolve('./management')); loadTestFile(require.resolve('./policy_list')); + loadTestFile(require.resolve('./policy_details')); loadTestFile(require.resolve('./alert_list')); }); } diff --git a/x-pack/test/functional/apps/endpoint/policy_details.ts b/x-pack/test/functional/apps/endpoint/policy_details.ts new file mode 100644 index 0000000000000..39b6e7a9f4fb7 --- /dev/null +++ b/x-pack/test/functional/apps/endpoint/policy_details.ts @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export default function({ getPageObjects, getService }: FtrProviderContext) { + const pageObjects = getPageObjects(['common', 'endpoint']); + const testSubjects = getService('testSubjects'); + + describe('Endpoint Policy Details', function() { + this.tags(['ciGroup7']); + + it('loads the Policy Details Page', async () => { + await pageObjects.common.navigateToUrlWithBrowserHistory('endpoint', '/policy/123'); + await testSubjects.existOrFail('policyDetailsViewTitle'); + + const policyDetailsNotFoundTitle = await testSubjects.getVisibleText('policyDetailsName'); + expect(policyDetailsNotFoundTitle).to.equal('policy with some protections 123'); + }); + }); +}