From d2883da5d57aeca211d0edd6061665138aa92215 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Wed, 8 Jan 2020 09:07:27 -0500
Subject: [PATCH 01/21] moves
---
.../privilege_matrix.tsx | 2 +-
.../privilege_space_table.tsx | 2 +-
.../space_selector.tsx | 2 +-
.../spaces_popover_list.tsx | 2 +-
x-pack/legacy/plugins/spaces/public/legacy.ts | 22 -------------------
x-pack/plugins/spaces/kibana.json | 2 +-
.../spaces/public/__mocks__/xpack_info.ts | 0
.../advanced_settings_service.test.tsx | 0
.../advanced_settings_service.tsx | 0
.../advanced_settings_subtitle.test.tsx | 0
.../advanced_settings_subtitle.tsx | 0
.../advanced_settings_subtitle/index.ts | 0
.../advanced_settings_title.test.tsx | 0
.../advanced_settings_title.tsx | 0
.../advanced_settings_title/index.ts | 0
.../advanced_settings/components/index.ts | 0
.../spaces/public/advanced_settings/index.ts | 0
.../plugins/spaces/public/constants.ts | 6 ++---
.../copy_saved_objects_to_space/_index.scss | 0
.../components/_copy_to_space.scss | 0
.../components/_index.scss | 0
.../components/copy_status_indicator.tsx | 0
.../copy_status_summary_indicator.tsx | 0
.../components/copy_to_space_flyout.test.tsx | 0
.../components/copy_to_space_flyout.tsx | 0
.../copy_to_space_flyout_footer.tsx | 0
.../components/copy_to_space_form.tsx | 0
.../components/index.ts | 0
.../components/processing_copy_to_space.tsx | 0
.../components/selectable_spaces_control.tsx | 0
.../components/space_result.tsx | 0
.../components/space_result_details.tsx | 0
.../copy_saved_objects_to_space_action.tsx | 0
...opy_saved_objects_to_space_service.test.ts | 0
.../copy_saved_objects_to_space_service.ts | 0
.../copy_saved_objects_to_space/index.ts | 0
.../summarize_copy_result.test.ts | 0
.../summarize_copy_result.ts | 0
.../copy_saved_objects_to_space/types.ts | 0
.../public/create_feature_catalogue_entry.ts | 0
.../plugins/spaces/public/index.ts | 2 +-
.../spaces/public/management/_index.scss | 0
.../confirm_delete_modal.test.tsx.snap | 0
.../_confirm_delete_modal.scss | 0
.../confirm_delete_modal.test.tsx | 0
.../confirm_delete_modal.tsx | 0
.../components/confirm_delete_modal/index.ts | 0
.../public/management/components/index.ts | 0
.../secure_space_message.test.tsx.snap | 0
.../components/secure_space_message/index.ts | 0
.../secure_space_message.test.tsx | 0
.../secure_space_message.tsx | 0
.../unauthorized_prompt.test.tsx.snap | 0
.../components/unauthorized_prompt/index.ts | 0
.../unauthorized_prompt.test.tsx | 0
.../unauthorized_prompt.tsx | 0
.../delete_spaces_button.test.tsx.snap | 0
...irm_alter_active_space_modal.test.tsx.snap | 0
.../confirm_alter_active_space_modal.test.tsx | 0
.../confirm_alter_active_space_modal.tsx | 0
.../confirm_alter_active_space_modal/index.ts | 0
.../customize_space_avatar.test.tsx.snap | 0
.../space_identifier.test.tsx.snap | 0
.../customize_space/customize_space.tsx | 0
.../customize_space_avatar.test.tsx | 0
.../customize_space_avatar.tsx | 0
.../edit_space/customize_space/index.ts | 0
.../customize_space/space_identifier.test.tsx | 0
.../customize_space/space_identifier.tsx | 0
.../edit_space/delete_spaces_button.test.tsx | 0
.../edit_space/delete_spaces_button.tsx | 0
.../enabled_features.test.tsx.snap | 0
.../edit_space/enabled_features/_index.scss | 0
.../enabled_features.test.tsx | 0
.../enabled_features/enabled_features.tsx | 0
.../enabled_features/feature_table.tsx | 0
.../edit_space/enabled_features/index.ts | 0
.../enabled_features/toggle_all_features.tsx | 0
.../public/management/edit_space/index.ts | 0
.../edit_space/manage_space_page.test.tsx | 0
.../edit_space/manage_space_page.tsx | 0
.../edit_space/reserved_space_badge.test.tsx | 0
.../edit_space/reserved_space_badge.tsx | 0
.../__snapshots__/section_panel.test.tsx.snap | 0
.../section_panel/_section_panel.scss | 0
.../edit_space/section_panel/index.ts | 0
.../section_panel/section_panel.test.tsx | 0
.../section_panel/section_panel.tsx | 0
.../plugins/spaces/public/management/index.ts | 0
.../management/lib/feature_utils.test.ts | 0
.../public/management/lib/feature_utils.ts | 0
.../spaces/public/management/lib/index.ts | 0
.../lib/space_identifier_utils.test.ts | 0
.../management/lib/space_identifier_utils.ts | 0
.../management/lib/validate_space.test.ts | 0
.../public/management/lib/validate_space.ts | 0
.../management/management_service.test.ts | 0
.../public/management/management_service.ts | 0
.../spaces_grid_pages.test.tsx.snap | 0
.../public/management/spaces_grid/index.ts | 0
.../spaces_grid/spaces_grid_page.tsx | 0
.../spaces_grid/spaces_grid_pages.test.tsx | 0
.../spaces/public/management/template.html | 0
.../nav_control_popover.test.tsx.snap | 0
.../spaces/public/nav_control/_index.scss | 0
.../public/nav_control/_nav_control.scss | 0
.../manage_spaces_button.test.tsx.snap | 0
.../spaces_description.test.tsx.snap | 0
.../public/nav_control/components/_index.scss | 0
.../components/_spaces_description.scss | 0
.../nav_control/components/_spaces_menu.scss | 0
.../components/manage_spaces_button.test.tsx | 0
.../components/manage_spaces_button.tsx | 0
.../components/spaces_description.test.tsx | 0
.../components/spaces_description.tsx | 0
.../nav_control/components/spaces_menu.tsx | 0
.../spaces/public/nav_control/index.ts | 0
.../spaces/public/nav_control/nav_control.tsx | 0
.../nav_control/nav_control_popover.test.tsx | 0
.../nav_control/nav_control_popover.tsx | 0
.../spaces/public/nav_control/types.tsx | 0
.../plugins/spaces/public/plugin.tsx | 0
.../__snapshots__/space_avatar.test.tsx.snap | 0
.../spaces/public/space_avatar/index.ts | 0
.../space_avatar/space_attributes.test.ts | 0
.../public/space_avatar/space_attributes.ts | 0
.../public/space_avatar/space_avatar.test.tsx | 0
.../public/space_avatar/space_avatar.tsx | 0
.../space_selector.test.tsx.snap | 0
.../spaces/public/space_selector/_index.scss | 0
.../space_selector/_space_selector.scss | 0
.../space_selector/components/_index.scss | 0
.../components/_space_card.scss | 0
.../components/_space_cards.scss | 0
.../public/space_selector/components/index.ts | 0
.../components/space_card.test.tsx | 0
.../space_selector/components/space_card.tsx | 0
.../components/space_cards.test.tsx | 0
.../space_selector/components/space_cards.tsx | 0
.../spaces/public/space_selector/index.tsx | 0
.../public/space_selector/space_selector.html | 0
.../space_selector/space_selector.test.tsx | 0
.../public/space_selector/space_selector.tsx | 0
.../spaces/public/spaces_manager/index.ts | 0
.../spaces/public/spaces_manager/mocks.ts | 0
.../spaces_manager/spaces_manager.mock.ts | 0
.../spaces_manager/spaces_manager.test.ts | 0
.../public/spaces_manager/spaces_manager.ts | 0
148 files changed, 9 insertions(+), 31 deletions(-)
rename x-pack/{legacy => }/plugins/spaces/public/__mocks__/xpack_info.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/advanced_settings/components/advanced_settings_title/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/advanced_settings/components/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/advanced_settings/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/constants.ts (78%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/_index.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/_copy_to_space.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/_index.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/copy_status_indicator.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/copy_status_summary_indicator.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_form.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/processing_copy_to_space.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/selectable_spaces_control.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/space_result.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_action.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.test.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/copy_saved_objects_to_space/types.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/create_feature_catalogue_entry.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/index.ts (78%)
rename x-pack/{legacy => }/plugins/spaces/public/management/_index.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/confirm_delete_modal/__snapshots__/confirm_delete_modal.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/confirm_delete_modal/_confirm_delete_modal.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/confirm_delete_modal/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/secure_space_message/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/secure_space_message/secure_space_message.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/secure_space_message/secure_space_message.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/unauthorized_prompt/__snapshots__/unauthorized_prompt.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/unauthorized_prompt/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/__snapshots__/delete_spaces_button.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/__snapshots__/confirm_alter_active_space_modal.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/customize_space_avatar.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/space_identifier.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/customize_space/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/customize_space/space_identifier.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/customize_space/space_identifier.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/delete_spaces_button.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/enabled_features/__snapshots__/enabled_features.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/enabled_features/_index.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/enabled_features/feature_table.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/enabled_features/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/enabled_features/toggle_all_features.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/manage_space_page.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/reserved_space_badge.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/section_panel/__snapshots__/section_panel.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/section_panel/_section_panel.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/section_panel/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/lib/feature_utils.test.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/lib/feature_utils.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/lib/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/lib/space_identifier_utils.test.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/lib/space_identifier_utils.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/lib/validate_space.test.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/lib/validate_space.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/management_service.test.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/management_service.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/spaces_grid/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/spaces_grid/spaces_grid_page.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/management/template.html (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/_index.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/_nav_control.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/components/__snapshots__/manage_spaces_button.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/components/__snapshots__/spaces_description.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/components/_index.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/components/_spaces_description.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/components/_spaces_menu.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/components/manage_spaces_button.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/components/spaces_description.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/components/spaces_description.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/components/spaces_menu.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/nav_control.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/nav_control_popover.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/nav_control_popover.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/nav_control/types.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/plugin.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_avatar/__snapshots__/space_avatar.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_avatar/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_avatar/space_attributes.test.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_avatar/space_attributes.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_avatar/space_avatar.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_avatar/space_avatar.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/__snapshots__/space_selector.test.tsx.snap (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/_index.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/_space_selector.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/components/_index.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/components/_space_card.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/components/_space_cards.scss (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/components/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/components/space_card.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/components/space_card.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/components/space_cards.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/components/space_cards.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/index.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/space_selector.html (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/space_selector.test.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/space_selector/space_selector.tsx (100%)
rename x-pack/{legacy => }/plugins/spaces/public/spaces_manager/index.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/spaces_manager/mocks.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/spaces_manager/spaces_manager.mock.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/spaces_manager/spaces_manager.test.ts (100%)
rename x-pack/{legacy => }/plugins/spaces/public/spaces_manager/spaces_manager.ts (100%)
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx
index 962487312c83d..e44ce1836fdaa 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx
@@ -22,8 +22,8 @@ import {
} from '@elastic/eui';
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import React, { Component, Fragment } from 'react';
+import { SpaceAvatar } from '../../../../../../../../../../../plugins/spaces/public';
import { Space } from '../../../../../../../../../spaces/common/model/space';
-import { SpaceAvatar } from '../../../../../../../../../spaces/public/space_avatar';
import { Feature } from '../../../../../../../../../../../plugins/features/public';
import { FeaturesPrivileges, Role } from '../../../../../../../../common/model';
import { CalculatedPrivilege } from '../../../../../../../lib/kibana_privilege_calculator';
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
index 65a3df9fb47a1..44f42280437cb 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
@@ -14,7 +14,7 @@ import {
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import _ from 'lodash';
import React, { Component } from 'react';
-import { getSpaceColor } from '../../../../../../../../../spaces/public/space_avatar';
+import { getSpaceColor } from '../../../../../../../../../../../plugins/spaces/public';
import { Space } from '../../../../../../../../../spaces/common/model/space';
import {
FeaturesPrivileges,
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_selector.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_selector.tsx
index 0eb9cf0b0ee9d..84d2e9e2f9f8d 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_selector.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_selector.tsx
@@ -7,8 +7,8 @@
import { EuiComboBox, EuiComboBoxOptionProps, EuiHealth, EuiHighlight } from '@elastic/eui';
import { InjectedIntl } from '@kbn/i18n/react';
import React, { Component } from 'react';
+import { getSpaceColor } from '../../../../../../../../../../../plugins/spaces/public';
import { Space } from '../../../../../../../../../spaces/common/model/space';
-import { getSpaceColor } from '../../../../../../../../../spaces/public/space_avatar';
const spaceToOption = (space?: Space, currentSelection?: 'global' | 'spaces') => {
if (!space) {
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/spaces_popover_list/spaces_popover_list.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/spaces_popover_list/spaces_popover_list.tsx
index a99e389044eaa..e44eb1c36b120 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/spaces_popover_list/spaces_popover_list.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/spaces_popover_list/spaces_popover_list.tsx
@@ -14,7 +14,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import React, { Component } from 'react';
-import { SpaceAvatar } from '../../../../../../../spaces/public/space_avatar';
+import { SpaceAvatar } from '../../../../../../../../../plugins/spaces/public';
import { SPACE_SEARCH_COUNT_THRESHOLD } from '../../../../../../../../../plugins/spaces/common/constants';
import { Space } from '../../../../../../../../../plugins/spaces/common/model/space';
diff --git a/x-pack/legacy/plugins/spaces/public/legacy.ts b/x-pack/legacy/plugins/spaces/public/legacy.ts
index 1dffbd2661714..c0fc625994c2c 100644
--- a/x-pack/legacy/plugins/spaces/public/legacy.ts
+++ b/x-pack/legacy/plugins/spaces/public/legacy.ts
@@ -4,26 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { registerSettingsComponent } from 'ui/management';
-import { npSetup, npStart } from 'ui/new_platform';
-import { setup as managementSetup } from '../../../../../src/legacy/core_plugins/management/public/legacy';
-import { plugin } from '.';
-import { SpacesPlugin, PluginsSetup, PluginsStart } from './plugin';
import './management/legacy_page_routes';
-
-const spacesPlugin: SpacesPlugin = plugin();
-
-const pluginsSetup: PluginsSetup = {
- home: npSetup.plugins.home,
- management: managementSetup,
- __managementLegacyCompat: {
- registerSettingsComponent,
- },
-};
-
-const pluginsStart: PluginsStart = {
- management: npStart.plugins.management,
-};
-
-export const setup = spacesPlugin.setup(npSetup.core, pluginsSetup);
-export const start = spacesPlugin.start(npStart.core, pluginsStart);
diff --git a/x-pack/plugins/spaces/kibana.json b/x-pack/plugins/spaces/kibana.json
index d806aaf1807ef..7d03c3ec5d6f3 100644
--- a/x-pack/plugins/spaces/kibana.json
+++ b/x-pack/plugins/spaces/kibana.json
@@ -6,5 +6,5 @@
"requiredPlugins": ["features", "licensing"],
"optionalPlugins": ["security", "home", "usageCollection"],
"server": true,
- "ui": false
+ "ui": true
}
diff --git a/x-pack/legacy/plugins/spaces/public/__mocks__/xpack_info.ts b/x-pack/plugins/spaces/public/__mocks__/xpack_info.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/__mocks__/xpack_info.ts
rename to x-pack/plugins/spaces/public/__mocks__/xpack_info.ts
diff --git a/x-pack/legacy/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx b/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx
rename to x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx b/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx
rename to x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx
rename to x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.tsx b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.tsx
rename to x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/index.ts b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/index.ts
rename to x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx
rename to x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.tsx b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.tsx
rename to x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_title/index.ts b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/advanced_settings/components/advanced_settings_title/index.ts
rename to x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/advanced_settings/components/index.ts b/x-pack/plugins/spaces/public/advanced_settings/components/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/advanced_settings/components/index.ts
rename to x-pack/plugins/spaces/public/advanced_settings/components/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/advanced_settings/index.ts b/x-pack/plugins/spaces/public/advanced_settings/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/advanced_settings/index.ts
rename to x-pack/plugins/spaces/public/advanced_settings/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/constants.ts b/x-pack/plugins/spaces/public/constants.ts
similarity index 78%
rename from x-pack/legacy/plugins/spaces/public/constants.ts
rename to x-pack/plugins/spaces/public/constants.ts
index 94799f6f2b5d8..34f4072e5b6b8 100644
--- a/x-pack/legacy/plugins/spaces/public/constants.ts
+++ b/x-pack/plugins/spaces/public/constants.ts
@@ -5,7 +5,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { npSetup } from 'ui/new_platform';
+import { HttpSetup } from 'src/core/public';
let spacesFeatureDescription: string;
@@ -20,5 +20,5 @@ export const getSpacesFeatureDescription = () => {
return spacesFeatureDescription;
};
-export const getManageSpacesUrl = () =>
- npSetup.core.http.basePath.prepend(`/app/kibana#/management/spaces/list`);
+export const getManageSpacesUrl = (basePath: HttpSetup['basePath']) =>
+ basePath.prepend(`/app/kibana#/management/spaces/list`);
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/_index.scss b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/_index.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/_index.scss
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/_index.scss
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/_copy_to_space.scss b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/_copy_to_space.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/_copy_to_space.scss
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/_copy_to_space.scss
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/_index.scss b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/_index.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/_index.scss
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/_index.scss
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_status_indicator.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_status_indicator.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_status_indicator.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_status_indicator.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_status_summary_indicator.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_status_summary_indicator.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_status_summary_indicator.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_status_summary_indicator.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_form.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_form.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_form.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_form.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/index.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/index.ts
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/processing_copy_to_space.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/processing_copy_to_space.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/processing_copy_to_space.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/processing_copy_to_space.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/selectable_spaces_control.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/selectable_spaces_control.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/selectable_spaces_control.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/selectable_spaces_control.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/space_result.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/space_result.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_action.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_action.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_action.tsx
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_action.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/index.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/index.ts
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.test.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.test.ts
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.test.ts
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.ts
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.ts
diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/types.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/types.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/types.ts
rename to x-pack/plugins/spaces/public/copy_saved_objects_to_space/types.ts
diff --git a/x-pack/legacy/plugins/spaces/public/create_feature_catalogue_entry.ts b/x-pack/plugins/spaces/public/create_feature_catalogue_entry.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/create_feature_catalogue_entry.ts
rename to x-pack/plugins/spaces/public/create_feature_catalogue_entry.ts
diff --git a/x-pack/legacy/plugins/spaces/public/index.ts b/x-pack/plugins/spaces/public/index.ts
similarity index 78%
rename from x-pack/legacy/plugins/spaces/public/index.ts
rename to x-pack/plugins/spaces/public/index.ts
index 53cb906a619d3..24c178341dc13 100644
--- a/x-pack/legacy/plugins/spaces/public/index.ts
+++ b/x-pack/plugins/spaces/public/index.ts
@@ -5,7 +5,7 @@
*/
import { SpacesPlugin } from './plugin';
-export { SpaceAvatar } from './space_avatar';
+export { SpaceAvatar, getSpaceColor, getSpaceImageUrl, getSpaceInitials } from './space_avatar';
export const plugin = () => {
return new SpacesPlugin();
diff --git a/x-pack/legacy/plugins/spaces/public/management/_index.scss b/x-pack/plugins/spaces/public/management/_index.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/_index.scss
rename to x-pack/plugins/spaces/public/management/_index.scss
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/confirm_delete_modal/__snapshots__/confirm_delete_modal.test.tsx.snap b/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/__snapshots__/confirm_delete_modal.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/confirm_delete_modal/__snapshots__/confirm_delete_modal.test.tsx.snap
rename to x-pack/plugins/spaces/public/management/components/confirm_delete_modal/__snapshots__/confirm_delete_modal.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/confirm_delete_modal/_confirm_delete_modal.scss b/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/_confirm_delete_modal.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/confirm_delete_modal/_confirm_delete_modal.scss
rename to x-pack/plugins/spaces/public/management/components/confirm_delete_modal/_confirm_delete_modal.scss
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx b/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx
rename to x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.tsx b/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.tsx
rename to x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/confirm_delete_modal/index.ts b/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/confirm_delete_modal/index.ts
rename to x-pack/plugins/spaces/public/management/components/confirm_delete_modal/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/index.ts b/x-pack/plugins/spaces/public/management/components/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/index.ts
rename to x-pack/plugins/spaces/public/management/components/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap b/x-pack/plugins/spaces/public/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap
rename to x-pack/plugins/spaces/public/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/secure_space_message/index.ts b/x-pack/plugins/spaces/public/management/components/secure_space_message/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/secure_space_message/index.ts
rename to x-pack/plugins/spaces/public/management/components/secure_space_message/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/secure_space_message/secure_space_message.test.tsx b/x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/secure_space_message/secure_space_message.test.tsx
rename to x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/secure_space_message/secure_space_message.tsx b/x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/secure_space_message/secure_space_message.tsx
rename to x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/unauthorized_prompt/__snapshots__/unauthorized_prompt.test.tsx.snap b/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/__snapshots__/unauthorized_prompt.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/unauthorized_prompt/__snapshots__/unauthorized_prompt.test.tsx.snap
rename to x-pack/plugins/spaces/public/management/components/unauthorized_prompt/__snapshots__/unauthorized_prompt.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/unauthorized_prompt/index.ts b/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/unauthorized_prompt/index.ts
rename to x-pack/plugins/spaces/public/management/components/unauthorized_prompt/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx b/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx
rename to x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.tsx b/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.tsx
rename to x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/__snapshots__/delete_spaces_button.test.tsx.snap b/x-pack/plugins/spaces/public/management/edit_space/__snapshots__/delete_spaces_button.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/__snapshots__/delete_spaces_button.test.tsx.snap
rename to x-pack/plugins/spaces/public/management/edit_space/__snapshots__/delete_spaces_button.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/__snapshots__/confirm_alter_active_space_modal.test.tsx.snap b/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/__snapshots__/confirm_alter_active_space_modal.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/__snapshots__/confirm_alter_active_space_modal.test.tsx.snap
rename to x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/__snapshots__/confirm_alter_active_space_modal.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.tsx b/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/index.ts b/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/index.ts
rename to x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/customize_space_avatar.test.tsx.snap b/x-pack/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/customize_space_avatar.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/customize_space_avatar.test.tsx.snap
rename to x-pack/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/customize_space_avatar.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/space_identifier.test.tsx.snap b/x-pack/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/space_identifier.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/space_identifier.test.tsx.snap
rename to x-pack/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/space_identifier.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/index.ts b/x-pack/plugins/spaces/public/management/edit_space/customize_space/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/index.ts
rename to x-pack/plugins/spaces/public/management/edit_space/customize_space/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/space_identifier.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/space_identifier.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/space_identifier.test.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/customize_space/space_identifier.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/space_identifier.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/space_identifier.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/customize_space/space_identifier.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/customize_space/space_identifier.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/delete_spaces_button.tsx b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/delete_spaces_button.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/__snapshots__/enabled_features.test.tsx.snap b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/__snapshots__/enabled_features.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/__snapshots__/enabled_features.test.tsx.snap
rename to x-pack/plugins/spaces/public/management/edit_space/enabled_features/__snapshots__/enabled_features.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/_index.scss b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/_index.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/_index.scss
rename to x-pack/plugins/spaces/public/management/edit_space/enabled_features/_index.scss
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.tsx b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/feature_table.tsx b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/feature_table.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/feature_table.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/enabled_features/feature_table.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/index.ts b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/index.ts
rename to x-pack/plugins/spaces/public/management/edit_space/enabled_features/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/toggle_all_features.tsx b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/toggle_all_features.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/enabled_features/toggle_all_features.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/enabled_features/toggle_all_features.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/index.ts b/x-pack/plugins/spaces/public/management/edit_space/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/index.ts
rename to x-pack/plugins/spaces/public/management/edit_space/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/manage_space_page.tsx b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/manage_space_page.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/reserved_space_badge.tsx b/x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/reserved_space_badge.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/section_panel/__snapshots__/section_panel.test.tsx.snap b/x-pack/plugins/spaces/public/management/edit_space/section_panel/__snapshots__/section_panel.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/section_panel/__snapshots__/section_panel.test.tsx.snap
rename to x-pack/plugins/spaces/public/management/edit_space/section_panel/__snapshots__/section_panel.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/section_panel/_section_panel.scss b/x-pack/plugins/spaces/public/management/edit_space/section_panel/_section_panel.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/section_panel/_section_panel.scss
rename to x-pack/plugins/spaces/public/management/edit_space/section_panel/_section_panel.scss
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/section_panel/index.ts b/x-pack/plugins/spaces/public/management/edit_space/section_panel/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/section_panel/index.ts
rename to x-pack/plugins/spaces/public/management/edit_space/section_panel/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx
rename to x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/index.ts b/x-pack/plugins/spaces/public/management/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/index.ts
rename to x-pack/plugins/spaces/public/management/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/lib/feature_utils.test.ts b/x-pack/plugins/spaces/public/management/lib/feature_utils.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/lib/feature_utils.test.ts
rename to x-pack/plugins/spaces/public/management/lib/feature_utils.test.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/lib/feature_utils.ts b/x-pack/plugins/spaces/public/management/lib/feature_utils.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/lib/feature_utils.ts
rename to x-pack/plugins/spaces/public/management/lib/feature_utils.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/lib/index.ts b/x-pack/plugins/spaces/public/management/lib/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/lib/index.ts
rename to x-pack/plugins/spaces/public/management/lib/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/lib/space_identifier_utils.test.ts b/x-pack/plugins/spaces/public/management/lib/space_identifier_utils.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/lib/space_identifier_utils.test.ts
rename to x-pack/plugins/spaces/public/management/lib/space_identifier_utils.test.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/lib/space_identifier_utils.ts b/x-pack/plugins/spaces/public/management/lib/space_identifier_utils.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/lib/space_identifier_utils.ts
rename to x-pack/plugins/spaces/public/management/lib/space_identifier_utils.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/lib/validate_space.test.ts b/x-pack/plugins/spaces/public/management/lib/validate_space.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/lib/validate_space.test.ts
rename to x-pack/plugins/spaces/public/management/lib/validate_space.test.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/lib/validate_space.ts b/x-pack/plugins/spaces/public/management/lib/validate_space.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/lib/validate_space.ts
rename to x-pack/plugins/spaces/public/management/lib/validate_space.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/management_service.test.ts b/x-pack/plugins/spaces/public/management/management_service.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/management_service.test.ts
rename to x-pack/plugins/spaces/public/management/management_service.test.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/management_service.ts b/x-pack/plugins/spaces/public/management/management_service.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/management_service.ts
rename to x-pack/plugins/spaces/public/management/management_service.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap b/x-pack/plugins/spaces/public/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap
rename to x-pack/plugins/spaces/public/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/management/spaces_grid/index.ts b/x-pack/plugins/spaces/public/management/spaces_grid/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/spaces_grid/index.ts
rename to x-pack/plugins/spaces/public/management/spaces_grid/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/management/spaces_grid/spaces_grid_page.tsx b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/spaces_grid/spaces_grid_page.tsx
rename to x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx
rename to x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/management/template.html b/x-pack/plugins/spaces/public/management/template.html
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/management/template.html
rename to x-pack/plugins/spaces/public/management/template.html
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap b/x-pack/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap
rename to x-pack/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/_index.scss b/x-pack/plugins/spaces/public/nav_control/_index.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/_index.scss
rename to x-pack/plugins/spaces/public/nav_control/_index.scss
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/_nav_control.scss b/x-pack/plugins/spaces/public/nav_control/_nav_control.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/_nav_control.scss
rename to x-pack/plugins/spaces/public/nav_control/_nav_control.scss
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/components/__snapshots__/manage_spaces_button.test.tsx.snap b/x-pack/plugins/spaces/public/nav_control/components/__snapshots__/manage_spaces_button.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/components/__snapshots__/manage_spaces_button.test.tsx.snap
rename to x-pack/plugins/spaces/public/nav_control/components/__snapshots__/manage_spaces_button.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/components/__snapshots__/spaces_description.test.tsx.snap b/x-pack/plugins/spaces/public/nav_control/components/__snapshots__/spaces_description.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/components/__snapshots__/spaces_description.test.tsx.snap
rename to x-pack/plugins/spaces/public/nav_control/components/__snapshots__/spaces_description.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/components/_index.scss b/x-pack/plugins/spaces/public/nav_control/components/_index.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/components/_index.scss
rename to x-pack/plugins/spaces/public/nav_control/components/_index.scss
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/components/_spaces_description.scss b/x-pack/plugins/spaces/public/nav_control/components/_spaces_description.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/components/_spaces_description.scss
rename to x-pack/plugins/spaces/public/nav_control/components/_spaces_description.scss
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/components/_spaces_menu.scss b/x-pack/plugins/spaces/public/nav_control/components/_spaces_menu.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/components/_spaces_menu.scss
rename to x-pack/plugins/spaces/public/nav_control/components/_spaces_menu.scss
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx b/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx
rename to x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/components/manage_spaces_button.tsx b/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/components/manage_spaces_button.tsx
rename to x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/components/spaces_description.test.tsx b/x-pack/plugins/spaces/public/nav_control/components/spaces_description.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/components/spaces_description.test.tsx
rename to x-pack/plugins/spaces/public/nav_control/components/spaces_description.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/components/spaces_description.tsx b/x-pack/plugins/spaces/public/nav_control/components/spaces_description.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/components/spaces_description.tsx
rename to x-pack/plugins/spaces/public/nav_control/components/spaces_description.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/components/spaces_menu.tsx b/x-pack/plugins/spaces/public/nav_control/components/spaces_menu.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/components/spaces_menu.tsx
rename to x-pack/plugins/spaces/public/nav_control/components/spaces_menu.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/index.ts b/x-pack/plugins/spaces/public/nav_control/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/index.ts
rename to x-pack/plugins/spaces/public/nav_control/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/nav_control.tsx b/x-pack/plugins/spaces/public/nav_control/nav_control.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/nav_control.tsx
rename to x-pack/plugins/spaces/public/nav_control/nav_control.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/nav_control_popover.test.tsx b/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/nav_control_popover.test.tsx
rename to x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/nav_control_popover.tsx b/x-pack/plugins/spaces/public/nav_control/nav_control_popover.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/nav_control_popover.tsx
rename to x-pack/plugins/spaces/public/nav_control/nav_control_popover.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/nav_control/types.tsx b/x-pack/plugins/spaces/public/nav_control/types.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/nav_control/types.tsx
rename to x-pack/plugins/spaces/public/nav_control/types.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/plugin.tsx b/x-pack/plugins/spaces/public/plugin.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/plugin.tsx
rename to x-pack/plugins/spaces/public/plugin.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/space_avatar/__snapshots__/space_avatar.test.tsx.snap b/x-pack/plugins/spaces/public/space_avatar/__snapshots__/space_avatar.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_avatar/__snapshots__/space_avatar.test.tsx.snap
rename to x-pack/plugins/spaces/public/space_avatar/__snapshots__/space_avatar.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/space_avatar/index.ts b/x-pack/plugins/spaces/public/space_avatar/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_avatar/index.ts
rename to x-pack/plugins/spaces/public/space_avatar/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/space_avatar/space_attributes.test.ts b/x-pack/plugins/spaces/public/space_avatar/space_attributes.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_avatar/space_attributes.test.ts
rename to x-pack/plugins/spaces/public/space_avatar/space_attributes.test.ts
diff --git a/x-pack/legacy/plugins/spaces/public/space_avatar/space_attributes.ts b/x-pack/plugins/spaces/public/space_avatar/space_attributes.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_avatar/space_attributes.ts
rename to x-pack/plugins/spaces/public/space_avatar/space_attributes.ts
diff --git a/x-pack/legacy/plugins/spaces/public/space_avatar/space_avatar.test.tsx b/x-pack/plugins/spaces/public/space_avatar/space_avatar.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_avatar/space_avatar.test.tsx
rename to x-pack/plugins/spaces/public/space_avatar/space_avatar.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/space_avatar/space_avatar.tsx b/x-pack/plugins/spaces/public/space_avatar/space_avatar.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_avatar/space_avatar.tsx
rename to x-pack/plugins/spaces/public/space_avatar/space_avatar.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/__snapshots__/space_selector.test.tsx.snap b/x-pack/plugins/spaces/public/space_selector/__snapshots__/space_selector.test.tsx.snap
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/__snapshots__/space_selector.test.tsx.snap
rename to x-pack/plugins/spaces/public/space_selector/__snapshots__/space_selector.test.tsx.snap
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/_index.scss b/x-pack/plugins/spaces/public/space_selector/_index.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/_index.scss
rename to x-pack/plugins/spaces/public/space_selector/_index.scss
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/_space_selector.scss b/x-pack/plugins/spaces/public/space_selector/_space_selector.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/_space_selector.scss
rename to x-pack/plugins/spaces/public/space_selector/_space_selector.scss
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/components/_index.scss b/x-pack/plugins/spaces/public/space_selector/components/_index.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/components/_index.scss
rename to x-pack/plugins/spaces/public/space_selector/components/_index.scss
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/components/_space_card.scss b/x-pack/plugins/spaces/public/space_selector/components/_space_card.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/components/_space_card.scss
rename to x-pack/plugins/spaces/public/space_selector/components/_space_card.scss
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/components/_space_cards.scss b/x-pack/plugins/spaces/public/space_selector/components/_space_cards.scss
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/components/_space_cards.scss
rename to x-pack/plugins/spaces/public/space_selector/components/_space_cards.scss
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/components/index.ts b/x-pack/plugins/spaces/public/space_selector/components/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/components/index.ts
rename to x-pack/plugins/spaces/public/space_selector/components/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/components/space_card.test.tsx b/x-pack/plugins/spaces/public/space_selector/components/space_card.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/components/space_card.test.tsx
rename to x-pack/plugins/spaces/public/space_selector/components/space_card.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/components/space_card.tsx b/x-pack/plugins/spaces/public/space_selector/components/space_card.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/components/space_card.tsx
rename to x-pack/plugins/spaces/public/space_selector/components/space_card.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/components/space_cards.test.tsx b/x-pack/plugins/spaces/public/space_selector/components/space_cards.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/components/space_cards.test.tsx
rename to x-pack/plugins/spaces/public/space_selector/components/space_cards.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/components/space_cards.tsx b/x-pack/plugins/spaces/public/space_selector/components/space_cards.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/components/space_cards.tsx
rename to x-pack/plugins/spaces/public/space_selector/components/space_cards.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/index.tsx b/x-pack/plugins/spaces/public/space_selector/index.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/index.tsx
rename to x-pack/plugins/spaces/public/space_selector/index.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/space_selector.html b/x-pack/plugins/spaces/public/space_selector/space_selector.html
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/space_selector.html
rename to x-pack/plugins/spaces/public/space_selector/space_selector.html
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/space_selector.test.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/space_selector.test.tsx
rename to x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/space_selector.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector.tsx
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/space_selector/space_selector.tsx
rename to x-pack/plugins/spaces/public/space_selector/space_selector.tsx
diff --git a/x-pack/legacy/plugins/spaces/public/spaces_manager/index.ts b/x-pack/plugins/spaces/public/spaces_manager/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/spaces_manager/index.ts
rename to x-pack/plugins/spaces/public/spaces_manager/index.ts
diff --git a/x-pack/legacy/plugins/spaces/public/spaces_manager/mocks.ts b/x-pack/plugins/spaces/public/spaces_manager/mocks.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/spaces_manager/mocks.ts
rename to x-pack/plugins/spaces/public/spaces_manager/mocks.ts
diff --git a/x-pack/legacy/plugins/spaces/public/spaces_manager/spaces_manager.mock.ts b/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.mock.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/spaces_manager/spaces_manager.mock.ts
rename to x-pack/plugins/spaces/public/spaces_manager/spaces_manager.mock.ts
diff --git a/x-pack/legacy/plugins/spaces/public/spaces_manager/spaces_manager.test.ts b/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/spaces_manager/spaces_manager.test.ts
rename to x-pack/plugins/spaces/public/spaces_manager/spaces_manager.test.ts
diff --git a/x-pack/legacy/plugins/spaces/public/spaces_manager/spaces_manager.ts b/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.ts
similarity index 100%
rename from x-pack/legacy/plugins/spaces/public/spaces_manager/spaces_manager.ts
rename to x-pack/plugins/spaces/public/spaces_manager/spaces_manager.ts
From 8c4516d3bd0db525bce4babc473cdfe4da1f62e0 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Wed, 8 Jan 2020 14:15:32 -0500
Subject: [PATCH 02/21] updates to support spaces client in NP
---
.../default_component_registry.d.ts | 22 +++++
.../plugins/ml/server/lib/spaces_utils.ts | 2 +-
.../account_management_page.test.tsx | 3 +-
.../components/edit_role_page.test.tsx | 2 +-
.../edit_role/components/edit_role_page.tsx | 2 +-
.../kibana/kibana_privileges_region.tsx | 2 +-
.../privilege_matrix.test.tsx | 2 +-
.../privilege_matrix.tsx | 2 +-
.../privilege_space_form.tsx | 2 +-
.../privilege_space_table.tsx | 2 +-
.../space_aware_privilege_section.tsx | 2 +-
.../space_selector.tsx | 3 +-
.../components/edit_user_page.test.tsx | 3 +-
.../legacy/plugins/spaces/common/constants.ts | 28 ------
x-pack/legacy/plugins/spaces/common/index.ts | 8 --
.../spaces/common/is_reserved_space.test.ts | 34 -------
.../spaces/common/is_reserved_space.ts | 18 ----
.../plugins/spaces/common/model/space.ts | 16 ---
.../plugins/spaces/common/model/types.ts | 7 --
.../legacy/plugins/spaces/public/index.scss | 14 +--
x-pack/legacy/plugins/spaces/public/legacy.ts | 15 +++
.../public/management/legacy_page_routes.tsx | 50 +++-------
.../spaces/public/management/template.html | 0
.../spaces/public/space_selector/index.tsx | 40 ++++++++
.../spaces/server/routes/views/enter_space.ts | 2 +-
x-pack/plugins/security/public/plugin.ts | 9 +-
.../plugins/spaces/common/lib/dataurl.ts | 0
x-pack/plugins/spaces/kibana.json | 2 +-
.../spaces/public/__mocks__/xpack_info.ts | 18 ----
.../advanced_settings_service.test.tsx | 10 +-
.../advanced_settings_service.tsx | 7 +-
.../advanced_settings_title.tsx | 2 +-
x-pack/plugins/spaces/public/constants.ts | 4 -
.../components/copy_to_space_flyout.test.tsx | 8 +-
.../components/copy_to_space_flyout.tsx | 8 +-
.../copy_to_space_flyout_footer.tsx | 2 +-
.../components/processing_copy_to_space.tsx | 6 +-
.../components/space_result.tsx | 2 +-
.../components/space_result_details.tsx | 2 +-
.../copy_saved_objects_to_space_action.tsx | 11 ++-
...opy_saved_objects_to_space_service.test.ts | 4 +
.../copy_saved_objects_to_space_service.ts | 8 +-
.../summarize_copy_result.test.ts | 2 +-
.../summarize_copy_result.ts | 6 +-
.../public/create_feature_catalogue_entry.ts | 2 +-
x-pack/plugins/spaces/public/index.scss | 16 +++
x-pack/plugins/spaces/public/index.ts | 4 +
.../secure_space_message.test.tsx.snap | 33 -------
.../secure_space_message.test.tsx | 34 -------
.../secure_space_message.tsx | 63 ++++++------
.../customize_space_avatar.tsx | 5 +-
.../edit_space/delete_spaces_button.test.tsx | 5 +
.../edit_space/delete_spaces_button.tsx | 7 +-
.../enabled_features.test.tsx | 2 +-
.../enabled_features/enabled_features.tsx | 2 +-
.../enabled_features/feature_table.tsx | 2 +-
.../edit_space/manage_space_page.test.tsx | 30 +++++-
.../edit_space/manage_space_page.tsx | 22 +++--
.../management/lib/feature_utils.test.ts | 2 +-
.../public/management/lib/feature_utils.ts | 4 +-
.../management/management_service.test.ts | 10 ++
.../public/management/management_service.ts | 37 -------
.../public/management/management_service.tsx | 83 ++++++++++++++++
.../spaces_grid/spaces_grid_page.tsx | 19 ++--
.../spaces_grid/spaces_grid_pages.test.tsx | 25 +++--
.../nav_control_popover.test.tsx.snap | 1 +
.../spaces_description.test.tsx.snap | 42 --------
.../components/manage_spaces_button.test.tsx | 2 +
.../components/manage_spaces_button.tsx | 7 +-
.../components/spaces_description.test.tsx | 29 ------
.../components/spaces_description.tsx | 4 +-
.../nav_control/components/spaces_menu.tsx | 4 +-
.../spaces/public/nav_control/nav_control.tsx | 1 +
.../nav_control/nav_control_popover.test.tsx | 2 +
.../nav_control/nav_control_popover.tsx | 5 +-
x-pack/plugins/spaces/public/plugin.tsx | 98 +++++++++++++------
.../spaces/public/space_selector/index.tsx | 38 +------
.../public/space_selector/space_selector.html | 3 -
.../space_selector/space_selector.test.tsx | 2 +-
.../public/space_selector/space_selector.tsx | 2 +-
.../public/spaces_manager/spaces_manager.ts | 4 +-
.../common/lib/space_test_utils.ts | 2 +-
.../common/suites/bulk_create.ts | 2 +-
.../common/suites/bulk_get.ts | 2 +-
.../common/suites/bulk_update.ts | 2 +-
.../common/suites/create.ts | 2 +-
.../common/suites/delete.ts | 2 +-
.../common/suites/export.ts | 2 +-
.../common/suites/find.ts | 2 +-
.../common/suites/get.ts | 2 +-
.../common/suites/import.ts | 2 +-
.../common/suites/resolve_import_errors.ts | 2 +-
.../common/suites/update.ts | 2 +-
.../common/lib/space_test_utils.ts | 2 +-
.../suites/resolve_copy_to_space_conflicts.ts | 2 +-
95 files changed, 493 insertions(+), 578 deletions(-)
create mode 100644 src/legacy/core_plugins/kibana/public/management/sections/settings/components/default_component_registry.d.ts
delete mode 100644 x-pack/legacy/plugins/spaces/common/constants.ts
delete mode 100644 x-pack/legacy/plugins/spaces/common/index.ts
delete mode 100644 x-pack/legacy/plugins/spaces/common/is_reserved_space.test.ts
delete mode 100644 x-pack/legacy/plugins/spaces/common/is_reserved_space.ts
delete mode 100644 x-pack/legacy/plugins/spaces/common/model/space.ts
delete mode 100644 x-pack/legacy/plugins/spaces/common/model/types.ts
rename x-pack/{ => legacy}/plugins/spaces/public/management/template.html (100%)
create mode 100644 x-pack/legacy/plugins/spaces/public/space_selector/index.tsx
rename x-pack/{legacy => }/plugins/spaces/common/lib/dataurl.ts (100%)
delete mode 100644 x-pack/plugins/spaces/public/__mocks__/xpack_info.ts
create mode 100644 x-pack/plugins/spaces/public/index.scss
delete mode 100644 x-pack/plugins/spaces/public/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap
delete mode 100644 x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.test.tsx
delete mode 100644 x-pack/plugins/spaces/public/management/management_service.ts
create mode 100644 x-pack/plugins/spaces/public/management/management_service.tsx
delete mode 100644 x-pack/plugins/spaces/public/nav_control/components/__snapshots__/spaces_description.test.tsx.snap
delete mode 100644 x-pack/plugins/spaces/public/nav_control/components/spaces_description.test.tsx
delete mode 100644 x-pack/plugins/spaces/public/space_selector/space_selector.html
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/default_component_registry.d.ts b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/default_component_registry.d.ts
new file mode 100644
index 0000000000000..b8e6bf3178d20
--- /dev/null
+++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/default_component_registry.d.ts
@@ -0,0 +1,22 @@
+/*
+ * 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 const PAGE_TITLE_COMPONENT: string;
+export const PAGE_SUBTITLE_COMPONENT: string;
+export const PAGE_FOOTER_COMPONENT: string;
diff --git a/x-pack/legacy/plugins/ml/server/lib/spaces_utils.ts b/x-pack/legacy/plugins/ml/server/lib/spaces_utils.ts
index 115e7fe6ba434..09c0e3b6ca337 100644
--- a/x-pack/legacy/plugins/ml/server/lib/spaces_utils.ts
+++ b/x-pack/legacy/plugins/ml/server/lib/spaces_utils.ts
@@ -5,8 +5,8 @@
*/
import { Request } from 'hapi';
+import { Space } from '../../../../../plugins/spaces/public';
import { LegacySpacesPlugin } from '../../../spaces';
-import { Space } from '../../../spaces/common/model/space';
interface GetActiveSpaceResponse {
valid: boolean;
diff --git a/x-pack/legacy/plugins/security/public/views/account/components/account_management_page.test.tsx b/x-pack/legacy/plugins/security/public/views/account/components/account_management_page.test.tsx
index 366842e58e9e4..0b2d14006a27d 100644
--- a/x-pack/legacy/plugins/security/public/views/account/components/account_management_page.test.tsx
+++ b/x-pack/legacy/plugins/security/public/views/account/components/account_management_page.test.tsx
@@ -9,6 +9,7 @@ import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers';
import { securityMock } from '../../../../../../../plugins/security/public/mocks';
import { AccountManagementPage } from './account_management_page';
import { AuthenticatedUser } from '../../../../common/model';
+import { SecurityPluginSetup } from '../../../../../../../plugins/security/public';
jest.mock('ui/kfetch');
@@ -38,7 +39,7 @@ const createUser = ({ withFullName = true, withEmail = true, realm = 'native' }:
function getSecuritySetupMock({ currentUser }: { currentUser: AuthenticatedUser }) {
const securitySetupMock = securityMock.createSetup();
securitySetupMock.authc.getCurrentUser.mockResolvedValue(currentUser);
- return securitySetupMock;
+ return (securitySetupMock as unknown) as SecurityPluginSetup;
}
describe('', () => {
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/edit_role_page.test.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/edit_role_page.test.tsx
index 67c32c8393171..7263096a4d44d 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/edit_role_page.test.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/edit_role_page.test.tsx
@@ -8,7 +8,6 @@ import { ReactWrapper } from 'enzyme';
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { UICapabilities } from 'ui/capabilities';
-import { Space } from '../../../../../../spaces/common/model/space';
import { Feature } from '../../../../../../../../plugins/features/public';
// These modules should be moved into a common directory
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
@@ -20,6 +19,7 @@ import { EditRolePage } from './edit_role_page';
import { SimplePrivilegeSection } from './privileges/kibana/simple_privilege_section';
import { SpaceAwarePrivilegeSection } from './privileges/kibana/space_aware_privilege_section';
import { TransformErrorSection } from './privileges/kibana/transform_error_section';
+import { Space } from '../../../../../../../../plugins/spaces/public';
const buildFeatures = () => {
return [
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/edit_role_page.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/edit_role_page.tsx
index 2ba012afa689d..02a7435c08e58 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/edit_role_page.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/edit_role_page.tsx
@@ -22,7 +22,7 @@ import { get } from 'lodash';
import React, { ChangeEvent, Component, Fragment, HTMLProps } from 'react';
import { UICapabilities } from 'ui/capabilities';
import { toastNotifications } from 'ui/notify';
-import { Space } from '../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../../plugins/spaces/public';
import { Feature } from '../../../../../../../../plugins/features/public';
import {
KibanaPrivileges,
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/kibana_privileges_region.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/kibana_privileges_region.tsx
index 97d61916926b6..63128549d7ed3 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/kibana_privileges_region.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/kibana_privileges_region.tsx
@@ -7,7 +7,7 @@
import { InjectedIntl } from '@kbn/i18n/react';
import React, { Component } from 'react';
import { UICapabilities } from 'ui/capabilities';
-import { Space } from '../../../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../../../../plugins/spaces/public';
import { Feature } from '../../../../../../../../../../plugins/features/public';
import { KibanaPrivileges, Role } from '../../../../../../../common/model';
import { KibanaPrivilegeCalculatorFactory } from '../../../../../../lib/kibana_privilege_calculator';
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.test.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.test.tsx
index ee121caa13a2a..d7aef55288c9e 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.test.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.test.tsx
@@ -7,7 +7,7 @@
import { EuiButtonEmpty, EuiInMemoryTable } from '@elastic/eui';
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
-import { Space } from '../../../../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../../../../../plugins/spaces/public';
import { Feature } from '../../../../../../../../../../../plugins/features/public';
import { KibanaPrivileges, Role } from '../../../../../../../../common/model';
import { KibanaPrivilegeCalculatorFactory } from '../../../../../../..//lib/kibana_privilege_calculator';
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx
index e44ce1836fdaa..c195e3ceb2298 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx
@@ -23,7 +23,7 @@ import {
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import React, { Component, Fragment } from 'react';
import { SpaceAvatar } from '../../../../../../../../../../../plugins/spaces/public';
-import { Space } from '../../../../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../../../../../plugins/spaces/public';
import { Feature } from '../../../../../../../../../../../plugins/features/public';
import { FeaturesPrivileges, Role } from '../../../../../../../../common/model';
import { CalculatedPrivilege } from '../../../../../../../lib/kibana_privilege_calculator';
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx
index 5abb87d23bb6e..49777ba6128d6 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx
@@ -24,7 +24,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import React, { Component, Fragment } from 'react';
-import { Space } from '../../../../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../../../../../plugins/spaces/public';
import { Feature } from '../../../../../../../../../../../plugins/features/public';
import { KibanaPrivileges, Role } from '../../../../../../../../common/model';
import {
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
index 44f42280437cb..24a3763484bb9 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
@@ -15,7 +15,7 @@ import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import _ from 'lodash';
import React, { Component } from 'react';
import { getSpaceColor } from '../../../../../../../../../../../plugins/spaces/public';
-import { Space } from '../../../../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../../../../../plugins/spaces/public';
import {
FeaturesPrivileges,
Role,
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx
index d324cf99c8418..4493995709d33 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx
@@ -15,7 +15,7 @@ import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import _ from 'lodash';
import React, { Component, Fragment } from 'react';
import { UICapabilities } from 'ui/capabilities';
-import { Space } from '../../../../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../../../../../plugins/spaces/public';
import { Feature } from '../../../../../../../../../../../plugins/features/public';
import { KibanaPrivileges, Role } from '../../../../../../../../common/model';
import { KibanaPrivilegeCalculatorFactory } from '../../../../../../../lib/kibana_privilege_calculator';
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_selector.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_selector.tsx
index 84d2e9e2f9f8d..d38850333ae78 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_selector.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/space_selector.tsx
@@ -7,8 +7,7 @@
import { EuiComboBox, EuiComboBoxOptionProps, EuiHealth, EuiHighlight } from '@elastic/eui';
import { InjectedIntl } from '@kbn/i18n/react';
import React, { Component } from 'react';
-import { getSpaceColor } from '../../../../../../../../../../../plugins/spaces/public';
-import { Space } from '../../../../../../../../../spaces/common/model/space';
+import { getSpaceColor, Space } from '../../../../../../../../../../../plugins/spaces/public';
const spaceToOption = (space?: Space, currentSelection?: 'global' | 'spaces') => {
if (!space) {
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_user/components/edit_user_page.test.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_user/components/edit_user_page.test.tsx
index 639646ce48e22..ec79c02560d03 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_user/components/edit_user_page.test.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_user/components/edit_user_page.test.tsx
@@ -13,6 +13,7 @@ import { UserAPIClient } from '../../../../lib/api';
import { User, Role } from '../../../../../common/model';
import { ReactWrapper } from 'enzyme';
import { mockAuthenticatedUser } from '../../../../../../../../plugins/security/common/model/authenticated_user.mock';
+import { SecurityPluginSetup } from '../../../../../../../../plugins/security/public';
jest.mock('ui/kfetch');
@@ -72,7 +73,7 @@ function buildSecuritySetup() {
securitySetupMock.authc.getCurrentUser.mockResolvedValue(
mockAuthenticatedUser(createUser('current_user'))
);
- return securitySetupMock;
+ return (securitySetupMock as unknown) as SecurityPluginSetup;
}
function expectSaveButton(wrapper: ReactWrapper) {
diff --git a/x-pack/legacy/plugins/spaces/common/constants.ts b/x-pack/legacy/plugins/spaces/common/constants.ts
deleted file mode 100644
index 11882ca2f1b3a..0000000000000
--- a/x-pack/legacy/plugins/spaces/common/constants.ts
+++ /dev/null
@@ -1,28 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export const DEFAULT_SPACE_ID = `default`;
-
-/**
- * The minimum number of spaces required to show a search control.
- */
-export const SPACE_SEARCH_COUNT_THRESHOLD = 8;
-
-/**
- * The maximum number of characters allowed in the Space Avatar's initials
- */
-export const MAX_SPACE_INITIALS = 2;
-
-/**
- * The type name used within the Monitoring index to publish spaces stats.
- * @type {string}
- */
-export const KIBANA_SPACES_STATS_TYPE = 'spaces';
-
-/**
- * The path to enter a space.
- */
-export const ENTER_SPACE_PATH = '/spaces/enter';
diff --git a/x-pack/legacy/plugins/spaces/common/index.ts b/x-pack/legacy/plugins/spaces/common/index.ts
deleted file mode 100644
index 8961c9c5ccf79..0000000000000
--- a/x-pack/legacy/plugins/spaces/common/index.ts
+++ /dev/null
@@ -1,8 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export { isReservedSpace } from './is_reserved_space';
-export { MAX_SPACE_INITIALS } from './constants';
diff --git a/x-pack/legacy/plugins/spaces/common/is_reserved_space.test.ts b/x-pack/legacy/plugins/spaces/common/is_reserved_space.test.ts
deleted file mode 100644
index dd1372183ed8a..0000000000000
--- a/x-pack/legacy/plugins/spaces/common/is_reserved_space.test.ts
+++ /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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { isReservedSpace } from './is_reserved_space';
-import { Space } from './model/space';
-
-test('it returns true for reserved spaces', () => {
- const space: Space = {
- id: '',
- name: '',
- disabledFeatures: [],
- _reserved: true,
- };
-
- expect(isReservedSpace(space)).toEqual(true);
-});
-
-test('it returns false for non-reserved spaces', () => {
- const space: Space = {
- id: '',
- name: '',
- disabledFeatures: [],
- };
-
- expect(isReservedSpace(space)).toEqual(false);
-});
-
-test('it handles empty input', () => {
- // @ts-ignore
- expect(isReservedSpace()).toEqual(false);
-});
diff --git a/x-pack/legacy/plugins/spaces/common/is_reserved_space.ts b/x-pack/legacy/plugins/spaces/common/is_reserved_space.ts
deleted file mode 100644
index 788ef80c194ce..0000000000000
--- a/x-pack/legacy/plugins/spaces/common/is_reserved_space.ts
+++ /dev/null
@@ -1,18 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { get } from 'lodash';
-import { Space } from './model/space';
-
-/**
- * Returns whether the given Space is reserved or not.
- *
- * @param space the space
- * @returns boolean
- */
-export function isReservedSpace(space?: Partial | null): boolean {
- return get(space, '_reserved', false);
-}
diff --git a/x-pack/legacy/plugins/spaces/common/model/space.ts b/x-pack/legacy/plugins/spaces/common/model/space.ts
deleted file mode 100644
index c44ce41ec51c0..0000000000000
--- a/x-pack/legacy/plugins/spaces/common/model/space.ts
+++ /dev/null
@@ -1,16 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export interface Space {
- id: string;
- name: string;
- description?: string;
- color?: string;
- initials?: string;
- disabledFeatures: string[];
- _reserved?: boolean;
- imageUrl?: string;
-}
diff --git a/x-pack/legacy/plugins/spaces/common/model/types.ts b/x-pack/legacy/plugins/spaces/common/model/types.ts
deleted file mode 100644
index 58c36da33dbd7..0000000000000
--- a/x-pack/legacy/plugins/spaces/common/model/types.ts
+++ /dev/null
@@ -1,7 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export type GetSpacePurpose = 'any' | 'copySavedObjectsIntoSpace';
diff --git a/x-pack/legacy/plugins/spaces/public/index.scss b/x-pack/legacy/plugins/spaces/public/index.scss
index 26269f1d31aa3..bb3481f96bc1e 100644
--- a/x-pack/legacy/plugins/spaces/public/index.scss
+++ b/x-pack/legacy/plugins/spaces/public/index.scss
@@ -1,16 +1,4 @@
// Import the EUI global scope so we can use EUI constants
@import 'src/legacy/ui/public/styles/_styling_constants';
-/* Spaces plugin styles */
-
-// Prefix all styles with "spc" to avoid conflicts.
-// Examples
-// spcChart
-// spcChart__legend
-// spcChart__legend--small
-// spcChart__legend-isLoading
-
-@import './management/index';
-@import './nav_control/index';
-@import './space_selector/index';
-@import './copy_saved_objects_to_space/index';
+@import '../../../../plugins/spaces/public/index';
\ No newline at end of file
diff --git a/x-pack/legacy/plugins/spaces/public/legacy.ts b/x-pack/legacy/plugins/spaces/public/legacy.ts
index c0fc625994c2c..e4ffd506dfafa 100644
--- a/x-pack/legacy/plugins/spaces/public/legacy.ts
+++ b/x-pack/legacy/plugins/spaces/public/legacy.ts
@@ -5,3 +5,18 @@
*/
import './management/legacy_page_routes';
+
+import { SavedObjectsManagementAction } from 'src/legacy/core_plugins/management/public';
+import { registerSettingsComponent } from 'ui/management';
+import { npSetup } from 'ui/new_platform';
+import { SpacesPluginSetup } from '../../../../plugins/spaces/public';
+import { setup as managementSetup } from '../../../../../src/legacy/core_plugins/management/public/legacy';
+
+const legacyAPI = {
+ registerSavedObjectsManagementAction: (action: SavedObjectsManagementAction) => {
+ managementSetup.savedObjects.registry.register(action);
+ },
+ registerSettingsComponent,
+};
+
+((npSetup.plugins as any).spaces as SpacesPluginSetup).registerLegacyAPI(legacyAPI);
diff --git a/x-pack/legacy/plugins/spaces/public/management/legacy_page_routes.tsx b/x-pack/legacy/plugins/spaces/public/management/legacy_page_routes.tsx
index 8cf4a129e5b8f..419d0401a3cd3 100644
--- a/x-pack/legacy/plugins/spaces/public/management/legacy_page_routes.tsx
+++ b/x-pack/legacy/plugins/spaces/public/management/legacy_page_routes.tsx
@@ -7,16 +7,14 @@
import template from 'plugins/spaces/management/template.html';
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
-import { I18nContext } from 'ui/i18n';
// @ts-ignore
import routes from 'ui/routes';
import { MANAGEMENT_BREADCRUMB } from 'ui/management/breadcrumbs';
import { npStart } from 'ui/new_platform';
-import { ManageSpacePage } from './edit_space';
-import { SpacesGridPage } from './spaces_grid';
+import { Space } from '../../../../../plugins/spaces/public';
+import { SpacesPluginStart } from '../../../../../plugins/spaces/public';
-import { start as spacesNPStart } from '../legacy';
-import { Space } from '../../common/model/space';
+const spacesNPStart = (npStart.plugins as any).spaces as SpacesPluginStart;
const reactRootNodeId = 'manageSpacesReactRoot';
@@ -56,17 +54,9 @@ routes.when('/management/spaces/list', {
$scope.$$postDigest(() => {
const domNode = document.getElementById(reactRootNodeId);
- const { spacesManager } = spacesNPStart;
+ const { management } = spacesNPStart.__legacyCompat;
- render(
-
-
- ,
- domNode
- );
+ render(, domNode);
// unmount react on controller destroy
$scope.$on('$destroy', () => {
@@ -86,17 +76,9 @@ routes.when('/management/spaces/create', {
$scope.$$postDigest(() => {
const domNode = document.getElementById(reactRootNodeId);
- const { spacesManager } = spacesNPStart;
+ const { management } = spacesNPStart.__legacyCompat;
- render(
-
-
- ,
- domNode
- );
+ render(, domNode);
// unmount react on controller destroy
$scope.$on('$destroy', () => {
@@ -122,19 +104,15 @@ routes.when('/management/spaces/edit/:spaceId', {
const { spaceId } = $route.current.params;
- const { spacesManager } = await spacesNPStart;
+ const { management } = spacesNPStart.__legacyCompat;
render(
-
- {
- npStart.core.chrome.setBreadcrumbs(getEditBreadcrumbs(space));
- }}
- capabilities={npStart.core.application.capabilities}
- />
- ,
+ {
+ npStart.core.chrome.setBreadcrumbs(getEditBreadcrumbs(space));
+ }}
+ />,
domNode
);
diff --git a/x-pack/plugins/spaces/public/management/template.html b/x-pack/legacy/plugins/spaces/public/management/template.html
similarity index 100%
rename from x-pack/plugins/spaces/public/management/template.html
rename to x-pack/legacy/plugins/spaces/public/management/template.html
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/index.tsx b/x-pack/legacy/plugins/spaces/public/space_selector/index.tsx
new file mode 100644
index 0000000000000..9a81248059faa
--- /dev/null
+++ b/x-pack/legacy/plugins/spaces/public/space_selector/index.tsx
@@ -0,0 +1,40 @@
+/*
+ * 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 chrome from 'ui/chrome';
+// @ts-ignore
+import { uiModules } from 'ui/modules';
+
+import React from 'react';
+import { render, unmountComponentAtNode } from 'react-dom';
+import { npStart } from 'ui/new_platform';
+import { SpacesPluginStart } from '../../../../../plugins/spaces/public';
+
+const spacesNPStart = (npStart.plugins as any).spaces as SpacesPluginStart;
+
+const module = uiModules.get('spaces_selector', []);
+module.controller('spacesSelectorController', ($scope: any) => {
+ $scope.$$postDigest(() => {
+ const domNode = document.getElementById('spaceSelectorRoot');
+
+ const { SpaceSelector } = spacesNPStart.__legacyCompat;
+
+ render(, domNode);
+
+ // unmount react on controller destroy
+ $scope.$on('$destroy', () => {
+ if (domNode) {
+ unmountComponentAtNode(domNode);
+ }
+ });
+ });
+});
+
+chrome.setVisible(false).setRootTemplate(
+ ``
+);
diff --git a/x-pack/legacy/plugins/spaces/server/routes/views/enter_space.ts b/x-pack/legacy/plugins/spaces/server/routes/views/enter_space.ts
index e560d4278b407..337faa2a18fb6 100644
--- a/x-pack/legacy/plugins/spaces/server/routes/views/enter_space.ts
+++ b/x-pack/legacy/plugins/spaces/server/routes/views/enter_space.ts
@@ -5,7 +5,7 @@
*/
import { Legacy } from 'kibana';
-import { ENTER_SPACE_PATH } from '../../../common/constants';
+import { ENTER_SPACE_PATH } from '../../../../../../plugins/spaces/common/constants';
import { wrapError } from '../../lib/errors';
export function initEnterSpaceView(server: Legacy.Server) {
diff --git a/x-pack/plugins/security/public/plugin.ts b/x-pack/plugins/security/public/plugin.ts
index 50e0b838c750f..b8297efa2fe71 100644
--- a/x-pack/plugins/security/public/plugin.ts
+++ b/x-pack/plugins/security/public/plugin.ts
@@ -13,7 +13,7 @@ import {
SessionTimeoutHttpInterceptor,
UnauthorizedResponseHttpInterceptor,
} from './session';
-import { SecurityLicenseService } from '../common/licensing';
+import { SecurityLicenseService, SecurityLicense } from '../common/licensing';
import { SecurityNavControlService } from './nav_control';
import { AuthenticationService } from './authentication';
@@ -27,6 +27,7 @@ export class SecurityPlugin implements Plugin {
- return {
- xpackInfo: {
- get: jest.fn().mockImplementation((key: string) => {
- if (key === 'features.security.showLinks') {
- return true;
- }
- throw new Error(`unexpected key: ${key}`);
- }),
- },
- };
-});
diff --git a/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx b/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx
index aa3c6acf26236..0f2a3f397be53 100644
--- a/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx
+++ b/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx
@@ -5,12 +5,6 @@
*/
import { AdvancedSettingsService } from './advanced_settings_service';
-jest.mock('ui/management', () => {
- return {
- PAGE_TITLE_COMPONENT: 'page_title_component',
- PAGE_SUBTITLE_COMPONENT: 'page_subtitle_component',
- };
-});
describe('Advanced Settings Service', () => {
describe('#setup', () => {
@@ -25,13 +19,13 @@ describe('Advanced Settings Service', () => {
expect(deps.registerSettingsComponent).toHaveBeenCalledTimes(2);
expect(deps.registerSettingsComponent).toHaveBeenCalledWith(
- 'page_title_component',
+ 'advanced_settings_page_title',
expect.any(Function),
true
);
expect(deps.registerSettingsComponent).toHaveBeenCalledWith(
- 'page_subtitle_component',
+ 'advanced_settings_page_subtitle',
expect.any(Function),
true
);
diff --git a/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx b/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx
index 9c6c2fcc2cdda..b9c4f8e1c40cc 100644
--- a/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx
+++ b/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx
@@ -4,10 +4,15 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
-import { PAGE_TITLE_COMPONENT, PAGE_SUBTITLE_COMPONENT } from 'ui/management';
import { Space } from '../../common/model/space';
import { AdvancedSettingsTitle, AdvancedSettingsSubtitle } from './components';
+// TODO: LP imported from ui/management, but that's not available here. Need NP replacement for these string constants
+import {
+ PAGE_TITLE_COMPONENT,
+ PAGE_SUBTITLE_COMPONENT,
+} from '../../../../../src/legacy/core_plugins/kibana/public/management/sections/settings/components/default_component_registry';
+
interface SetupDeps {
getActiveSpace: () => Promise;
registerSettingsComponent: (
diff --git a/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.tsx b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.tsx
index b74524db81d81..413be03d08bfc 100644
--- a/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.tsx
+++ b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.tsx
@@ -7,7 +7,7 @@
import { EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { useState, useEffect } from 'react';
-import { Space } from '../../../../../../../plugins/spaces/common/model/space';
+import { Space } from '../../../../common/model/space';
import { SpaceAvatar } from '../../../space_avatar';
interface Props {
diff --git a/x-pack/plugins/spaces/public/constants.ts b/x-pack/plugins/spaces/public/constants.ts
index 34f4072e5b6b8..15c65722d01ef 100644
--- a/x-pack/plugins/spaces/public/constants.ts
+++ b/x-pack/plugins/spaces/public/constants.ts
@@ -5,7 +5,6 @@
*/
import { i18n } from '@kbn/i18n';
-import { HttpSetup } from 'src/core/public';
let spacesFeatureDescription: string;
@@ -19,6 +18,3 @@ export const getSpacesFeatureDescription = () => {
return spacesFeatureDescription;
};
-
-export const getManageSpacesUrl = (basePath: HttpSetup['basePath']) =>
- basePath.prepend(`/app/kibana#/management/spaces/list`);
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx
index 28011911e212e..7809b511adda4 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx
@@ -6,7 +6,7 @@
import React from 'react';
import Boom from 'boom';
import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers';
-import { mockManagementPlugin } from '../../../../../../../src/legacy/core_plugins/management/public/np_ready/mocks';
+import { mockManagementPlugin } from '../../../../../../src/legacy/core_plugins/management/public/np_ready/mocks';
import { CopySavedObjectsToSpaceFlyout } from './copy_to_space_flyout';
import { CopyToSpaceForm } from './copy_to_space_form';
import { EuiLoadingSpinner, EuiEmptyPrompt } from '@elastic/eui';
@@ -17,9 +17,9 @@ import { act } from '@testing-library/react';
import { ProcessingCopyToSpace } from './processing_copy_to_space';
import { spacesManagerMock } from '../../spaces_manager/mocks';
import { SpacesManager } from '../../spaces_manager';
-import { ToastNotifications } from 'ui/notify/toasts/toast_notifications';
+import { ToastsApi } from 'src/core/public';
-jest.mock('../../../../../../../src/legacy/core_plugins/management/public/legacy', () => ({
+jest.mock('../../../../../../src/legacy/core_plugins/management/public/legacy', () => ({
setup: mockManagementPlugin.createSetupContract(),
start: mockManagementPlugin.createStartContract(),
}));
@@ -86,7 +86,7 @@ const setup = async (opts: SetupOpts = {}) => {
);
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx
index f486f2f24f13d..cd2f3986600ff 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx
@@ -21,12 +21,12 @@ import {
import { mapValues } from 'lodash';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
-import { ToastNotifications } from 'ui/notify/toasts/toast_notifications';
-import { SavedObjectsManagementRecord } from '../../../../../../../src/legacy/core_plugins/management/public';
+import { ToastsStart } from 'src/core/public';
import {
+ SavedObjectsManagementRecord,
ProcessedImportResponse,
processImportResponse,
-} from '../../../../../../../src/legacy/core_plugins/management/public';
+} from '../../../../../../src/legacy/core_plugins/management/public';
import { Space } from '../../../common/model/space';
import { SpacesManager } from '../../spaces_manager';
import { ProcessingCopyToSpace } from './processing_copy_to_space';
@@ -38,7 +38,7 @@ interface Props {
onClose: () => void;
savedObject: SavedObjectsManagementRecord;
spacesManager: SpacesManager;
- toastNotifications: ToastNotifications;
+ toastNotifications: ToastsStart;
}
export const CopySavedObjectsToSpaceFlyout = (props: Props) => {
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx
index 56f39ce3ed4fb..b22cec0af5ea8 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx
@@ -8,7 +8,7 @@ import React, { Fragment } from 'react';
import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiStat, EuiHorizontalRule } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
-import { ProcessedImportResponse } from '../../../../../../../src/legacy/core_plugins/management/public';
+import { ProcessedImportResponse } from '../../../../../../src/legacy/core_plugins/management/public';
import { ImportRetry } from '../types';
interface Props {
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/processing_copy_to_space.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/processing_copy_to_space.tsx
index 285abb828a011..2735218fdd370 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/processing_copy_to_space.tsx
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/processing_copy_to_space.tsx
@@ -13,8 +13,10 @@ import {
EuiHorizontalRule,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
-import { SavedObjectsManagementRecord } from '../../../../../../../src/legacy/core_plugins/management/public';
-import { ProcessedImportResponse } from '../../../../../../../src/legacy/core_plugins/management/public';
+import {
+ SavedObjectsManagementRecord,
+ ProcessedImportResponse,
+} from '../../../../../../src/legacy/core_plugins/management/public';
import { Space } from '../../../common/model/space';
import { CopyOptions, ImportRetry } from '../types';
import { SpaceResult } from './space_result';
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result.tsx
index 22f0767ba196e..b667ec2a6e11d 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result.tsx
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result.tsx
@@ -6,7 +6,7 @@
import React from 'react';
import { EuiAccordion, EuiFlexGroup, EuiFlexItem, EuiText, EuiSpacer } from '@elastic/eui';
-import { SavedObjectsManagementRecord } from '../../../../../../../src/legacy/core_plugins/management/public';
+import { SavedObjectsManagementRecord } from '../../../../../../src/legacy/core_plugins/management/public';
import { SummarizedCopyToSpaceResult } from '../index';
import { SpaceAvatar } from '../../space_avatar';
import { Space } from '../../../common/model/space';
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx
index d3ab406b87c3e..cae72bb1e75e9 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx
@@ -8,7 +8,7 @@ import React from 'react';
import { EuiText, EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { SummarizedCopyToSpaceResult } from '../index';
-import { SavedObjectsManagementRecord } from '../../../../../../../src/legacy/core_plugins/management/public';
+import { SavedObjectsManagementRecord } from '../../../../../../src/legacy/core_plugins/management/public';
import { Space } from '../../../common/model/space';
import { CopyStatusIndicator } from './copy_status_indicator';
import { ImportRetry } from '../types';
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_action.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_action.tsx
index c016494a4cdf9..c9297ed97f09b 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_action.tsx
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_action.tsx
@@ -5,11 +5,11 @@
*/
import React from 'react';
import { i18n } from '@kbn/i18n';
-import { toastNotifications } from 'ui/notify';
+import { NotificationsStart } from 'src/core/public';
import {
SavedObjectsManagementAction,
SavedObjectsManagementRecord,
-} from '../../../../../../src/legacy/core_plugins/management/public';
+} from '../../../../../src/legacy/core_plugins/management/public';
import { CopySavedObjectsToSpaceFlyout } from './components';
import { SpacesManager } from '../spaces_manager';
@@ -30,7 +30,10 @@ export class CopyToSpaceSavedObjectsManagementAction extends SavedObjectsManagem
},
};
- constructor(private readonly spacesManager: SpacesManager) {
+ constructor(
+ private readonly spacesManager: SpacesManager,
+ private readonly notifications: NotificationsStart
+ ) {
super();
}
@@ -43,7 +46,7 @@ export class CopyToSpaceSavedObjectsManagementAction extends SavedObjectsManagem
onClose={this.onClose}
savedObject={this.record}
spacesManager={this.spacesManager}
- toastNotifications={toastNotifications}
+ toastNotifications={this.notifications.toasts}
/>
);
};
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
index 63a59344dfe5d..7b27466a6b4cf 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
@@ -8,12 +8,16 @@ import { ManagementSetup } from 'src/legacy/core_plugins/management/public';
import { CopyToSpaceSavedObjectsManagementAction } from './copy_saved_objects_to_space_action';
import { spacesManagerMock } from '../spaces_manager/mocks';
import { CopySavedObjectsToSpaceService } from '.';
+import { notificationServiceMock } from 'src/core/public/mocks';
+import { NotificationsSetup } from 'src/core/public';
describe('CopySavedObjectsToSpaceService', () => {
describe('#setup', () => {
it('registers the CopyToSpaceSavedObjectsManagementAction', () => {
const deps = {
spacesManager: spacesManagerMock.create(),
+ notificationsSetup: (notificationServiceMock.create()
+ .setup as unknown) as NotificationsSetup,
// we don't have a proper NP mock for this yet
managementSetup: ({
savedObjects: {
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts
index 37354f985a2fc..2db3d4b319acb 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts
@@ -5,17 +5,19 @@
*/
import { ManagementSetup } from 'src/legacy/core_plugins/management/public';
+import { NotificationsSetup } from 'src/core/public';
import { CopyToSpaceSavedObjectsManagementAction } from './copy_saved_objects_to_space_action';
import { SpacesManager } from '../spaces_manager';
interface SetupDeps {
spacesManager: SpacesManager;
- managementSetup: ManagementSetup;
+ managementSetup: Pick;
+ notificationsSetup: NotificationsSetup;
}
export class CopySavedObjectsToSpaceService {
- public setup({ spacesManager, managementSetup }: SetupDeps) {
- const action = new CopyToSpaceSavedObjectsManagementAction(spacesManager);
+ public setup({ spacesManager, managementSetup, notificationsSetup }: SetupDeps) {
+ const action = new CopyToSpaceSavedObjectsManagementAction(spacesManager, notificationsSetup);
managementSetup.savedObjects.registry.register(action);
}
}
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.test.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.test.ts
index 0244a35711e6f..fb2616619c644 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.test.ts
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.test.ts
@@ -5,7 +5,7 @@
*/
import { summarizeCopyResult } from './summarize_copy_result';
-import { ProcessedImportResponse } from '../../../../../../src/legacy/core_plugins/management/public';
+import { ProcessedImportResponse } from 'src/legacy/core_plugins/management/public';
const createSavedObjectsManagementRecord = () => ({
type: 'dashboard',
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.ts
index 7bc47d35efc6c..5ad4fe2cad3ab 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.ts
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/summarize_copy_result.ts
@@ -4,8 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { SavedObjectsManagementRecord } from '../../../../../../src/legacy/core_plugins/management/public';
-import { ProcessedImportResponse } from '../../../../../../src/legacy/core_plugins/management/public';
+import {
+ ProcessedImportResponse,
+ SavedObjectsManagementRecord,
+} from 'src/legacy/core_plugins/management/public';
export interface SummarizedSavedObjectResult {
type: string;
diff --git a/x-pack/plugins/spaces/public/create_feature_catalogue_entry.ts b/x-pack/plugins/spaces/public/create_feature_catalogue_entry.ts
index 464066d2221de..384dca7df8c4d 100644
--- a/x-pack/plugins/spaces/public/create_feature_catalogue_entry.ts
+++ b/x-pack/plugins/spaces/public/create_feature_catalogue_entry.ts
@@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n';
import {
FeatureCatalogueEntry,
FeatureCatalogueCategory,
-} from '../../../../../src/plugins/home/public';
+} from '../../../../src/plugins/home/public';
import { getSpacesFeatureDescription } from './constants';
export const createSpacesFeatureCatalogueEntry = (): FeatureCatalogueEntry => {
diff --git a/x-pack/plugins/spaces/public/index.scss b/x-pack/plugins/spaces/public/index.scss
new file mode 100644
index 0000000000000..26269f1d31aa3
--- /dev/null
+++ b/x-pack/plugins/spaces/public/index.scss
@@ -0,0 +1,16 @@
+// Import the EUI global scope so we can use EUI constants
+@import 'src/legacy/ui/public/styles/_styling_constants';
+
+/* Spaces plugin styles */
+
+// Prefix all styles with "spc" to avoid conflicts.
+// Examples
+// spcChart
+// spcChart__legend
+// spcChart__legend--small
+// spcChart__legend-isLoading
+
+@import './management/index';
+@import './nav_control/index';
+@import './space_selector/index';
+@import './copy_saved_objects_to_space/index';
diff --git a/x-pack/plugins/spaces/public/index.ts b/x-pack/plugins/spaces/public/index.ts
index 24c178341dc13..9abf05cab2786 100644
--- a/x-pack/plugins/spaces/public/index.ts
+++ b/x-pack/plugins/spaces/public/index.ts
@@ -5,8 +5,12 @@
*/
import { SpacesPlugin } from './plugin';
+export { Space } from '../common/model/space';
+
export { SpaceAvatar, getSpaceColor, getSpaceImageUrl, getSpaceInitials } from './space_avatar';
+export { SpacesPluginSetup, SpacesPluginStart } from './plugin';
+
export const plugin = () => {
return new SpacesPlugin();
};
diff --git a/x-pack/plugins/spaces/public/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap b/x-pack/plugins/spaces/public/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap
deleted file mode 100644
index bce57527cd55a..0000000000000
--- a/x-pack/plugins/spaces/public/management/components/secure_space_message/__snapshots__/secure_space_message.test.tsx.snap
+++ /dev/null
@@ -1,33 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`SecureSpaceMessage doesn't render if security is not enabled 1`] = `""`;
-
-exports[`SecureSpaceMessage renders if security is enabled 1`] = `
-
-
-
-
-
-
- ,
- }
- }
- />
-
-
-
-`;
diff --git a/x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.test.tsx b/x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.test.tsx
deleted file mode 100644
index b43010fe5f326..0000000000000
--- a/x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.test.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;
- * you may not use this file except in compliance with the Elastic License.
- */
-import React from 'react';
-import { shallowWithIntl } from 'test_utils/enzyme_helpers';
-import { SecureSpaceMessage } from './secure_space_message';
-
-let mockShowLinks: boolean = true;
-jest.mock('../../../../../xpack_main/public/services/xpack_info', () => {
- return {
- xpackInfo: {
- get: jest.fn().mockImplementation((key: string) => {
- if (key === 'features.security.showLinks') {
- return mockShowLinks;
- }
- throw new Error(`unexpected key: ${key}`);
- }),
- },
- };
-});
-
-describe('SecureSpaceMessage', () => {
- it(`doesn't render if security is not enabled`, () => {
- mockShowLinks = false;
- expect(shallowWithIntl()).toMatchSnapshot();
- });
-
- it(`renders if security is enabled`, () => {
- mockShowLinks = true;
- expect(shallowWithIntl()).toMatchSnapshot();
- });
-});
diff --git a/x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.tsx b/x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.tsx
index 746b7e2ac4c98..38d8451b658a8 100644
--- a/x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.tsx
+++ b/x-pack/plugins/spaces/public/management/components/secure_space_message/secure_space_message.tsx
@@ -8,40 +8,33 @@ import { EuiHorizontalRule, EuiLink, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import React, { Fragment } from 'react';
-// @ts-ignore
-import { xpackInfo } from '../../../../../xpack_main/public/services/xpack_info';
-export const SecureSpaceMessage = ({}) => {
- const showSecurityLinks = xpackInfo.get('features.security.showLinks');
-
- if (showSecurityLinks) {
- const rolesLinkTextAriaLabel = i18n.translate(
- 'xpack.spaces.management.secureSpaceMessage.rolesLinkTextAriaLabel',
- { defaultMessage: 'Roles management page' }
- );
- return (
-
-
-
-
-
-
-
- ),
- }}
- />
-
-
-
- );
- }
- return null;
+export const SecureSpaceMessage = () => {
+ const rolesLinkTextAriaLabel = i18n.translate(
+ 'xpack.spaces.management.secureSpaceMessage.rolesLinkTextAriaLabel',
+ { defaultMessage: 'Roles management page' }
+ );
+ return (
+
+
+
+
+
+
+
+ ),
+ }}
+ />
+
+
+
+ );
};
diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx
index c3207c82bf95e..36e8c8cc0cb48 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx
@@ -17,11 +17,10 @@ import {
isValidHex,
} from '@elastic/eui';
import { InjectedIntl, injectI18n } from '@kbn/i18n/react';
+import { Space } from '../../../../common/model/space';
import { imageTypes, encode } from '../../../../common/lib/dataurl';
import { getSpaceColor, getSpaceInitials } from '../../../space_avatar';
-import { Space } from '../../../../../../../plugins/spaces/common/model/space';
-import { MAX_SPACE_INITIALS } from '../../../../../../../plugins/spaces/common';
-
+import { MAX_SPACE_INITIALS } from '../../../../common';
interface Props {
space: Partial;
onChange: (space: Partial) => void;
diff --git a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
index 364145d6495b8..2d3ae53a9f857 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
@@ -9,6 +9,8 @@ import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { DeleteSpacesButton } from './delete_spaces_button';
import { spacesManagerMock } from '../../spaces_manager/mocks';
import { SpacesManager } from '../../spaces_manager';
+import { notificationServiceMock } from 'src/core/public/mocks';
+import { NotificationsStart } from 'src/core/public';
const space = {
id: 'my-space',
@@ -20,12 +22,15 @@ describe('DeleteSpacesButton', () => {
it('renders as expected', () => {
const spacesManager = spacesManagerMock.create();
+ const notificatons = (notificationServiceMock.create().start as unknown) as NotificationsStart;
+
const wrapper = shallowWithIntl(
);
expect(wrapper).toMatchSnapshot();
diff --git a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.tsx b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.tsx
index 56a858eb4ccf6..f8ac2f0afe786 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.tsx
@@ -7,7 +7,7 @@
import { EuiButton, EuiButtonIcon, EuiButtonIconProps } from '@elastic/eui';
import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import React, { Component, Fragment } from 'react';
-import { toastNotifications } from 'ui/notify';
+import { NotificationsStart } from 'src/core/public';
import { Space } from '../../../common/model/space';
import { SpacesManager } from '../../spaces_manager';
import { ConfirmDeleteModal } from '../components/confirm_delete_modal';
@@ -18,6 +18,7 @@ interface Props {
spacesManager: SpacesManager;
onDelete: () => void;
intl: InjectedIntl;
+ notifications: NotificationsStart;
}
interface State {
@@ -102,7 +103,7 @@ class DeleteSpacesButtonUI extends Component {
} catch (error) {
const { message: errorMessage = '' } = error.data || {};
- toastNotifications.addDanger(
+ this.props.notifications.toasts.addDanger(
intl.formatMessage(
{
id: 'xpack.spaces.management.deleteSpacesButton.deleteSpaceErrorTitle',
@@ -130,7 +131,7 @@ class DeleteSpacesButtonUI extends Component {
}
);
- toastNotifications.addSuccess(message);
+ this.props.notifications.toasts.addSuccess(message);
if (this.props.onDelete) {
this.props.onDelete();
diff --git a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx
index f770857d9313d..3d584875867cd 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx
@@ -7,10 +7,10 @@
import { EuiLink } from '@elastic/eui';
import React from 'react';
import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
-import { Feature } from '../../../../../../../plugins/features/public';
import { Space } from '../../../../common/model/space';
import { SectionPanel } from '../section_panel';
import { EnabledFeatures } from './enabled_features';
+import { Feature } from '../../../../../features/public';
const features: Feature[] = [
{
diff --git a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.tsx b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.tsx
index 70312296f757b..e975f8d9adb3f 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.tsx
@@ -8,7 +8,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiSpacer, EuiText, EuiTitle } from
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import React, { Component, Fragment, ReactNode } from 'react';
import { Capabilities } from 'src/core/public';
-import { Feature } from '../../../../../../../plugins/features/public';
+import { Feature } from '../../../../../../plugins/features/public';
import { Space } from '../../../../common/model/space';
import { getEnabledFeatures } from '../../lib/feature_utils';
import { SectionPanel } from '../section_panel';
diff --git a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/feature_table.tsx b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/feature_table.tsx
index 2866d0bfa8cf3..e7c2e59702977 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/feature_table.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/feature_table.tsx
@@ -8,7 +8,7 @@ import { EuiIcon, EuiInMemoryTable, EuiSwitch, EuiText, IconType } from '@elasti
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import _ from 'lodash';
import React, { ChangeEvent, Component } from 'react';
-import { Feature } from '../../../../../../../plugins/features/public';
+import { Feature } from '../../../../../../plugins/features/public';
import { Space } from '../../../../common/model/space';
import { ToggleAllFeatures } from './toggle_all_features';
diff --git a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
index d24e932bce112..1a16dfbd363aa 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
@@ -3,10 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-jest.mock('ui/kfetch', () => ({
- kfetch: () => Promise.resolve([{ id: 'feature-1', name: 'feature 1', icon: 'spacesApp' }]),
-}));
-import '../../__mocks__/xpack_info';
+
import { EuiButton, EuiLink, EuiSwitch } from '@elastic/eui';
import { ReactWrapper } from 'enzyme';
import React from 'react';
@@ -16,6 +13,7 @@ import { ManageSpacePage } from './manage_space_page';
import { SectionPanel } from './section_panel';
import { spacesManagerMock } from '../../spaces_manager/mocks';
import { SpacesManager } from '../../spaces_manager';
+import { httpServiceMock, notificationServiceMock } from 'src/core/public/mocks';
const space = {
id: 'my-space',
@@ -29,10 +27,16 @@ describe('ManageSpacePage', () => {
spacesManager.createSpace = jest.fn(spacesManager.createSpace);
spacesManager.getActiveSpace = jest.fn().mockResolvedValue(space);
+ const httpStart = httpServiceMock.createStartContract();
+ httpStart.get.mockResolvedValue([{ id: 'feature-1', name: 'feature 1', icon: 'spacesApp' }]);
+
const wrapper = mountWithIntl(
{
});
spacesManager.getActiveSpace = jest.fn().mockResolvedValue(space);
+ const httpStart = httpServiceMock.createStartContract();
+ httpStart.get.mockResolvedValue([{ id: 'feature-1', name: 'feature 1', icon: 'spacesApp' }]);
+
const onLoadSpace = jest.fn();
const wrapper = mountWithIntl(
@@ -88,6 +95,9 @@ describe('ManageSpacePage', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
onLoadSpace={onLoadSpace}
intl={null as any}
+ http={httpStart}
+ notifications={notificationServiceMock.createStartContract()}
+ securityEnabled={true}
capabilities={{
navLinks: {},
management: {},
@@ -134,11 +144,17 @@ describe('ManageSpacePage', () => {
});
spacesManager.getActiveSpace = jest.fn().mockResolvedValue(space);
+ const httpStart = httpServiceMock.createStartContract();
+ httpStart.get.mockResolvedValue([{ id: 'feature-1', name: 'feature 1', icon: 'spacesApp' }]);
+
const wrapper = mountWithIntl(
{
});
spacesManager.getActiveSpace = jest.fn().mockResolvedValue(space);
+ const httpStart = httpServiceMock.createStartContract();
+ httpStart.get.mockResolvedValue([{ id: 'feature-1', name: 'feature 1', icon: 'spacesApp' }]);
+
const wrapper = mountWithIntl(
void;
capabilities: Capabilities;
+ securityEnabled: boolean;
}
interface State {
@@ -74,9 +75,9 @@ class ManageSpacePageUI extends Component {
return;
}
- const { spaceId, spacesManager, intl, onLoadSpace } = this.props;
+ const { spaceId, spacesManager, intl, onLoadSpace, http } = this.props;
- const getFeatures = kfetch({ method: 'get', pathname: '/api/features' });
+ const getFeatures = http.get('/api/features');
if (spaceId) {
try {
@@ -96,7 +97,7 @@ class ManageSpacePageUI extends Component {
} catch (error) {
const { message = '' } = error.data || {};
- toastNotifications.addDanger(
+ this.props.notifications.toasts.addDanger(
intl.formatMessage(
{
id: 'xpack.spaces.management.manageSpacePage.errorLoadingSpaceTitle',
@@ -212,7 +213,7 @@ class ManageSpacePageUI extends Component {
};
public maybeGetSecureSpacesMessage = () => {
- if (this.editingExistingSpace()) {
+ if (this.editingExistingSpace() && this.props.securityEnabled) {
return ;
}
return null;
@@ -267,6 +268,7 @@ class ManageSpacePageUI extends Component {
space={this.state.space as Space}
spacesManager={this.props.spacesManager}
onDelete={this.backToSpacesList}
+ notifications={this.props.notifications}
/>
);
@@ -357,7 +359,7 @@ class ManageSpacePageUI extends Component {
action
.then(() => {
- toastNotifications.addSuccess(
+ this.props.notifications.toasts.addSuccess(
intl.formatMessage(
{
id:
@@ -381,7 +383,7 @@ class ManageSpacePageUI extends Component {
this.setState({ saveInProgress: false });
- toastNotifications.addDanger(
+ this.props.notifications.toasts.addDanger(
intl.formatMessage(
{
id: 'xpack.spaces.management.manageSpacePage.errorSavingSpaceTitle',
diff --git a/x-pack/plugins/spaces/public/management/lib/feature_utils.test.ts b/x-pack/plugins/spaces/public/management/lib/feature_utils.test.ts
index ce874956d0ef2..a3360969fb3f2 100644
--- a/x-pack/plugins/spaces/public/management/lib/feature_utils.test.ts
+++ b/x-pack/plugins/spaces/public/management/lib/feature_utils.test.ts
@@ -5,7 +5,7 @@
*/
import { getEnabledFeatures } from './feature_utils';
-import { Feature } from '../../../../../../plugins/features/public';
+import { Feature } from '../../../../features/public';
const buildFeatures = () =>
[
diff --git a/x-pack/plugins/spaces/public/management/lib/feature_utils.ts b/x-pack/plugins/spaces/public/management/lib/feature_utils.ts
index ff1688637ef73..a1b64eb954403 100644
--- a/x-pack/plugins/spaces/public/management/lib/feature_utils.ts
+++ b/x-pack/plugins/spaces/public/management/lib/feature_utils.ts
@@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { Feature } from '../../../../../../plugins/features/common';
+import { Feature } from '../../../../features/common';
-import { Space } from '../../../../../../plugins/spaces/common/model/space';
+import { Space } from '../..';
export function getEnabledFeatures(features: Feature[], space: Partial) {
return features.filter(feature => !(space.disabledFeatures || []).includes(feature.id));
diff --git a/x-pack/plugins/spaces/public/management/management_service.test.ts b/x-pack/plugins/spaces/public/management/management_service.test.ts
index fa8ae64168673..d60fb85186026 100644
--- a/x-pack/plugins/spaces/public/management/management_service.test.ts
+++ b/x-pack/plugins/spaces/public/management/management_service.test.ts
@@ -5,6 +5,8 @@
*/
import { ManagementService } from '.';
+import { coreMock } from 'src/core/public/mocks';
+import { spacesManagerMock } from '../spaces_manager/mocks';
describe('ManagementService', () => {
describe('#start', () => {
@@ -22,6 +24,8 @@ describe('ManagementService', () => {
const deps = {
managementStart,
+ coreStart: coreMock.createStart(),
+ spacesManager: spacesManagerMock.create(),
};
const service = new ManagementService();
@@ -53,6 +57,8 @@ describe('ManagementService', () => {
const deps = {
managementStart,
+ coreStart: coreMock.createStart(),
+ spacesManager: spacesManagerMock.create(),
};
const service = new ManagementService();
@@ -70,6 +76,8 @@ describe('ManagementService', () => {
const deps = {
managementStart,
+ coreStart: coreMock.createStart(),
+ spacesManager: spacesManagerMock.create(),
};
const service = new ManagementService();
@@ -98,6 +106,8 @@ describe('ManagementService', () => {
const deps = {
managementStart,
+ coreStart: coreMock.createStart(),
+ spacesManager: spacesManagerMock.create(),
};
const service = new ManagementService();
diff --git a/x-pack/plugins/spaces/public/management/management_service.ts b/x-pack/plugins/spaces/public/management/management_service.ts
deleted file mode 100644
index ada38f5cf3387..0000000000000
--- a/x-pack/plugins/spaces/public/management/management_service.ts
+++ /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;
- * you may not use this file except in compliance with the Elastic License.
- */
-import { i18n } from '@kbn/i18n';
-import { ManagementStart } from 'src/plugins/management/public';
-
-interface StartDeps {
- managementStart: ManagementStart;
-}
-
-const MANAGE_SPACES_KEY = 'spaces';
-
-export class ManagementService {
- private kibanaSection!: any;
-
- public start({ managementStart }: StartDeps) {
- this.kibanaSection = managementStart.legacy.getSection('kibana');
- if (this.kibanaSection && !this.kibanaSection.hasItem(MANAGE_SPACES_KEY)) {
- this.kibanaSection.register(MANAGE_SPACES_KEY, {
- name: 'spacesManagementLink',
- order: 10,
- display: i18n.translate('xpack.spaces.displayName', {
- defaultMessage: 'Spaces',
- }),
- url: `#/management/spaces/list`,
- });
- }
- }
-
- public stop() {
- if (this.kibanaSection && this.kibanaSection.hasItem(MANAGE_SPACES_KEY)) {
- this.kibanaSection.deregister(MANAGE_SPACES_KEY);
- }
- }
-}
diff --git a/x-pack/plugins/spaces/public/management/management_service.tsx b/x-pack/plugins/spaces/public/management/management_service.tsx
new file mode 100644
index 0000000000000..81d485ecf6b68
--- /dev/null
+++ b/x-pack/plugins/spaces/public/management/management_service.tsx
@@ -0,0 +1,83 @@
+/*
+ * 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 { i18n } from '@kbn/i18n';
+import { ManagementStart } from 'src/plugins/management/public';
+import { CoreStart } from 'src/core/public';
+import { SecurityPluginStart } from '../../../security/public';
+import { SpacesGridPage } from './spaces_grid';
+import { SpacesManager } from '../spaces_manager';
+import { ManageSpacePage } from './edit_space';
+import { Space } from '../../common/model/space';
+
+interface StartDeps {
+ coreStart: Pick;
+ managementStart?: ManagementStart;
+ securityLicense?: SecurityPluginStart['securityLicense'];
+ spacesManager: SpacesManager;
+}
+
+const MANAGE_SPACES_KEY = 'spaces';
+
+export class ManagementService {
+ private kibanaSection!: any;
+
+ public start({ coreStart, managementStart, securityLicense, spacesManager }: StartDeps) {
+ this.kibanaSection = managementStart?.legacy.getSection('kibana');
+ if (this.kibanaSection && !this.kibanaSection.hasItem(MANAGE_SPACES_KEY)) {
+ this.kibanaSection.register(MANAGE_SPACES_KEY, {
+ name: 'spacesManagementLink',
+ order: 10,
+ display: i18n.translate('xpack.spaces.displayName', {
+ defaultMessage: 'Spaces',
+ }),
+ url: `#/management/spaces/list`,
+ });
+ }
+
+ return {
+ __legacyCompat: {
+ urls: {},
+ SpacesGridPage: () => (
+
+
+
+ ),
+ ManageSpacePage: ({
+ spaceId,
+ onLoadSpace,
+ }: {
+ spaceId?: string;
+ onLoadSpace?: (space: Space) => void;
+ }) => (
+
+
+
+ ),
+ },
+ };
+ }
+
+ public stop() {
+ if (this.kibanaSection && this.kibanaSection.hasItem(MANAGE_SPACES_KEY)) {
+ this.kibanaSection.deregister(MANAGE_SPACES_KEY);
+ }
+ }
+}
diff --git a/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.tsx b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.tsx
index 6ca1877642bdc..cf194dd1d9486 100644
--- a/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.tsx
+++ b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.tsx
@@ -19,10 +19,8 @@ import {
EuiTitle,
} from '@elastic/eui';
import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
-import { kfetch } from 'ui/kfetch';
-import { toastNotifications } from 'ui/notify';
-import { Capabilities } from 'src/core/public';
-import { Feature } from '../../../../../../plugins/features/public';
+import { Capabilities, HttpStart, NotificationsStart } from 'src/core/public';
+import { Feature } from '../../../../features/public';
import { isReservedSpace } from '../../../common';
import { DEFAULT_SPACE_ID } from '../../../common/constants';
import { Space } from '../../../common/model/space';
@@ -36,8 +34,11 @@ import { getEnabledFeatures } from '../lib/feature_utils';
interface Props {
spacesManager: SpacesManager;
+ notifications: NotificationsStart;
+ http: HttpStart;
intl: InjectedIntl;
capabilities: Capabilities;
+ securityEnabled: boolean;
}
interface State {
@@ -72,7 +73,7 @@ class SpacesGridPageUI extends Component {
return (
{this.getPageContent()}
-
+ {this.props.securityEnabled && }
{this.getConfirmDeleteModal()}
);
@@ -188,7 +189,7 @@ class SpacesGridPageUI extends Component {
} catch (error) {
const { message: errorMessage = '' } = error.data || {};
- toastNotifications.addDanger(
+ this.props.notifications.toasts.addDanger(
intl.formatMessage(
{
id: 'xpack.spaces.management.spacesGridPage.errorDeletingSpaceErrorMessage',
@@ -217,11 +218,11 @@ class SpacesGridPageUI extends Component {
}
);
- toastNotifications.addSuccess(message);
+ this.props.notifications.toasts.addSuccess(message);
};
public loadGrid = async () => {
- const { spacesManager } = this.props;
+ const { spacesManager, http } = this.props;
this.setState({
loading: true,
@@ -230,7 +231,7 @@ class SpacesGridPageUI extends Component {
});
const getSpaces = spacesManager.getSpaces();
- const getFeatures = kfetch({ method: 'get', pathname: '/api/features' });
+ const getFeatures = http.get('/api/features');
try {
const [spaces, features] = await Promise.all([getSpaces, getFeatures]);
diff --git a/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx
index 7856d2e7bee01..96408cee01e4c 100644
--- a/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx
+++ b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx
@@ -3,16 +3,15 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-jest.mock('ui/kfetch', () => ({
- kfetch: () => Promise.resolve([]),
-}));
-import '../../__mocks__/xpack_info';
+
import React from 'react';
-import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
+import { mountWithIntl, shallowWithIntl, nextTick } from 'test_utils/enzyme_helpers';
import { SpaceAvatar } from '../../space_avatar';
import { spacesManagerMock } from '../../spaces_manager/mocks';
import { SpacesManager } from '../../spaces_manager';
import { SpacesGridPage } from './spaces_grid_page';
+import { httpServiceMock } from 'src/core/public/mocks';
+import { notificationServiceMock } from 'src/core/public/mocks';
const spaces = [
{
@@ -41,11 +40,17 @@ spacesManager.getSpaces = jest.fn().mockResolvedValue(spaces);
describe('SpacesGridPage', () => {
it('renders as expected', () => {
+ const httpStart = httpServiceMock.createStartContract();
+ httpStart.get.mockResolvedValue([]);
+
expect(
shallowWithIntl(
{
});
it('renders the list of spaces', async () => {
+ const httpStart = httpServiceMock.createStartContract();
+ httpStart.get.mockResolvedValue([]);
+
const wrapper = mountWithIntl(
{
);
// allow spacesManager to load spaces
- await Promise.resolve();
- wrapper.update();
- await Promise.resolve();
+ await nextTick();
wrapper.update();
expect(wrapper.find(SpaceAvatar)).toHaveLength(spaces.length);
diff --git a/x-pack/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap b/x-pack/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap
index 5cad4e794cfda..b3a14f0f532d3 100644
--- a/x-pack/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap
+++ b/x-pack/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap
@@ -39,6 +39,7 @@ exports[`NavControlPopover renders without crashing 1`] = `
},
}
}
+ navigateToApp={[MockFunction]}
onManageSpacesClick={[Function]}
/>
diff --git a/x-pack/plugins/spaces/public/nav_control/components/__snapshots__/spaces_description.test.tsx.snap b/x-pack/plugins/spaces/public/nav_control/components/__snapshots__/spaces_description.test.tsx.snap
deleted file mode 100644
index 079dab701cc1d..0000000000000
--- a/x-pack/plugins/spaces/public/nav_control/components/__snapshots__/spaces_description.test.tsx.snap
+++ /dev/null
@@ -1,42 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`SpacesDescription renders without crashing 1`] = `
-
-
-
- Organize your dashboards and other saved objects into meaningful categories.
-
-
-
-
-
-
-`;
diff --git a/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx b/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx
index 2dc6ae919c018..009b6aa89d089 100644
--- a/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx
+++ b/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx
@@ -12,6 +12,7 @@ describe('ManageSpacesButton', () => {
it('renders as expected', () => {
const component = (
{
it(`doesn't render if user profile forbids managing spaces`, () => {
const component = (
void;
capabilities: Capabilities;
+ navigateToApp: ApplicationStart['navigateToApp'];
}
export class ManageSpacesButton extends Component {
@@ -45,6 +45,7 @@ export class ManageSpacesButton extends Component {
if (this.props.onClick) {
this.props.onClick();
}
- window.location.replace(getManageSpacesUrl());
+
+ this.props.navigateToApp('kibana', { path: '#/management/spaces/list' });
};
}
diff --git a/x-pack/plugins/spaces/public/nav_control/components/spaces_description.test.tsx b/x-pack/plugins/spaces/public/nav_control/components/spaces_description.test.tsx
deleted file mode 100644
index aacf3845e0e0f..0000000000000
--- a/x-pack/plugins/spaces/public/nav_control/components/spaces_description.test.tsx
+++ /dev/null
@@ -1,29 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { shallow } from 'enzyme';
-import React from 'react';
-import { SpacesDescription } from './spaces_description';
-
-describe('SpacesDescription', () => {
- it('renders without crashing', () => {
- expect(
- shallow(
-
- )
- ).toMatchSnapshot();
- });
-});
diff --git a/x-pack/plugins/spaces/public/nav_control/components/spaces_description.tsx b/x-pack/plugins/spaces/public/nav_control/components/spaces_description.tsx
index abf3c636b839e..9ae612388b168 100644
--- a/x-pack/plugins/spaces/public/nav_control/components/spaces_description.tsx
+++ b/x-pack/plugins/spaces/public/nav_control/components/spaces_description.tsx
@@ -6,13 +6,14 @@
import { EuiContextMenuPanel, EuiText } from '@elastic/eui';
import React, { FC } from 'react';
-import { Capabilities } from 'src/core/public';
+import { Capabilities, ApplicationStart } from 'src/core/public';
import { ManageSpacesButton } from './manage_spaces_button';
import { getSpacesFeatureDescription } from '../../constants';
interface Props {
onManageSpacesClick: () => void;
capabilities: Capabilities;
+ navigateToApp: ApplicationStart['navigateToApp'];
}
export const SpacesDescription: FC = (props: Props) => {
@@ -32,6 +33,7 @@ export const SpacesDescription: FC = (props: Props) => {
style={{ width: `100%` }}
onClick={props.onManageSpacesClick}
capabilities={props.capabilities}
+ navigateToApp={props.navigateToApp}
/>
diff --git a/x-pack/plugins/spaces/public/nav_control/components/spaces_menu.tsx b/x-pack/plugins/spaces/public/nav_control/components/spaces_menu.tsx
index 96ce18896b426..9db7089b6939e 100644
--- a/x-pack/plugins/spaces/public/nav_control/components/spaces_menu.tsx
+++ b/x-pack/plugins/spaces/public/nav_control/components/spaces_menu.tsx
@@ -13,7 +13,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import React, { Component, ReactElement } from 'react';
-import { Capabilities } from 'src/core/public';
+import { Capabilities, ApplicationStart } from 'src/core/public';
import { SPACE_SEARCH_COUNT_THRESHOLD } from '../../../common/constants';
import { Space } from '../../../common/model/space';
import { ManageSpacesButton } from './manage_spaces_button';
@@ -26,6 +26,7 @@ interface Props {
onManageSpacesClick: () => void;
intl: InjectedIntl;
capabilities: Capabilities;
+ navigateToApp: ApplicationStart['navigateToApp'];
}
interface State {
@@ -164,6 +165,7 @@ class SpacesMenuUI extends Component {
size="s"
onClick={this.props.onManageSpacesClick}
capabilities={this.props.capabilities}
+ navigateToApp={this.props.navigateToApp}
/>
);
};
diff --git a/x-pack/plugins/spaces/public/nav_control/nav_control.tsx b/x-pack/plugins/spaces/public/nav_control/nav_control.tsx
index 9ec070eff3fed..53d7038cec4d5 100644
--- a/x-pack/plugins/spaces/public/nav_control/nav_control.tsx
+++ b/x-pack/plugins/spaces/public/nav_control/nav_control.tsx
@@ -25,6 +25,7 @@ export function initSpacesNavControl(spacesManager: SpacesManager, core: CoreSta
spacesManager={spacesManager}
anchorPosition="downLeft"
capabilities={core.application.capabilities}
+ navigateToApp={core.application.navigateToApp}
/>
,
targetDomElement
diff --git a/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx b/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx
index 5ce141abb713e..0e0a3473be7ff 100644
--- a/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx
+++ b/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx
@@ -23,6 +23,7 @@ describe('NavControlPopover', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
anchorPosition={'downRight'}
capabilities={{ navLinks: {}, management: {}, catalogue: {}, spaces: { manage: true } }}
+ navigateToApp={jest.fn()}
/>
);
expect(wrapper).toMatchSnapshot();
@@ -54,6 +55,7 @@ describe('NavControlPopover', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
anchorPosition={'rightCenter'}
capabilities={{ navLinks: {}, management: {}, catalogue: {}, spaces: { manage: true } }}
+ navigateToApp={jest.fn()}
/>
);
diff --git a/x-pack/plugins/spaces/public/nav_control/nav_control_popover.tsx b/x-pack/plugins/spaces/public/nav_control/nav_control_popover.tsx
index f291027e15232..312a7247a0bac 100644
--- a/x-pack/plugins/spaces/public/nav_control/nav_control_popover.tsx
+++ b/x-pack/plugins/spaces/public/nav_control/nav_control_popover.tsx
@@ -11,7 +11,7 @@ import {
EuiHeaderSectionItemButton,
} from '@elastic/eui';
import React, { Component } from 'react';
-import { Capabilities } from 'src/core/public';
+import { Capabilities, ApplicationStart } from 'src/core/public';
import { Subscription } from 'rxjs';
import { Space } from '../../common/model/space';
import { SpaceAvatar } from '../space_avatar';
@@ -23,6 +23,7 @@ interface Props {
spacesManager: SpacesManager;
anchorPosition: PopoverAnchorPosition;
capabilities: Capabilities;
+ navigateToApp: ApplicationStart['navigateToApp'];
}
interface State {
@@ -73,6 +74,7 @@ export class NavControlPopover extends Component {
);
} else {
@@ -83,6 +85,7 @@ export class NavControlPopover extends Component {
onSelectSpace={this.onSelectSpace}
onManageSpacesClick={this.toggleSpaceSelector}
capabilities={this.props.capabilities}
+ navigateToApp={this.props.navigateToApp}
/>
);
}
diff --git a/x-pack/plugins/spaces/public/plugin.tsx b/x-pack/plugins/spaces/public/plugin.tsx
index 1ddb69a5b595c..2608b530a0882 100644
--- a/x-pack/plugins/spaces/public/plugin.tsx
+++ b/x-pack/plugins/spaces/public/plugin.tsx
@@ -6,36 +6,44 @@
import { CoreSetup, CoreStart, Plugin } from 'src/core/public';
import { HomePublicPluginSetup } from 'src/plugins/home/public';
-import { ManagementSetup } from 'src/legacy/core_plugins/management/public';
+import {
+ ManagementSetup,
+ SavedObjectsManagementAction,
+} from 'src/legacy/core_plugins/management/public';
import { ManagementStart } from 'src/plugins/management/public';
+import React from 'react';
+import { SecurityPluginStart } from '../../security/public';
import { SpacesManager } from './spaces_manager';
import { initSpacesNavControl } from './nav_control';
import { createSpacesFeatureCatalogueEntry } from './create_feature_catalogue_entry';
import { CopySavedObjectsToSpaceService } from './copy_saved_objects_to_space';
import { AdvancedSettingsService } from './advanced_settings';
import { ManagementService } from './management';
-
-export interface SpacesPluginStart {
- spacesManager: SpacesManager | null;
-}
+import { SpaceSelector } from './space_selector';
export interface PluginsSetup {
home?: HomePublicPluginSetup;
- management: ManagementSetup;
- __managementLegacyCompat: {
- registerSettingsComponent: (
- id: string,
- component: string | React.FC,
- allowOverride: boolean
- ) => void;
- };
+ management?: ManagementSetup;
}
export interface PluginsStart {
- management: ManagementStart;
+ management?: ManagementStart;
+ security?: SecurityPluginStart;
}
-export class SpacesPlugin implements Plugin {
+interface LegacyAPI {
+ registerSavedObjectsManagementAction: (action: SavedObjectsManagementAction) => void;
+ registerSettingsComponent: (
+ id: string,
+ component: string | React.FC,
+ allowOverride: boolean
+ ) => void;
+}
+
+export type SpacesPluginSetup = ReturnType;
+export type SpacesPluginStart = ReturnType;
+
+export class SpacesPlugin implements Plugin {
private spacesManager!: SpacesManager;
private managementService?: ManagementService;
@@ -44,31 +52,63 @@ export class SpacesPlugin implements Plugin this.spacesManager.getActiveSpace(),
- registerSettingsComponent: plugins.__managementLegacyCompat.registerSettingsComponent,
- });
-
if (plugins.home) {
plugins.home.featureCatalogue.register(createSpacesFeatureCatalogueEntry());
}
+
+ return {
+ registerLegacyAPI: (legacyAPI: LegacyAPI) => {
+ const copySavedObjectsToSpaceService = new CopySavedObjectsToSpaceService();
+ copySavedObjectsToSpaceService.setup({
+ spacesManager: this.spacesManager,
+ managementSetup: {
+ savedObjects: {
+ registry: {
+ register: action => legacyAPI.registerSavedObjectsManagementAction(action),
+ has: () => {
+ throw new Error('not available in legacy shim');
+ },
+ get: () => {
+ throw new Error('not available in legacy shim');
+ },
+ },
+ },
+ },
+ notificationsSetup: core.notifications,
+ });
+
+ const advancedSettingsService = new AdvancedSettingsService();
+ advancedSettingsService.setup({
+ getActiveSpace: () => this.spacesManager.getActiveSpace(),
+ registerSettingsComponent: legacyAPI.registerSettingsComponent,
+ });
+ },
+ };
}
public start(core: CoreStart, plugins: PluginsStart) {
initSpacesNavControl(this.spacesManager, core);
this.managementService = new ManagementService();
- this.managementService.start({ managementStart: plugins.management });
+ const managementStart = this.managementService.start({
+ managementStart: plugins.management,
+ coreStart: core,
+ spacesManager: this.spacesManager,
+ securityLicense: plugins.security && plugins.security.securityLicense,
+ });
return {
- spacesManager: this.spacesManager,
+ activeSpace$: this.spacesManager.onActiveSpaceChange$,
+ getActiveSpace: () => this.spacesManager.getActiveSpace(),
+ __legacyCompat: {
+ SpaceSelector: () => (
+
+
+
+ ),
+ spacesManager: this.spacesManager,
+ management: managementStart.__legacyCompat,
+ },
};
}
diff --git a/x-pack/plugins/spaces/public/space_selector/index.tsx b/x-pack/plugins/spaces/public/space_selector/index.tsx
index c1c1b6dc3a2f3..5ad44e49b8c53 100644
--- a/x-pack/plugins/spaces/public/space_selector/index.tsx
+++ b/x-pack/plugins/spaces/public/space_selector/index.tsx
@@ -4,40 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-// @ts-ignore
-import template from 'plugins/spaces/space_selector/space_selector.html';
-import chrome from 'ui/chrome';
-import { I18nContext } from 'ui/i18n';
-// @ts-ignore
-import { uiModules } from 'ui/modules';
-
-import React from 'react';
-import { render, unmountComponentAtNode } from 'react-dom';
-import { SpaceSelector } from './space_selector';
-
-import { start as spacesNPStart } from '../legacy';
-
-const module = uiModules.get('spaces_selector', []);
-module.controller('spacesSelectorController', ($scope: any) => {
- $scope.$$postDigest(() => {
- const domNode = document.getElementById('spaceSelectorRoot');
-
- const { spacesManager } = spacesNPStart;
-
- render(
-
-
- ,
- domNode
- );
-
- // unmount react on controller destroy
- $scope.$on('$destroy', () => {
- if (domNode) {
- unmountComponentAtNode(domNode);
- }
- });
- });
-});
-
-chrome.setVisible(false).setRootTemplate(template);
+export { SpaceSelector } from './space_selector';
diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector.html b/x-pack/plugins/spaces/public/space_selector/space_selector.html
deleted file mode 100644
index 2dbf9fac3f68b..0000000000000
--- a/x-pack/plugins/spaces/public/space_selector/space_selector.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx
index b4d0f96307500..c8a841da50838 100644
--- a/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx
+++ b/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx
@@ -7,8 +7,8 @@
import React from 'react';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { Space } from '../../common/model/space';
-import { spacesManagerMock } from '../spaces_manager/mocks';
import { SpaceSelector } from './space_selector';
+import { spacesManagerMock } from '../spaces_manager/mocks';
function getSpacesManager(spaces: Space[] = []) {
const manager = spacesManagerMock.create();
diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector.tsx
index 206d38454fa8c..6dd521efd0bf6 100644
--- a/x-pack/plugins/spaces/public/space_selector/space_selector.tsx
+++ b/x-pack/plugins/spaces/public/space_selector/space_selector.tsx
@@ -20,10 +20,10 @@ import {
} from '@elastic/eui';
import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import React, { Component, Fragment } from 'react';
-import { SpacesManager } from '../spaces_manager';
import { Space } from '../../common/model/space';
import { SpaceCards } from './components';
import { SPACE_SEARCH_COUNT_THRESHOLD } from '../../common/constants';
+import { SpacesManager } from '../spaces_manager';
interface Props {
spacesManager: SpacesManager;
diff --git a/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.ts b/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.ts
index e9c738cf40c69..e151dcd4f9368 100644
--- a/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.ts
+++ b/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.ts
@@ -6,12 +6,12 @@
import { Observable, BehaviorSubject } from 'rxjs';
import { skipWhile } from 'rxjs/operators';
import { HttpSetup } from 'src/core/public';
-import { SavedObjectsManagementRecord } from '../../../../../../src/legacy/core_plugins/management/public';
+import { SavedObjectsManagementRecord } from 'src/legacy/core_plugins/management/public';
import { Space } from '../../common/model/space';
import { GetSpacePurpose } from '../../common/model/types';
import { ENTER_SPACE_PATH } from '../../common/constants';
-import { addSpaceIdToPath } from '../../../../../plugins/spaces/common';
import { CopySavedObjectsToSpaceResponse } from '../copy_saved_objects_to_space/types';
+import { addSpaceIdToPath } from '../../common';
export class SpacesManager {
private activeSpace$: BehaviorSubject = new BehaviorSubject(null);
diff --git a/x-pack/test/saved_object_api_integration/common/lib/space_test_utils.ts b/x-pack/test/saved_object_api_integration/common/lib/space_test_utils.ts
index d858177dc62ca..1619d77761c84 100644
--- a/x-pack/test/saved_object_api_integration/common/lib/space_test_utils.ts
+++ b/x-pack/test/saved_object_api_integration/common/lib/space_test_utils.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
export function getUrlPrefix(spaceId: string) {
return spaceId && spaceId !== DEFAULT_SPACE_ID ? `/s/${spaceId}` : ``;
diff --git a/x-pack/test/saved_object_api_integration/common/suites/bulk_create.ts b/x-pack/test/saved_object_api_integration/common/suites/bulk_create.ts
index d719543fa3807..b6f1bb956d72d 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/bulk_create.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/bulk_create.ts
@@ -6,7 +6,7 @@
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/saved_object_api_integration/common/suites/bulk_get.ts b/x-pack/test/saved_object_api_integration/common/suites/bulk_get.ts
index ab7babff8dead..9c5cc375502d1 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/bulk_get.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/bulk_get.ts
@@ -6,7 +6,7 @@
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/saved_object_api_integration/common/suites/bulk_update.ts b/x-pack/test/saved_object_api_integration/common/suites/bulk_update.ts
index e0cc1498d71ca..d14c5ccbd1d0e 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/bulk_update.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/bulk_update.ts
@@ -6,7 +6,7 @@
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/saved_object_api_integration/common/suites/create.ts b/x-pack/test/saved_object_api_integration/common/suites/create.ts
index 3ee0548b707bc..29960c513d40f 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/create.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/create.ts
@@ -5,7 +5,7 @@
*/
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/saved_object_api_integration/common/suites/delete.ts b/x-pack/test/saved_object_api_integration/common/suites/delete.ts
index 9581a2b3983ef..d96ae5446d732 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/delete.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/delete.ts
@@ -6,7 +6,7 @@
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/saved_object_api_integration/common/suites/export.ts b/x-pack/test/saved_object_api_integration/common/suites/export.ts
index 114a1fe53ccd6..4a56d18342dc9 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/export.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/export.ts
@@ -5,7 +5,7 @@
*/
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/saved_object_api_integration/common/suites/find.ts b/x-pack/test/saved_object_api_integration/common/suites/find.ts
index 6799f0ec63846..f270fc8f4db05 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/find.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/find.ts
@@ -5,7 +5,7 @@
*/
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/saved_object_api_integration/common/suites/get.ts b/x-pack/test/saved_object_api_integration/common/suites/get.ts
index 39bfc5df4d6e3..c98209ca1e105 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/get.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/get.ts
@@ -5,7 +5,7 @@
*/
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/saved_object_api_integration/common/suites/import.ts b/x-pack/test/saved_object_api_integration/common/suites/import.ts
index 8e4ef61cf3c12..f6723c912f82e 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/import.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/import.ts
@@ -6,7 +6,7 @@
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/saved_object_api_integration/common/suites/resolve_import_errors.ts b/x-pack/test/saved_object_api_integration/common/suites/resolve_import_errors.ts
index 8ae3a1258ab3a..1b538b9b1b65d 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/resolve_import_errors.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/resolve_import_errors.ts
@@ -6,7 +6,7 @@
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/saved_object_api_integration/common/suites/update.ts b/x-pack/test/saved_object_api_integration/common/suites/update.ts
index cd291c53c5f34..d6b7602c0114a 100644
--- a/x-pack/test/saved_object_api_integration/common/suites/update.ts
+++ b/x-pack/test/saved_object_api_integration/common/suites/update.ts
@@ -6,7 +6,7 @@
import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { getIdPrefix, getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
diff --git a/x-pack/test/spaces_api_integration/common/lib/space_test_utils.ts b/x-pack/test/spaces_api_integration/common/lib/space_test_utils.ts
index 9206e48afe9a4..f233bc1d11d7c 100644
--- a/x-pack/test/spaces_api_integration/common/lib/space_test_utils.ts
+++ b/x-pack/test/spaces_api_integration/common/lib/space_test_utils.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
export function getUrlPrefix(spaceId?: string) {
return spaceId && spaceId !== DEFAULT_SPACE_ID ? `/s/${spaceId}` : ``;
diff --git a/x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.ts b/x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.ts
index 20b4d024803d7..071067ffa85cb 100644
--- a/x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.ts
+++ b/x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.ts
@@ -8,7 +8,7 @@ import expect from '@kbn/expect';
import { SuperTest } from 'supertest';
import { EsArchiver } from 'src/es_archiver';
import { SavedObject } from 'src/core/server';
-import { DEFAULT_SPACE_ID } from '../../../../legacy/plugins/spaces/common/constants';
+import { DEFAULT_SPACE_ID } from '../../../../plugins/spaces/common/constants';
import { CopyResponse } from '../../../../plugins/spaces/server/lib/copy_to_spaces';
import { getUrlPrefix } from '../lib/space_test_utils';
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
From cce8d1f2dc3dabf793c9fc7f72d258938d30869a Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Wed, 8 Jan 2020 14:51:37 -0500
Subject: [PATCH 03/21] fixing MLs import
---
x-pack/legacy/plugins/ml/server/lib/spaces_utils.ts | 2 +-
x-pack/plugins/spaces/server/index.ts | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/x-pack/legacy/plugins/ml/server/lib/spaces_utils.ts b/x-pack/legacy/plugins/ml/server/lib/spaces_utils.ts
index 09c0e3b6ca337..92373bae4ea1d 100644
--- a/x-pack/legacy/plugins/ml/server/lib/spaces_utils.ts
+++ b/x-pack/legacy/plugins/ml/server/lib/spaces_utils.ts
@@ -5,7 +5,7 @@
*/
import { Request } from 'hapi';
-import { Space } from '../../../../../plugins/spaces/public';
+import { Space } from '../../../../../plugins/spaces/server';
import { LegacySpacesPlugin } from '../../../spaces';
interface GetActiveSpaceResponse {
diff --git a/x-pack/plugins/spaces/server/index.ts b/x-pack/plugins/spaces/server/index.ts
index 18f7575ff75d6..77eb3e9c73980 100644
--- a/x-pack/plugins/spaces/server/index.ts
+++ b/x-pack/plugins/spaces/server/index.ts
@@ -17,6 +17,7 @@ import { Plugin } from './plugin';
export { SpacesPluginSetup } from './plugin';
export { SpacesServiceSetup } from './spaces_service';
+export { Space } from '../common/model/space';
export const config = { schema: ConfigSchema };
export const plugin = (initializerContext: PluginInitializerContext) =>
From 890b6854be7730782cc2926134a830aa0352b657 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Wed, 8 Jan 2020 15:25:19 -0500
Subject: [PATCH 04/21] update karma mock
---
src/legacy/ui/public/new_platform/new_platform.karma_mock.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js
index 06424ea48a40f..325faa410c45d 100644
--- a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js
+++ b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js
@@ -132,6 +132,9 @@ export const npSetup = {
register: sinon.fake(),
},
},
+ spaces: {
+ registerLegacyAPI: sinon.fake(),
+ },
},
};
From 6c8c55d241622e6bdaa2d1ff18e9a6a484388794 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Fri, 10 Jan 2020 08:01:51 -0500
Subject: [PATCH 05/21] remove unnecessary setup license
---
x-pack/plugins/security/public/plugin.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/x-pack/plugins/security/public/plugin.ts b/x-pack/plugins/security/public/plugin.ts
index b8297efa2fe71..9ee0065362402 100644
--- a/x-pack/plugins/security/public/plugin.ts
+++ b/x-pack/plugins/security/public/plugin.ts
@@ -57,7 +57,6 @@ export class SecurityPlugin implements Plugin
Date: Thu, 30 Jan 2020 08:03:45 -0500
Subject: [PATCH 06/21] fix merge from master
---
.../account_management/account_management_page.test.tsx | 1 +
.../management/roles/edit_role/edit_role_page.test.tsx | 2 +-
.../public/management/roles/edit_role/edit_role_page.tsx | 2 +-
.../privileges/kibana/kibana_privileges_region.tsx | 2 +-
.../privilege_matrix.test.tsx | 2 +-
.../space_aware_privilege_section/privilege_matrix.tsx | 3 +--
.../space_aware_privilege_section/privilege_space_form.tsx | 2 +-
.../privilege_space_table.tsx | 3 +--
.../space_aware_privilege_section.tsx | 2 +-
.../edit_role/spaces_popover_list/spaces_popover_list.tsx | 3 +--
x-pack/plugins/security/public/plugin.tsx | 7 +++++--
.../__snapshots__/nav_control_popover.test.tsx.snap | 1 +
12 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/x-pack/plugins/security/public/account_management/account_management_page.test.tsx b/x-pack/plugins/security/public/account_management/account_management_page.test.tsx
index dd14a5c2b88a5..9bdf640018999 100644
--- a/x-pack/plugins/security/public/account_management/account_management_page.test.tsx
+++ b/x-pack/plugins/security/public/account_management/account_management_page.test.tsx
@@ -11,6 +11,7 @@ import { AccountManagementPage } from './account_management_page';
import { coreMock } from 'src/core/public/mocks';
import { securityMock } from '../mocks';
import { userAPIClientMock } from '../management/users/index.mock';
+import { SecurityPluginSetup } from '..';
interface Options {
withFullName?: boolean;
diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx
index e183eae08d1e1..23a3f327a2c5c 100644
--- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx
+++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx
@@ -9,7 +9,6 @@ import React from 'react';
import { act } from '@testing-library/react';
import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers';
import { Capabilities } from 'src/core/public';
-import { Space } from '../../../../../spaces/common/model/space';
import { Feature } from '../../../../../features/public';
// These modules should be moved into a common directory
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
@@ -28,6 +27,7 @@ import { dataPluginMock } from '../../../../../../../src/plugins/data/public/moc
import { licenseMock } from '../../../../common/licensing/index.mock';
import { userAPIClientMock } from '../../users/index.mock';
import { rolesAPIClientMock, indicesAPIClientMock, privilegesAPIClientMock } from '../index.mock';
+import { Space } from '../../../../../spaces/public';
const buildFeatures = () => {
return [
diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx
index 33e69a68ca896..42ec3fa419167 100644
--- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx
+++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx
@@ -37,7 +37,7 @@ import {
NotificationsStart,
} from 'src/core/public';
import { IndexPatternsContract } from '../../../../../../../src/plugins/data/public';
-import { Space } from '../../../../../spaces/common/model/space';
+import { Space } from '../../../../../spaces/public';
import { Feature } from '../../../../../features/public';
import {
KibanaPrivileges,
diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.tsx
index 4ebe02e687159..a4e287632c764 100644
--- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.tsx
+++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/kibana_privileges_region.tsx
@@ -6,7 +6,7 @@
import React, { Component } from 'react';
import { Capabilities } from 'src/core/public';
-import { Space } from '../../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../spaces/public';
import { Feature } from '../../../../../../../features/public';
import { KibanaPrivileges, Role } from '../../../../../../common/model';
import { KibanaPrivilegeCalculatorFactory } from './kibana_privilege_calculator';
diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_matrix.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_matrix.test.tsx
index 16aad4826ae44..a01c026c1a5df 100644
--- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_matrix.test.tsx
+++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_matrix.test.tsx
@@ -7,7 +7,7 @@
import { EuiButtonEmpty, EuiInMemoryTable } from '@elastic/eui';
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
-import { Space } from '../../../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../../spaces/public';
import { Feature } from '../../../../../../../../features/public';
import { KibanaPrivileges, Role } from '../../../../../../../common/model';
import { KibanaPrivilegeCalculatorFactory } from '../kibana_privilege_calculator';
diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx
index b3449e32c6c91..f0f425273e25d 100644
--- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx
+++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_matrix.tsx
@@ -19,8 +19,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import React, { Component, Fragment } from 'react';
-import { SpaceAvatar } from '../../../../../../../../../legacy/plugins/spaces/public/space_avatar';
-import { Space } from '../../../../../../../../spaces/common/model/space';
+import { Space, SpaceAvatar } from '../../../../../../../../spaces/public';
import { Feature } from '../../../../../../../../features/public';
import { FeaturesPrivileges, Role } from '../../../../../../../common/model';
import { CalculatedPrivilege } from '../kibana_privilege_calculator';
diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx
index 6d1f5117c52e9..6f841b5d14cb3 100644
--- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx
+++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.tsx
@@ -24,7 +24,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import React, { Component, Fragment } from 'react';
-import { Space } from '../../../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../../spaces/public';
import { Feature } from '../../../../../../../../features/public';
import { KibanaPrivileges, Role, copyRole } from '../../../../../../../common/model';
import {
diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
index 1c27ec84f50dc..1a43fb9e2683a 100644
--- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
+++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
@@ -13,8 +13,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import React, { Component } from 'react';
-import { getSpaceColor } from '../../../../../../../../../legacy/plugins/spaces/public/space_avatar';
-import { Space } from '../../../../../../../../spaces/common/model/space';
+import { Space, getSpaceColor } from '../../../../../../../../spaces/public';
import {
FeaturesPrivileges,
Role,
diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx
index 21cadfafe1790..a706f2f36a94c 100644
--- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx
+++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.tsx
@@ -15,7 +15,7 @@ import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import _ from 'lodash';
import React, { Component, Fragment } from 'react';
import { Capabilities } from 'src/core/public';
-import { Space } from '../../../../../../../../spaces/common/model/space';
+import { Space } from '../../../../../../../../spaces/public';
import { Feature } from '../../../../../../../../features/public';
import { KibanaPrivileges, Role, isReservedRole } from '../../../../../../../common/model';
import { KibanaPrivilegeCalculatorFactory } from '../kibana_privilege_calculator';
diff --git a/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.tsx b/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.tsx
index 62de09a731ec5..f8b2991a844f7 100644
--- a/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.tsx
+++ b/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.tsx
@@ -14,9 +14,8 @@ import {
} from '@elastic/eui';
import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
import React, { Component } from 'react';
-import { SpaceAvatar } from '../../../../../../spaces/public';
+import { Space, SpaceAvatar } from '../../../../../../spaces/public';
import { SPACE_SEARCH_COUNT_THRESHOLD } from '../../../../../../spaces/common';
-import { Space } from '../../../../../../spaces/common/model/space';
interface Props {
spaces: Space[];
diff --git a/x-pack/plugins/security/public/plugin.tsx b/x-pack/plugins/security/public/plugin.tsx
index 394e23cbbf646..caf1730826de8 100644
--- a/x-pack/plugins/security/public/plugin.tsx
+++ b/x-pack/plugins/security/public/plugin.tsx
@@ -21,7 +21,7 @@ import {
SessionTimeoutHttpInterceptor,
UnauthorizedResponseHttpInterceptor,
} from './session';
-import { SecurityLicenseService } from '../common/licensing';
+import { SecurityLicenseService, SecurityLicense } from '../common/licensing';
import { SecurityNavControlService } from './nav_control';
import { AccountManagementPage } from './account_management';
import { AuthenticationService, AuthenticationServiceSetup } from './authentication';
@@ -51,6 +51,7 @@ export class SecurityPlugin
private readonly securityLicenseService = new SecurityLicenseService();
private readonly managementService = new ManagementService();
private authc!: AuthenticationServiceSetup;
+ private securityLicense!: SecurityLicense;
public setup(
core: CoreSetup,
@@ -69,6 +70,7 @@ export class SecurityPlugin
http.intercept(new SessionTimeoutHttpInterceptor(this.sessionTimeout, anonymousPaths));
const { license } = this.securityLicenseService.setup({ license$: licensing.license$ });
+ this.securityLicense = license;
this.authc = new AuthenticationService().setup({ http: core.http });
@@ -110,7 +112,7 @@ export class SecurityPlugin
};
}
- public start(core: CoreStart, { data, management }: PluginStartDependencies) {
+ public start(core: CoreStart, { management }: PluginStartDependencies) {
this.sessionTimeout.start();
this.navControlService.start({ core });
@@ -119,6 +121,7 @@ export class SecurityPlugin
}
return {
+ securityLicense: this.securityLicense,
__legacyCompat: {
account_management: {
AccountManagementPage: () => (
diff --git a/x-pack/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap b/x-pack/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap
index 45daa03e94c2e..22d65f4600e05 100644
--- a/x-pack/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap
+++ b/x-pack/plugins/spaces/public/nav_control/__snapshots__/nav_control_popover.test.tsx.snap
@@ -40,6 +40,7 @@ exports[`NavControlPopover renders without crashing 1`] = `
}
}
id="headerSpacesMenuContent"
+ navigateToApp={[MockFunction]}
onManageSpacesClick={[Function]}
/>
From 0a4198f0cb456e42c68b4465a3b786233e059edf Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Thu, 30 Jan 2020 09:26:29 -0500
Subject: [PATCH 07/21] moving management app registration to NP
---
src/plugins/management/public/mocks/index.ts | 10 ++
x-pack/legacy/plugins/spaces/public/legacy.ts | 2 -
.../public/management/legacy_page_routes.tsx | 127 -----------------
.../spaces/public/management/template.html | 3 -
x-pack/plugins/security/public/index.ts | 1 +
x-pack/plugins/security/public/plugin.tsx | 6 +-
.../public/create_feature_catalogue_entry.ts | 2 +-
.../edit_space/manage_space_page.tsx | 4 +-
.../management/management_service.test.ts | 130 ++++++-----------
.../public/management/management_service.tsx | 89 ++++--------
.../spaces_grid_pages.test.tsx.snap | 2 +-
.../spaces_grid/spaces_grid_page.tsx | 101 +++++---------
.../spaces_grid/spaces_grid_pages.test.tsx | 6 +-
.../management/spaces_management_app.tsx | 131 ++++++++++++++++++
.../components/manage_spaces_button.tsx | 2 +-
x-pack/plugins/spaces/public/plugin.tsx | 29 ++--
.../feature_controls/spaces_security.ts | 32 +++--
17 files changed, 285 insertions(+), 392 deletions(-)
delete mode 100644 x-pack/legacy/plugins/spaces/public/management/legacy_page_routes.tsx
delete mode 100644 x-pack/legacy/plugins/spaces/public/management/template.html
create mode 100644 x-pack/plugins/spaces/public/management/spaces_management_app.tsx
diff --git a/src/plugins/management/public/mocks/index.ts b/src/plugins/management/public/mocks/index.ts
index cc56928e8e529..151c6611df6b9 100644
--- a/src/plugins/management/public/mocks/index.ts
+++ b/src/plugins/management/public/mocks/index.ts
@@ -17,10 +17,20 @@
* under the License.
*/
+const createSetupContract = () => ({
+ sections: {
+ register: jest.fn(),
+ getSection: jest.fn(),
+ getSectionsEnabled: jest.fn(),
+ getAllSections: jest.fn(),
+ },
+});
+
const createStartContract = () => ({
legacy: {},
});
export const managementPluginMock = {
+ createSetupContract,
createStartContract,
};
diff --git a/x-pack/legacy/plugins/spaces/public/legacy.ts b/x-pack/legacy/plugins/spaces/public/legacy.ts
index e4ffd506dfafa..35744d357d2e0 100644
--- a/x-pack/legacy/plugins/spaces/public/legacy.ts
+++ b/x-pack/legacy/plugins/spaces/public/legacy.ts
@@ -4,8 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import './management/legacy_page_routes';
-
import { SavedObjectsManagementAction } from 'src/legacy/core_plugins/management/public';
import { registerSettingsComponent } from 'ui/management';
import { npSetup } from 'ui/new_platform';
diff --git a/x-pack/legacy/plugins/spaces/public/management/legacy_page_routes.tsx b/x-pack/legacy/plugins/spaces/public/management/legacy_page_routes.tsx
deleted file mode 100644
index 419d0401a3cd3..0000000000000
--- a/x-pack/legacy/plugins/spaces/public/management/legacy_page_routes.tsx
+++ /dev/null
@@ -1,127 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-// @ts-ignore
-import template from 'plugins/spaces/management/template.html';
-import React from 'react';
-import { render, unmountComponentAtNode } from 'react-dom';
-// @ts-ignore
-import routes from 'ui/routes';
-import { MANAGEMENT_BREADCRUMB } from 'ui/management/breadcrumbs';
-import { npStart } from 'ui/new_platform';
-import { Space } from '../../../../../plugins/spaces/public';
-import { SpacesPluginStart } from '../../../../../plugins/spaces/public';
-
-const spacesNPStart = (npStart.plugins as any).spaces as SpacesPluginStart;
-
-const reactRootNodeId = 'manageSpacesReactRoot';
-
-function getListBreadcrumbs() {
- return [
- MANAGEMENT_BREADCRUMB,
- {
- text: 'Spaces',
- href: '#/management/spaces/list',
- },
- ];
-}
-
-function getCreateBreadcrumbs() {
- return [
- ...getListBreadcrumbs(),
- {
- text: 'Create',
- },
- ];
-}
-
-function getEditBreadcrumbs(space?: Space) {
- return [
- ...getListBreadcrumbs(),
- {
- text: space ? space.name : '...',
- },
- ];
-}
-
-routes.when('/management/spaces/list', {
- template,
- k7Breadcrumbs: getListBreadcrumbs,
- requireUICapability: 'management.kibana.spaces',
- controller($scope: any) {
- $scope.$$postDigest(() => {
- const domNode = document.getElementById(reactRootNodeId);
-
- const { management } = spacesNPStart.__legacyCompat;
-
- render(, domNode);
-
- // unmount react on controller destroy
- $scope.$on('$destroy', () => {
- if (domNode) {
- unmountComponentAtNode(domNode);
- }
- });
- });
- },
-});
-
-routes.when('/management/spaces/create', {
- template,
- k7Breadcrumbs: getCreateBreadcrumbs,
- requireUICapability: 'management.kibana.spaces',
- controller($scope: any) {
- $scope.$$postDigest(() => {
- const domNode = document.getElementById(reactRootNodeId);
-
- const { management } = spacesNPStart.__legacyCompat;
-
- render(, domNode);
-
- // unmount react on controller destroy
- $scope.$on('$destroy', () => {
- if (domNode) {
- unmountComponentAtNode(domNode);
- }
- });
- });
- },
-});
-
-routes.when('/management/spaces/edit', {
- redirectTo: '/management/spaces/list',
-});
-
-routes.when('/management/spaces/edit/:spaceId', {
- template,
- k7Breadcrumbs: () => getEditBreadcrumbs(),
- requireUICapability: 'management.kibana.spaces',
- controller($scope: any, $route: any) {
- $scope.$$postDigest(async () => {
- const domNode = document.getElementById(reactRootNodeId);
-
- const { spaceId } = $route.current.params;
-
- const { management } = spacesNPStart.__legacyCompat;
-
- render(
- {
- npStart.core.chrome.setBreadcrumbs(getEditBreadcrumbs(space));
- }}
- />,
- domNode
- );
-
- // unmount react on controller destroy
- $scope.$on('$destroy', () => {
- if (domNode) {
- unmountComponentAtNode(domNode);
- }
- });
- });
- },
-});
diff --git a/x-pack/legacy/plugins/spaces/public/management/template.html b/x-pack/legacy/plugins/spaces/public/management/template.html
deleted file mode 100644
index 3cd8e144b43fc..0000000000000
--- a/x-pack/legacy/plugins/spaces/public/management/template.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/x-pack/plugins/security/public/index.ts b/x-pack/plugins/security/public/index.ts
index 336ec37d76a1b..58a802341882d 100644
--- a/x-pack/plugins/security/public/index.ts
+++ b/x-pack/plugins/security/public/index.ts
@@ -10,6 +10,7 @@ import { SecurityPlugin, SecurityPluginSetup, SecurityPluginStart } from './plug
export { SecurityPluginSetup, SecurityPluginStart };
export { SessionInfo } from './types';
export { AuthenticatedUser } from '../common/model';
+export { SecurityLicense } from '../common/licensing';
export const plugin: PluginInitializer = () =>
new SecurityPlugin();
diff --git a/x-pack/plugins/security/public/plugin.tsx b/x-pack/plugins/security/public/plugin.tsx
index caf1730826de8..f1ac2e2ecc3e2 100644
--- a/x-pack/plugins/security/public/plugin.tsx
+++ b/x-pack/plugins/security/public/plugin.tsx
@@ -21,7 +21,7 @@ import {
SessionTimeoutHttpInterceptor,
UnauthorizedResponseHttpInterceptor,
} from './session';
-import { SecurityLicenseService, SecurityLicense } from '../common/licensing';
+import { SecurityLicenseService } from '../common/licensing';
import { SecurityNavControlService } from './nav_control';
import { AccountManagementPage } from './account_management';
import { AuthenticationService, AuthenticationServiceSetup } from './authentication';
@@ -51,7 +51,6 @@ export class SecurityPlugin
private readonly securityLicenseService = new SecurityLicenseService();
private readonly managementService = new ManagementService();
private authc!: AuthenticationServiceSetup;
- private securityLicense!: SecurityLicense;
public setup(
core: CoreSetup,
@@ -70,7 +69,6 @@ export class SecurityPlugin
http.intercept(new SessionTimeoutHttpInterceptor(this.sessionTimeout, anonymousPaths));
const { license } = this.securityLicenseService.setup({ license$: licensing.license$ });
- this.securityLicense = license;
this.authc = new AuthenticationService().setup({ http: core.http });
@@ -109,6 +107,7 @@ export class SecurityPlugin
return {
authc: this.authc,
sessionTimeout: this.sessionTimeout,
+ license,
};
}
@@ -121,7 +120,6 @@ export class SecurityPlugin
}
return {
- securityLicense: this.securityLicense,
__legacyCompat: {
account_management: {
AccountManagementPage: () => (
diff --git a/x-pack/plugins/spaces/public/create_feature_catalogue_entry.ts b/x-pack/plugins/spaces/public/create_feature_catalogue_entry.ts
index 384dca7df8c4d..2cf34e842ce33 100644
--- a/x-pack/plugins/spaces/public/create_feature_catalogue_entry.ts
+++ b/x-pack/plugins/spaces/public/create_feature_catalogue_entry.ts
@@ -19,7 +19,7 @@ export const createSpacesFeatureCatalogueEntry = (): FeatureCatalogueEntry => {
}),
description: getSpacesFeatureDescription(),
icon: 'spacesApp',
- path: '/app/kibana#/management/spaces/list',
+ path: '/app/kibana#/management/kibana/spaces',
showOnHomePage: true,
category: FeatureCatalogueCategory.ADMIN,
};
diff --git a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx
index e3fa54f80696b..213c5b0250fc8 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx
@@ -371,7 +371,7 @@ class ManageSpacePageUI extends Component {
}
)
);
- window.location.hash = `#/management/spaces/list`;
+ window.location.hash = `#/management/kibana/spaces`;
if (requireRefresh) {
setTimeout(() => {
window.location.reload();
@@ -398,7 +398,7 @@ class ManageSpacePageUI extends Component {
};
private backToSpacesList = () => {
- window.location.hash = `#/management/spaces/list`;
+ window.location.hash = `#/management/kibana/spaces`;
};
private editingExistingSpace = () => !!this.props.spaceId;
diff --git a/x-pack/plugins/spaces/public/management/management_service.test.ts b/x-pack/plugins/spaces/public/management/management_service.test.ts
index 8513f50b5d60e..1941aa78c92b3 100644
--- a/x-pack/plugins/spaces/public/management/management_service.test.ts
+++ b/x-pack/plugins/spaces/public/management/management_service.test.ts
@@ -7,127 +7,81 @@
import { ManagementService } from '.';
import { coreMock } from 'src/core/public/mocks';
import { spacesManagerMock } from '../spaces_manager/mocks';
-
-const mockSections = {
- getSection: jest.fn(),
- getAllSections: jest.fn(),
- navigateToApp: jest.fn(),
-};
+import { managementPluginMock } from '../../../../../src/plugins/management/public/mocks';
+import { ManagementSection } from 'src/plugins/management/public';
describe('ManagementService', () => {
- describe('#start', () => {
+ describe('#setup', () => {
it('registers the spaces management page under the kibana section', () => {
- const mockKibanaSection = {
- hasItem: jest.fn().mockReturnValue(false),
- register: jest.fn(),
- };
-
- const managementStart = {
- legacy: {
- getSection: jest.fn().mockReturnValue(mockKibanaSection),
- },
- sections: mockSections,
- };
-
+ const mockKibanaSection = ({
+ registerApp: jest.fn(),
+ } as unknown) as ManagementSection;
const deps = {
- managementStart,
- coreStart: coreMock.createStart(),
+ management: managementPluginMock.createSetupContract(),
+ getStartServices: coreMock.createSetup().getStartServices,
spacesManager: spacesManagerMock.create(),
};
+ deps.management.sections.getSection.mockImplementation(id => {
+ if (id === 'kibana') return mockKibanaSection;
+ throw new Error(`unexpected getSection call: ${id}`);
+ });
+
const service = new ManagementService();
- service.start(deps);
+ service.setup(deps);
- expect(deps.managementStart.legacy.getSection).toHaveBeenCalledTimes(1);
- expect(deps.managementStart.legacy.getSection).toHaveBeenCalledWith('kibana');
+ expect(deps.management.sections.getSection).toHaveBeenCalledTimes(1);
+ expect(deps.management.sections.getSection).toHaveBeenCalledWith('kibana');
- expect(mockKibanaSection.register).toHaveBeenCalledTimes(1);
- expect(mockKibanaSection.register).toHaveBeenCalledWith('spaces', {
- name: 'spacesManagementLink',
+ expect(mockKibanaSection.registerApp).toHaveBeenCalledTimes(1);
+ expect(mockKibanaSection.registerApp).toHaveBeenCalledWith({
+ id: 'spaces',
+ title: 'Spaces',
order: 10,
- display: 'Spaces',
- url: `#/management/spaces/list`,
+ mount: expect.any(Function),
});
});
- it('will not register the spaces management page twice', () => {
- const mockKibanaSection = {
- hasItem: jest.fn().mockReturnValue(true),
- register: jest.fn(),
- };
-
- const managementStart = {
- legacy: {
- getSection: jest.fn().mockReturnValue(mockKibanaSection),
- },
- sections: mockSections,
- };
-
+ it('will not crash if the kibana section is missing', () => {
const deps = {
- managementStart,
- coreStart: coreMock.createStart(),
+ management: managementPluginMock.createSetupContract(),
+ getStartServices: coreMock.createSetup().getStartServices,
spacesManager: spacesManagerMock.create(),
};
const service = new ManagementService();
- service.start(deps);
-
- expect(mockKibanaSection.register).toHaveBeenCalledTimes(0);
- });
-
- it('will not register the spaces management page if the kibana section is missing', () => {
- const managementStart = {
- legacy: {
- getSection: jest.fn().mockReturnValue(undefined),
- },
- sections: mockSections,
- };
-
- const deps = {
- managementStart,
- coreStart: coreMock.createStart(),
- spacesManager: spacesManagerMock.create(),
- };
-
- const service = new ManagementService();
- service.start(deps);
-
- expect(deps.managementStart.legacy.getSection).toHaveBeenCalledTimes(1);
+ service.setup(deps);
});
});
describe('#stop', () => {
- it('deregisters the spaces management page', () => {
- const mockKibanaSection = {
- hasItem: jest
+ it('disables the spaces management page', () => {
+ const mockSpacesManagementPage = { disable: jest.fn() };
+ const mockKibanaSection = ({
+ registerApp: jest.fn(),
+ getApp: jest
.fn()
- .mockReturnValueOnce(false)
- .mockReturnValueOnce(true),
- register: jest.fn(),
- deregister: jest.fn(),
- };
-
- const managementStart = {
- legacy: {
- getSection: jest.fn().mockReturnValue(mockKibanaSection),
- },
- sections: mockSections,
- };
+ .mockImplementation(id => (id === 'spaces' ? mockSpacesManagementPage : undefined)),
+ } as unknown) as ManagementSection;
const deps = {
- managementStart,
- coreStart: coreMock.createStart(),
+ management: managementPluginMock.createSetupContract(),
+ getStartServices: coreMock.createSetup().getStartServices,
spacesManager: spacesManagerMock.create(),
};
+ deps.management.sections.getSection.mockImplementation(id => {
+ if (id === 'kibana') return mockKibanaSection;
+ throw new Error(`unexpected getSection call: ${id}`);
+ });
+
const service = new ManagementService();
- service.start(deps);
+ service.setup(deps);
service.stop();
- expect(mockKibanaSection.register).toHaveBeenCalledTimes(1);
- expect(mockKibanaSection.deregister).toHaveBeenCalledTimes(1);
- expect(mockKibanaSection.deregister).toHaveBeenCalledWith('spaces');
+ expect(mockKibanaSection.registerApp).toHaveBeenCalledTimes(1);
+ expect(mockSpacesManagementPage.disable).toHaveBeenCalledTimes(1);
});
});
});
diff --git a/x-pack/plugins/spaces/public/management/management_service.tsx b/x-pack/plugins/spaces/public/management/management_service.tsx
index 81d485ecf6b68..3a4c61992b411 100644
--- a/x-pack/plugins/spaces/public/management/management_service.tsx
+++ b/x-pack/plugins/spaces/public/management/management_service.tsx
@@ -3,81 +3,40 @@
* 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 { i18n } from '@kbn/i18n';
-import { ManagementStart } from 'src/plugins/management/public';
-import { CoreStart } from 'src/core/public';
-import { SecurityPluginStart } from '../../../security/public';
-import { SpacesGridPage } from './spaces_grid';
+
+import { ManagementSetup, ManagementSection } from 'src/plugins/management/public';
+import { CoreSetup } from 'src/core/public';
+import { SecurityPluginSetup } from '../../../security/public';
import { SpacesManager } from '../spaces_manager';
-import { ManageSpacePage } from './edit_space';
-import { Space } from '../../common/model/space';
+import { PluginsStart } from '../plugin';
+import { spacesManagementApp } from './spaces_management_app';
-interface StartDeps {
- coreStart: Pick;
- managementStart?: ManagementStart;
- securityLicense?: SecurityPluginStart['securityLicense'];
+interface SetupDeps {
+ management: ManagementSetup;
+ getStartServices: CoreSetup['getStartServices'];
spacesManager: SpacesManager;
+ securityLicense?: SecurityPluginSetup['license'];
}
-
-const MANAGE_SPACES_KEY = 'spaces';
-
export class ManagementService {
- private kibanaSection!: any;
+ private kibanaSection?: ManagementSection;
- public start({ coreStart, managementStart, securityLicense, spacesManager }: StartDeps) {
- this.kibanaSection = managementStart?.legacy.getSection('kibana');
- if (this.kibanaSection && !this.kibanaSection.hasItem(MANAGE_SPACES_KEY)) {
- this.kibanaSection.register(MANAGE_SPACES_KEY, {
- name: 'spacesManagementLink',
- order: 10,
- display: i18n.translate('xpack.spaces.displayName', {
- defaultMessage: 'Spaces',
- }),
- url: `#/management/spaces/list`,
- });
+ public setup({ getStartServices, management, spacesManager, securityLicense }: SetupDeps) {
+ this.kibanaSection = management.sections.getSection('kibana');
+ if (this.kibanaSection) {
+ this.kibanaSection.registerApp(
+ spacesManagementApp.create({ getStartServices, spacesManager, securityLicense })
+ );
}
-
- return {
- __legacyCompat: {
- urls: {},
- SpacesGridPage: () => (
-
-
-
- ),
- ManageSpacePage: ({
- spaceId,
- onLoadSpace,
- }: {
- spaceId?: string;
- onLoadSpace?: (space: Space) => void;
- }) => (
-
-
-
- ),
- },
- };
}
+ public start() {}
+
public stop() {
- if (this.kibanaSection && this.kibanaSection.hasItem(MANAGE_SPACES_KEY)) {
- this.kibanaSection.deregister(MANAGE_SPACES_KEY);
+ if (this.kibanaSection) {
+ const spacesApp = this.kibanaSection.getApp(spacesManagementApp.id);
+ if (spacesApp) {
+ spacesApp.disable();
+ }
}
}
}
diff --git a/x-pack/plugins/spaces/public/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap b/x-pack/plugins/spaces/public/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap
index 02dbca28c7b66..aa6db7e22fd5d 100644
--- a/x-pack/plugins/spaces/public/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap
+++ b/x-pack/plugins/spaces/public/management/spaces_grid/__snapshots__/spaces_grid_pages.test.tsx.snap
@@ -39,7 +39,7 @@ exports[`SpacesGridPage renders as expected 1`] = `
>
{
+export class SpacesGridPage extends Component {
constructor(props: Props) {
super(props);
this.state = {
@@ -80,8 +80,6 @@ class SpacesGridPageUI extends Component {
}
public getPageContent() {
- const { intl } = this.props;
-
if (!this.props.capabilities.spaces.manage) {
return ;
}
@@ -115,10 +113,12 @@ class SpacesGridPageUI extends Component {
sorting={true}
search={{
box: {
- placeholder: intl.formatMessage({
- id: 'xpack.spaces.management.spacesGridPage.searchPlaceholder',
- defaultMessage: 'Search',
- }),
+ placeholder: i18n.translate(
+ 'xpack.spaces.management.spacesGridPage.searchPlaceholder',
+ {
+ defaultMessage: 'Search',
+ }
+ ),
},
}}
loading={this.state.loading}
@@ -139,12 +139,7 @@ class SpacesGridPageUI extends Component {
public getPrimaryActionButton() {
return (
- {
- window.location.hash = `#/management/spaces/create`;
- }}
- >
+
{
};
public deleteSpace = async () => {
- const { intl } = this.props;
const { spacesManager } = this.props;
const space = this.state.selectedSpace;
@@ -190,15 +184,12 @@ class SpacesGridPageUI extends Component {
const { message: errorMessage = '' } = error.data || {};
this.props.notifications.toasts.addDanger(
- intl.formatMessage(
- {
- id: 'xpack.spaces.management.spacesGridPage.errorDeletingSpaceErrorMessage',
- defaultMessage: 'Error deleting space: {errorMessage}',
- },
- {
+ i18n.translate('xpack.spaces.management.spacesGridPage.errorDeletingSpaceErrorMessage', {
+ defaultMessage: 'Error deleting space: {errorMessage}',
+ values: {
errorMessage,
- }
- )
+ },
+ })
);
}
@@ -208,13 +199,11 @@ class SpacesGridPageUI extends Component {
this.loadGrid();
- const message = intl.formatMessage(
+ const message = i18n.translate(
+ 'xpack.spaces.management.spacesGridPage.spaceSuccessfullyDeletedNotificationMessage',
{
- id: 'xpack.spaces.management.spacesGridPage.spaceSuccessfullyDeletedNotificationMessage',
defaultMessage: 'Deleted "{spaceName}" space.',
- },
- {
- spaceName: space.name,
+ values: { spaceName: space.name },
}
);
@@ -249,51 +238,37 @@ class SpacesGridPageUI extends Component {
};
public getColumnConfig() {
- const { intl } = this.props;
return [
{
field: 'initials',
name: '',
width: '50px',
render: (value: string, record: Space) => (
- {
- this.onEditSpaceClick(record);
- }}
- >
+
),
},
{
field: 'name',
- name: intl.formatMessage({
- id: 'xpack.spaces.management.spacesGridPage.spaceColumnName',
+ name: i18n.translate('xpack.spaces.management.spacesGridPage.spaceColumnName', {
defaultMessage: 'Space',
}),
sortable: true,
render: (value: string, record: Space) => (
- {
- this.onEditSpaceClick(record);
- }}
- >
- {value}
-
+ {value}
),
},
{
field: 'description',
- name: intl.formatMessage({
- id: 'xpack.spaces.management.spacesGridPage.descriptionColumnName',
+ name: i18n.translate('xpack.spaces.management.spacesGridPage.descriptionColumnName', {
defaultMessage: 'Description',
}),
sortable: true,
},
{
field: 'disabledFeatures',
- name: intl.formatMessage({
- id: 'xpack.spaces.management.spacesGridPage.featuresColumnName',
+ name: i18n.translate('xpack.spaces.management.spacesGridPage.featuresColumnName', {
defaultMessage: 'Features',
}),
sortable: (space: Space) => {
@@ -333,8 +308,7 @@ class SpacesGridPageUI extends Component {
},
{
field: 'id',
- name: intl.formatMessage({
- id: 'xpack.spaces.management.spacesGridPage.identifierColumnName',
+ name: i18n.translate('xpack.spaces.management.spacesGridPage.identifierColumnName', {
defaultMessage: 'Identifier',
}),
sortable: true,
@@ -346,26 +320,23 @@ class SpacesGridPageUI extends Component {
},
},
{
- name: intl.formatMessage({
- id: 'xpack.spaces.management.spacesGridPage.actionsColumnName',
+ name: i18n.translate('xpack.spaces.management.spacesGridPage.actionsColumnName', {
defaultMessage: 'Actions',
}),
actions: [
{
render: (record: Space) => (
this.onEditSpaceClick(record)}
+ href={this.getEditSpacePath(record)}
/>
),
},
@@ -373,13 +344,11 @@ class SpacesGridPageUI extends Component {
available: (record: Space) => !isReservedSpace(record),
render: (record: Space) => (
{
];
}
- private onEditSpaceClick = (space: Space) => {
- window.location.hash = `#/management/spaces/edit/${encodeURIComponent(space.id)}`;
+ private getEditSpacePath = (space: Space) => {
+ return `#/management/kibana/spaces/edit/${encodeURIComponent(space.id)}`;
};
private onDeleteSpaceClick = (space: Space) => {
@@ -404,5 +373,3 @@ class SpacesGridPageUI extends Component {
});
};
}
-
-export const SpacesGridPage = injectI18n(SpacesGridPageUI);
diff --git a/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx
index 96408cee01e4c..90c7aba65e3d6 100644
--- a/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx
+++ b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx
@@ -45,9 +45,8 @@ describe('SpacesGridPage', () => {
expect(
shallowWithIntl(
- {
httpStart.get.mockResolvedValue([]);
const wrapper = mountWithIntl(
- ['getStartServices'];
+ spacesManager: SpacesManager;
+ securityLicense?: SecurityLicense;
+}
+
+export const spacesManagementApp = Object.freeze({
+ id: 'spaces',
+ create({ getStartServices, spacesManager, securityLicense }: CreateParams) {
+ return {
+ id: this.id,
+ order: 10,
+ title: i18n.translate('xpack.spaces.displayName', {
+ defaultMessage: 'Spaces',
+ }),
+ async mount({ basePath, element, setBreadcrumbs }) {
+ const [{ http, notifications, i18n: i18nStart, application }] = await getStartServices();
+ const spacesBreadcrumbs = [
+ {
+ text: i18n.translate('xpack.spaces.management.breadcrumb', {
+ defaultMessage: 'Spaces',
+ }),
+ href: `#${basePath}`,
+ },
+ ];
+
+ const SpacesGridPageWithBreadcrumbs = () => {
+ setBreadcrumbs(spacesBreadcrumbs);
+ return (
+
+ );
+ };
+
+ const CreateSpacePageWithBreadcrumbs = () => {
+ setBreadcrumbs([
+ ...spacesBreadcrumbs,
+ {
+ text: i18n.translate('xpack.spaces.management.createSpaceBreadcrumb', {
+ defaultMessage: 'Create',
+ }),
+ },
+ ]);
+
+ return (
+
+ );
+ };
+
+ const EditSpacePageWithBreadcrumbs = () => {
+ const { spaceId } = useParams<{ spaceId: string }>();
+
+ const onLoadSpace = (space: Space) => {
+ setBreadcrumbs([
+ ...spacesBreadcrumbs,
+ {
+ text: space.name,
+ href: `#${basePath}/edit/${encodeURIComponent(space.id)}`,
+ },
+ ]);
+ };
+
+ return (
+
+ );
+ };
+
+ render(
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ,
+ element
+ );
+
+ return () => {
+ unmountComponentAtNode(element);
+ };
+ },
+ } as RegisterManagementAppArgs;
+ },
+});
diff --git a/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.tsx b/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.tsx
index e1ea6a16ebac6..456b7b0189a75 100644
--- a/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.tsx
+++ b/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.tsx
@@ -46,6 +46,6 @@ export class ManageSpacesButton extends Component {
this.props.onClick();
}
- this.props.navigateToApp('kibana', { path: '#/management/spaces/list' });
+ this.props.navigateToApp('kibana', { path: '#/management/kibana/spaces' });
};
}
diff --git a/x-pack/plugins/spaces/public/plugin.tsx b/x-pack/plugins/spaces/public/plugin.tsx
index 2608b530a0882..c274ed8d37cb1 100644
--- a/x-pack/plugins/spaces/public/plugin.tsx
+++ b/x-pack/plugins/spaces/public/plugin.tsx
@@ -6,13 +6,10 @@
import { CoreSetup, CoreStart, Plugin } from 'src/core/public';
import { HomePublicPluginSetup } from 'src/plugins/home/public';
-import {
- ManagementSetup,
- SavedObjectsManagementAction,
-} from 'src/legacy/core_plugins/management/public';
-import { ManagementStart } from 'src/plugins/management/public';
+import { SavedObjectsManagementAction } from 'src/legacy/core_plugins/management/public';
+import { ManagementStart, ManagementSetup } from 'src/plugins/management/public';
import React from 'react';
-import { SecurityPluginStart } from '../../security/public';
+import { SecurityPluginStart, SecurityPluginSetup } from '../../security/public';
import { SpacesManager } from './spaces_manager';
import { initSpacesNavControl } from './nav_control';
import { createSpacesFeatureCatalogueEntry } from './create_feature_catalogue_entry';
@@ -24,6 +21,7 @@ import { SpaceSelector } from './space_selector';
export interface PluginsSetup {
home?: HomePublicPluginSetup;
management?: ManagementSetup;
+ security?: SecurityPluginSetup;
}
export interface PluginsStart {
@@ -56,6 +54,16 @@ export class SpacesPlugin implements Plugin {
const copySavedObjectsToSpaceService = new CopySavedObjectsToSpaceService();
@@ -89,14 +97,6 @@ export class SpacesPlugin implements Plugin this.spacesManager.getActiveSpace(),
@@ -107,7 +107,6 @@ export class SpacesPlugin implements Plugin
),
spacesManager: this.spacesManager,
- management: managementStart.__legacyCompat,
},
};
}
diff --git a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts
index d71d197a6ea19..0006f53ce3bf0 100644
--- a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts
+++ b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts
@@ -66,7 +66,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
});
it(`can navigate to spaces grid page`, async () => {
- await PageObjects.common.navigateToActualUrl('kibana', 'management/spaces/list', {
+ await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/spaces', {
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
});
@@ -75,7 +75,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
});
it(`can navigate to create new space page`, async () => {
- await PageObjects.common.navigateToActualUrl('kibana', 'management/spaces/create', {
+ await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/spaces/create', {
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
});
@@ -84,10 +84,14 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
});
it(`can navigate to edit space page`, async () => {
- await PageObjects.common.navigateToActualUrl('kibana', 'management/spaces/edit/default', {
- ensureCurrentUrl: false,
- shouldLoginIfPrompted: false,
- });
+ await PageObjects.common.navigateToActualUrl(
+ 'kibana',
+ 'management/kibana/spaces/edit/default',
+ {
+ ensureCurrentUrl: false,
+ shouldLoginIfPrompted: false,
+ }
+ );
await testSubjects.existOrFail('spaces-edit-page');
});
@@ -141,7 +145,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
});
it(`can't navigate to spaces grid page`, async () => {
- await PageObjects.common.navigateToActualUrl('kibana', 'management/spaces/list', {
+ await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/spaces', {
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
});
@@ -150,7 +154,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
});
it(`can't navigate to create new space page`, async () => {
- await PageObjects.common.navigateToActualUrl('kibana', 'management/spaces/create', {
+ await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/spaces/create', {
ensureCurrentUrl: false,
shouldLoginIfPrompted: false,
});
@@ -159,10 +163,14 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
});
it(`can't navigate to edit space page`, async () => {
- await PageObjects.common.navigateToActualUrl('kibana', 'management/spaces/edit/default', {
- ensureCurrentUrl: false,
- shouldLoginIfPrompted: false,
- });
+ await PageObjects.common.navigateToActualUrl(
+ 'kibana',
+ 'management/kibana/spaces/edit/default',
+ {
+ ensureCurrentUrl: false,
+ shouldLoginIfPrompted: false,
+ }
+ );
await testSubjects.existOrFail('homeApp');
});
From 295773c839646e8326a568ed1ab6635b960c52e0 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Thu, 30 Jan 2020 11:22:32 -0500
Subject: [PATCH 08/21] move space selector app to NP
---
x-pack/legacy/plugins/spaces/index.ts | 13 +-----
.../spaces/public/space_selector/index.tsx | 40 -------------------
.../spaces/server/routes/views/index.ts | 1 -
.../server/routes/views/space_selector.ts | 19 ---------
x-pack/plugins/spaces/public/plugin.tsx | 4 +-
.../spaces/public/space_selector/index.tsx | 1 +
.../space_selector/space_selector.test.tsx | 8 +---
.../public/space_selector/space_selector.tsx | 16 ++++----
.../space_selector/space_selector_app.tsx | 32 +++++++++++++++
x-pack/plugins/spaces/server/plugin.ts | 7 ++++
.../spaces/server/routes/views/index.ts | 29 ++++++++++++++
11 files changed, 85 insertions(+), 85 deletions(-)
delete mode 100644 x-pack/legacy/plugins/spaces/public/space_selector/index.tsx
delete mode 100644 x-pack/legacy/plugins/spaces/server/routes/views/space_selector.ts
create mode 100644 x-pack/plugins/spaces/public/space_selector/space_selector_app.tsx
create mode 100644 x-pack/plugins/spaces/server/routes/views/index.ts
diff --git a/x-pack/legacy/plugins/spaces/index.ts b/x-pack/legacy/plugins/spaces/index.ts
index 2e6b878794777..f63f3910fc2f9 100644
--- a/x-pack/legacy/plugins/spaces/index.ts
+++ b/x-pack/legacy/plugins/spaces/index.ts
@@ -17,7 +17,7 @@ import { wrapError } from './server/lib/errors';
import { migrateToKibana660 } from './server/lib/migrations';
// @ts-ignore
import { watchStatusAndLicenseToInitialize } from '../../server/lib/watch_status_and_license_to_initialize';
-import { initSpaceSelectorView, initEnterSpaceView } from './server/routes/views';
+import { initEnterSpaceView } from './server/routes/views';
export interface LegacySpacesPlugin {
getSpaceId: (request: Legacy.Request) => ReturnType;
@@ -50,15 +50,7 @@ export const spaces = (kibana: Record) =>
uiExports: {
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
managementSections: [],
- apps: [
- {
- id: 'space_selector',
- title: 'Spaces',
- main: 'plugins/spaces/space_selector',
- url: 'space_selector',
- hidden: true,
- },
- ],
+ apps: [],
hacks: ['plugins/spaces/legacy'],
mappings,
migrations: {
@@ -135,7 +127,6 @@ export const spaces = (kibana: Record) =>
});
initEnterSpaceView(server);
- initSpaceSelectorView(server);
watchStatusAndLicenseToInitialize(server.plugins.xpack_main, this, async () => {
await createDefaultSpace();
diff --git a/x-pack/legacy/plugins/spaces/public/space_selector/index.tsx b/x-pack/legacy/plugins/spaces/public/space_selector/index.tsx
deleted file mode 100644
index 9a81248059faa..0000000000000
--- a/x-pack/legacy/plugins/spaces/public/space_selector/index.tsx
+++ /dev/null
@@ -1,40 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import chrome from 'ui/chrome';
-// @ts-ignore
-import { uiModules } from 'ui/modules';
-
-import React from 'react';
-import { render, unmountComponentAtNode } from 'react-dom';
-import { npStart } from 'ui/new_platform';
-import { SpacesPluginStart } from '../../../../../plugins/spaces/public';
-
-const spacesNPStart = (npStart.plugins as any).spaces as SpacesPluginStart;
-
-const module = uiModules.get('spaces_selector', []);
-module.controller('spacesSelectorController', ($scope: any) => {
- $scope.$$postDigest(() => {
- const domNode = document.getElementById('spaceSelectorRoot');
-
- const { SpaceSelector } = spacesNPStart.__legacyCompat;
-
- render(, domNode);
-
- // unmount react on controller destroy
- $scope.$on('$destroy', () => {
- if (domNode) {
- unmountComponentAtNode(domNode);
- }
- });
- });
-});
-
-chrome.setVisible(false).setRootTemplate(
- ``
-);
diff --git a/x-pack/legacy/plugins/spaces/server/routes/views/index.ts b/x-pack/legacy/plugins/spaces/server/routes/views/index.ts
index d7637e299652f..645e8bec48148 100644
--- a/x-pack/legacy/plugins/spaces/server/routes/views/index.ts
+++ b/x-pack/legacy/plugins/spaces/server/routes/views/index.ts
@@ -4,5 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export { initSpaceSelectorView } from './space_selector';
export { initEnterSpaceView } from './enter_space';
diff --git a/x-pack/legacy/plugins/spaces/server/routes/views/space_selector.ts b/x-pack/legacy/plugins/spaces/server/routes/views/space_selector.ts
deleted file mode 100644
index 25c4179b99542..0000000000000
--- a/x-pack/legacy/plugins/spaces/server/routes/views/space_selector.ts
+++ /dev/null
@@ -1,19 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { Legacy } from 'kibana';
-
-export function initSpaceSelectorView(server: Legacy.Server) {
- const spaceSelector = server.getHiddenUiAppById('space_selector');
-
- server.route({
- method: 'GET',
- path: '/spaces/space_selector',
- async handler(request, h) {
- return (await h.renderAppWithDefaultConfig(spaceSelector)).takeover();
- },
- });
-}
diff --git a/x-pack/plugins/spaces/public/plugin.tsx b/x-pack/plugins/spaces/public/plugin.tsx
index c274ed8d37cb1..836497e25ef50 100644
--- a/x-pack/plugins/spaces/public/plugin.tsx
+++ b/x-pack/plugins/spaces/public/plugin.tsx
@@ -16,7 +16,7 @@ import { createSpacesFeatureCatalogueEntry } from './create_feature_catalogue_en
import { CopySavedObjectsToSpaceService } from './copy_saved_objects_to_space';
import { AdvancedSettingsService } from './advanced_settings';
import { ManagementService } from './management';
-import { SpaceSelector } from './space_selector';
+import { SpaceSelector, spaceSelectorApp } from './space_selector';
export interface PluginsSetup {
home?: HomePublicPluginSetup;
@@ -64,6 +64,8 @@ export class SpacesPlugin implements Plugin {
const copySavedObjectsToSpaceService = new CopySavedObjectsToSpaceService();
diff --git a/x-pack/plugins/spaces/public/space_selector/index.tsx b/x-pack/plugins/spaces/public/space_selector/index.tsx
index 5ad44e49b8c53..d06472fe053d5 100644
--- a/x-pack/plugins/spaces/public/space_selector/index.tsx
+++ b/x-pack/plugins/spaces/public/space_selector/index.tsx
@@ -5,3 +5,4 @@
*/
export { SpaceSelector } from './space_selector';
+export { spaceSelectorApp } from './space_selector_app';
diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx
index c8a841da50838..c8173de1661be 100644
--- a/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx
+++ b/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx
@@ -18,9 +18,7 @@ function getSpacesManager(spaces: Space[] = []) {
test('it renders without crashing', () => {
const spacesManager = getSpacesManager();
- const component = shallowWithIntl(
-
- );
+ const component = shallowWithIntl();
expect(component).toMatchSnapshot();
});
@@ -36,9 +34,7 @@ test('it queries for spaces when loaded', () => {
const spacesManager = getSpacesManager(spaces);
- shallowWithIntl(
-
- );
+ shallowWithIntl();
return Promise.resolve().then(() => {
expect(spacesManager.getSpaces).toHaveBeenCalledTimes(1);
diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector.tsx
index 6dd521efd0bf6..262cc1941b4ab 100644
--- a/x-pack/plugins/spaces/public/space_selector/space_selector.tsx
+++ b/x-pack/plugins/spaces/public/space_selector/space_selector.tsx
@@ -18,8 +18,10 @@ import {
EuiTitle,
EuiLoadingSpinner,
} from '@elastic/eui';
-import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
+import { i18n } from '@kbn/i18n';
+import { FormattedMessage } from '@kbn/i18n/react';
import React, { Component, Fragment } from 'react';
+import ReactDOM from 'react-dom';
import { Space } from '../../common/model/space';
import { SpaceCards } from './components';
import { SPACE_SEARCH_COUNT_THRESHOLD } from '../../common/constants';
@@ -27,7 +29,6 @@ import { SpacesManager } from '../spaces_manager';
interface Props {
spacesManager: SpacesManager;
- intl: InjectedIntl;
}
interface State {
@@ -36,7 +37,7 @@ interface State {
spaces: Space[];
}
-class SpaceSelectorUI extends Component {
+export class SpaceSelector extends Component {
private headerRef?: HTMLElement | null;
constructor(props: Props) {
super(props);
@@ -152,7 +153,6 @@ class SpaceSelectorUI extends Component {
}
public getSearchField = () => {
- const { intl } = this.props;
if (!this.state.spaces || this.state.spaces.length < SPACE_SEARCH_COUNT_THRESHOLD) {
return null;
}
@@ -162,8 +162,7 @@ class SpaceSelectorUI extends Component {
// @ts-ignore onSearch doesn't exist on EuiFieldSearch
{
};
}
-export const SpaceSelector = injectI18n(SpaceSelectorUI);
+export const renderSpaceSelectorApp = (el: Element, props: Props) => {
+ ReactDOM.render(, el);
+ return () => ReactDOM.unmountComponentAtNode(el);
+};
diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector_app.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector_app.tsx
new file mode 100644
index 0000000000000..74c56027d6fc3
--- /dev/null
+++ b/x-pack/plugins/spaces/public/space_selector/space_selector_app.tsx
@@ -0,0 +1,32 @@
+/*
+ * 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 { CoreSetup, AppMountParameters } from 'src/core/public';
+import { i18n } from '@kbn/i18n';
+import { SpacesManager } from '../spaces_manager';
+
+interface CreateDeps {
+ application: CoreSetup['application'];
+ spacesManager: SpacesManager;
+}
+
+export const spaceSelectorApp = Object.freeze({
+ id: 'space_selector',
+ create({ application, spacesManager }: CreateDeps) {
+ application.register({
+ id: this.id,
+ title: i18n.translate('xpack.spaces.spaceSelector.appTitle', {
+ defaultMessage: 'Select a space',
+ }),
+ chromeless: true,
+ appRoute: '/spaces/space_selector',
+ mount: async (params: AppMountParameters) => {
+ const { renderSpaceSelectorApp } = await import('./space_selector');
+ return renderSpaceSelectorApp(params.element, { spacesManager });
+ },
+ });
+ },
+});
diff --git a/x-pack/plugins/spaces/server/plugin.ts b/x-pack/plugins/spaces/server/plugin.ts
index b8ef81c05f7aa..a8ece44749ee9 100644
--- a/x-pack/plugins/spaces/server/plugin.ts
+++ b/x-pack/plugins/spaces/server/plugin.ts
@@ -31,6 +31,7 @@ import { toggleUICapabilities } from './lib/toggle_ui_capabilities';
import { initSpacesRequestInterceptors } from './lib/request_interceptors';
import { initExternalSpacesApi } from './routes/api/external';
import { initInternalSpacesApi } from './routes/api/internal';
+import { initSpacesViewsRoutes } from './routes/views';
/**
* Describes a set of APIs that is available in the legacy platform only and required by this plugin
@@ -109,6 +110,12 @@ export class Plugin {
config$: this.config$,
});
+ const viewRouter = core.http.createRouter();
+ initSpacesViewsRoutes({
+ viewRouter,
+ cspHeader: core.http.csp.header,
+ });
+
const externalRouter = core.http.createRouter();
initExternalSpacesApi({
externalRouter,
diff --git a/x-pack/plugins/spaces/server/routes/views/index.ts b/x-pack/plugins/spaces/server/routes/views/index.ts
new file mode 100644
index 0000000000000..2a346c7e5241a
--- /dev/null
+++ b/x-pack/plugins/spaces/server/routes/views/index.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 { IRouter } from 'src/core/server';
+
+export interface ViewRouteDeps {
+ viewRouter: IRouter;
+ cspHeader: string;
+}
+
+export function initSpacesViewsRoutes(deps: ViewRouteDeps) {
+ deps.viewRouter.get(
+ {
+ path: '/spaces/space_selector',
+ validate: false,
+ },
+ async (context, request, response) => {
+ return response.ok({
+ headers: {
+ 'Content-Security-Policy': deps.cspHeader,
+ },
+ body: await context.core.rendering.render({ includeUserSettings: true }),
+ });
+ }
+ );
+}
From 5bdf2b9298d2f6f9c1ea4025612ca36adf5904aa Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Thu, 30 Jan 2020 11:38:31 -0500
Subject: [PATCH 09/21] remove unused xpackMain legacy dependency
---
x-pack/legacy/plugins/spaces/index.ts | 1 -
x-pack/plugins/spaces/server/plugin.ts | 2 --
.../spaces/server/routes/api/__fixtures__/create_legacy_api.ts | 1 -
3 files changed, 4 deletions(-)
diff --git a/x-pack/legacy/plugins/spaces/index.ts b/x-pack/legacy/plugins/spaces/index.ts
index f63f3910fc2f9..ab3388ae96475 100644
--- a/x-pack/legacy/plugins/spaces/index.ts
+++ b/x-pack/legacy/plugins/spaces/index.ts
@@ -123,7 +123,6 @@ export const spaces = (kibana: Record) =>
create: (pluginId: string) =>
new AuditLogger(server, pluginId, server.config(), server.plugins.xpack_main.info),
},
- xpackMain: server.plugins.xpack_main,
});
initEnterSpaceView(server);
diff --git a/x-pack/plugins/spaces/server/plugin.ts b/x-pack/plugins/spaces/server/plugin.ts
index a8ece44749ee9..b9a02d3976575 100644
--- a/x-pack/plugins/spaces/server/plugin.ts
+++ b/x-pack/plugins/spaces/server/plugin.ts
@@ -16,7 +16,6 @@ import {
import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server';
import { PluginSetupContract as SecurityPluginSetup } from '../../security/server';
import { LicensingPluginSetup } from '../../licensing/server';
-import { XPackMainPlugin } from '../../../legacy/plugins/xpack_main/server/xpack_main';
import { createDefaultSpace } from './lib/create_default_space';
// @ts-ignore
import { AuditLogger } from '../../../../server/lib/audit_logger';
@@ -45,7 +44,6 @@ export interface LegacyAPI {
legacyConfig: {
kibanaIndex: string;
};
- xpackMain: XPackMainPlugin;
}
export interface PluginsSetup {
diff --git a/x-pack/plugins/spaces/server/routes/api/__fixtures__/create_legacy_api.ts b/x-pack/plugins/spaces/server/routes/api/__fixtures__/create_legacy_api.ts
index dfeb094e34e25..812b02e94f591 100644
--- a/x-pack/plugins/spaces/server/routes/api/__fixtures__/create_legacy_api.ts
+++ b/x-pack/plugins/spaces/server/routes/api/__fixtures__/create_legacy_api.ts
@@ -104,7 +104,6 @@ export const createLegacyAPI = ({
kibanaIndex: '',
},
auditLogger: {} as any,
- xpackMain: {} as any,
savedObjects: savedObjectsService,
};
From 925ceed933797d6e67d82ea25409db5fb7c60562 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Thu, 30 Jan 2020 13:56:06 -0500
Subject: [PATCH 10/21] hide spaces management if not authorized
---
.../public/management/management_service.tsx | 16 ++++++++++++++--
x-pack/plugins/spaces/public/plugin.tsx | 4 ++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/x-pack/plugins/spaces/public/management/management_service.tsx b/x-pack/plugins/spaces/public/management/management_service.tsx
index 3a4c61992b411..1e516cbeddee9 100644
--- a/x-pack/plugins/spaces/public/management/management_service.tsx
+++ b/x-pack/plugins/spaces/public/management/management_service.tsx
@@ -5,7 +5,7 @@
*/
import { ManagementSetup, ManagementSection } from 'src/plugins/management/public';
-import { CoreSetup } from 'src/core/public';
+import { CoreSetup, Capabilities } from 'src/core/public';
import { SecurityPluginSetup } from '../../../security/public';
import { SpacesManager } from '../spaces_manager';
import { PluginsStart } from '../plugin';
@@ -17,6 +17,10 @@ interface SetupDeps {
spacesManager: SpacesManager;
securityLicense?: SecurityPluginSetup['license'];
}
+
+interface StartDeps {
+ capabilities: Capabilities;
+}
export class ManagementService {
private kibanaSection?: ManagementSection;
@@ -29,9 +33,17 @@ export class ManagementService {
}
}
- public start() {}
+ public start({ capabilities }: StartDeps) {
+ if (!capabilities.spaces.manage) {
+ this.disableSpacesApp();
+ }
+ }
public stop() {
+ this.disableSpacesApp();
+ }
+
+ private disableSpacesApp() {
if (this.kibanaSection) {
const spacesApp = this.kibanaSection.getApp(spacesManagementApp.id);
if (spacesApp) {
diff --git a/x-pack/plugins/spaces/public/plugin.tsx b/x-pack/plugins/spaces/public/plugin.tsx
index 836497e25ef50..a752a9e900454 100644
--- a/x-pack/plugins/spaces/public/plugin.tsx
+++ b/x-pack/plugins/spaces/public/plugin.tsx
@@ -99,6 +99,10 @@ export class SpacesPlugin implements Plugin this.spacesManager.getActiveSpace(),
From 03a122fc062ff2bcff9edad34c70f159c4137fec Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Fri, 31 Jan 2020 13:19:12 -0500
Subject: [PATCH 11/21] additional testing
---
src/plugins/home/public/mocks/index.ts | 36 ++++++++++
.../management/management_service.test.ts | 63 ++++++++++++++++
x-pack/plugins/spaces/public/plugin.test.ts | 72 +++++++++++++++++++
.../feature_controls/spaces_security.ts | 8 +--
4 files changed, 175 insertions(+), 4 deletions(-)
create mode 100644 src/plugins/home/public/mocks/index.ts
create mode 100644 x-pack/plugins/spaces/public/plugin.test.ts
diff --git a/src/plugins/home/public/mocks/index.ts b/src/plugins/home/public/mocks/index.ts
new file mode 100644
index 0000000000000..c79d36372b7b2
--- /dev/null
+++ b/src/plugins/home/public/mocks/index.ts
@@ -0,0 +1,36 @@
+/*
+ * 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 { featureCatalogueRegistryMock } from '../services/feature_catalogue/feature_catalogue_registry.mock';
+import { environmentServiceMock } from '../services/environment/environment.mock';
+
+const createSetupContract = () => ({
+ featureCatalogue: featureCatalogueRegistryMock.createSetup(),
+ environment: environmentServiceMock.createSetup(),
+});
+
+const createStartContract = () => ({
+ featureCatalogue: featureCatalogueRegistryMock.createStart(),
+ environment: environmentServiceMock.createStart(),
+});
+
+export const homePluginMock = {
+ createSetupContract,
+ createStartContract,
+};
diff --git a/x-pack/plugins/spaces/public/management/management_service.test.ts b/x-pack/plugins/spaces/public/management/management_service.test.ts
index 1941aa78c92b3..a8022e5b52643 100644
--- a/x-pack/plugins/spaces/public/management/management_service.test.ts
+++ b/x-pack/plugins/spaces/public/management/management_service.test.ts
@@ -9,6 +9,7 @@ import { coreMock } from 'src/core/public/mocks';
import { spacesManagerMock } from '../spaces_manager/mocks';
import { managementPluginMock } from '../../../../../src/plugins/management/public/mocks';
import { ManagementSection } from 'src/plugins/management/public';
+import { Capabilities } from 'kibana/public';
describe('ManagementService', () => {
describe('#setup', () => {
@@ -54,6 +55,68 @@ describe('ManagementService', () => {
});
});
+ describe('#start', () => {
+ it('disables the spaces management page if the user is not authorized', () => {
+ const mockSpacesManagementPage = { disable: jest.fn() };
+ const mockKibanaSection = ({
+ registerApp: jest.fn(),
+ getApp: jest
+ .fn()
+ .mockImplementation(id => (id === 'spaces' ? mockSpacesManagementPage : undefined)),
+ } as unknown) as ManagementSection;
+
+ const deps = {
+ management: managementPluginMock.createSetupContract(),
+ getStartServices: coreMock.createSetup().getStartServices,
+ spacesManager: spacesManagerMock.create(),
+ };
+
+ deps.management.sections.getSection.mockImplementation(id => {
+ if (id === 'kibana') return mockKibanaSection;
+ throw new Error(`unexpected getSection call: ${id}`);
+ });
+
+ const service = new ManagementService();
+ service.setup(deps);
+
+ const capabilities = ({ spaces: { manage: false } } as unknown) as Capabilities;
+ service.start({ capabilities });
+
+ expect(mockKibanaSection.registerApp).toHaveBeenCalledTimes(1);
+ expect(mockSpacesManagementPage.disable).toHaveBeenCalledTimes(1);
+ });
+
+ it('does not disable the spaces management page if the user is authorized', () => {
+ const mockSpacesManagementPage = { disable: jest.fn() };
+ const mockKibanaSection = ({
+ registerApp: jest.fn(),
+ getApp: jest
+ .fn()
+ .mockImplementation(id => (id === 'spaces' ? mockSpacesManagementPage : undefined)),
+ } as unknown) as ManagementSection;
+
+ const deps = {
+ management: managementPluginMock.createSetupContract(),
+ getStartServices: coreMock.createSetup().getStartServices,
+ spacesManager: spacesManagerMock.create(),
+ };
+
+ deps.management.sections.getSection.mockImplementation(id => {
+ if (id === 'kibana') return mockKibanaSection;
+ throw new Error(`unexpected getSection call: ${id}`);
+ });
+
+ const service = new ManagementService();
+ service.setup(deps);
+
+ const capabilities = ({ spaces: { manage: true } } as unknown) as Capabilities;
+ service.start({ capabilities });
+
+ expect(mockKibanaSection.registerApp).toHaveBeenCalledTimes(1);
+ expect(mockSpacesManagementPage.disable).toHaveBeenCalledTimes(0);
+ });
+ });
+
describe('#stop', () => {
it('disables the spaces management page', () => {
const mockSpacesManagementPage = { disable: jest.fn() };
diff --git a/x-pack/plugins/spaces/public/plugin.test.ts b/x-pack/plugins/spaces/public/plugin.test.ts
new file mode 100644
index 0000000000000..f7d1a908c3710
--- /dev/null
+++ b/x-pack/plugins/spaces/public/plugin.test.ts
@@ -0,0 +1,72 @@
+/*
+ * 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 { coreMock } from 'src/core/public/mocks';
+import { SpacesPlugin } from './plugin';
+import { homePluginMock } from '../../../../src/plugins/home/public/mocks';
+import { managementPluginMock } from '../../../../src/plugins/management/public/mocks';
+
+describe('Spaces plugin', () => {
+ describe('#setup', () => {
+ it('should register the space selector app', () => {
+ const coreSetup = coreMock.createSetup();
+
+ const plugin = new SpacesPlugin();
+ plugin.setup(coreSetup, {});
+
+ expect(coreSetup.application.register).toHaveBeenCalledWith(
+ expect.objectContaining({
+ id: 'space_selector',
+ chromeless: true,
+ appRoute: '/spaces/space_selector',
+ mount: expect.any(Function),
+ })
+ );
+ });
+
+ it('should register the management and feature catalogue sections when the management and home plugins are both available', () => {
+ const coreSetup = coreMock.createSetup();
+
+ const registerApp = jest.fn();
+
+ const home = homePluginMock.createSetupContract();
+
+ const management = managementPluginMock.createSetupContract();
+ management.sections.getSection.mockReturnValue({ registerApp });
+
+ const plugin = new SpacesPlugin();
+ plugin.setup(coreSetup, {
+ management,
+ home,
+ });
+
+ expect(registerApp).toHaveBeenCalledWith(expect.objectContaining({ id: 'spaces' }));
+
+ expect(home.featureCatalogue.register).toHaveBeenCalledWith(
+ expect.objectContaining({
+ category: 'admin',
+ icon: 'spacesApp',
+ id: 'spaces',
+ showOnHomePage: true,
+ })
+ );
+ });
+ });
+
+ describe('#start', () => {
+ it('should register the spaces nav control', () => {
+ const coreSetup = coreMock.createSetup();
+ const coreStart = coreMock.createStart();
+
+ const plugin = new SpacesPlugin();
+ plugin.setup(coreSetup, {});
+
+ plugin.start(coreStart, {});
+
+ expect(coreStart.chrome.navControls.registerLeft).toHaveBeenCalled();
+ });
+ });
+});
diff --git a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts
index 0006f53ce3bf0..9ca314ba5ec18 100644
--- a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts
+++ b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts
@@ -140,7 +140,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it(`doesn't display Spaces management section`, async () => {
await PageObjects.settings.navigateTo();
- await testSubjects.existOrFail('objects'); // this ensures we've gotten to the management page
+ await testSubjects.existOrFail('management-landing'); // this ensures we've gotten to the management page
await testSubjects.missingOrFail('spaces');
});
@@ -150,7 +150,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
shouldLoginIfPrompted: false,
});
- await testSubjects.existOrFail('homeApp');
+ await testSubjects.existOrFail('management-landing');
});
it(`can't navigate to create new space page`, async () => {
@@ -159,7 +159,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
shouldLoginIfPrompted: false,
});
- await testSubjects.existOrFail('homeApp');
+ await testSubjects.existOrFail('management-landing');
});
it(`can't navigate to edit space page`, async () => {
@@ -172,7 +172,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
}
);
- await testSubjects.existOrFail('homeApp');
+ await testSubjects.existOrFail('management-landing');
});
});
});
From 95d390ef55b3b26ee596984eb55d18a0111a4a39 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Fri, 31 Jan 2020 13:28:44 -0500
Subject: [PATCH 12/21] additional cleanup
---
x-pack/plugins/spaces/public/plugin.tsx | 10 +---------
x-pack/plugins/spaces/public/space_selector/index.tsx | 1 -
2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/x-pack/plugins/spaces/public/plugin.tsx b/x-pack/plugins/spaces/public/plugin.tsx
index a752a9e900454..5de284ed05ea8 100644
--- a/x-pack/plugins/spaces/public/plugin.tsx
+++ b/x-pack/plugins/spaces/public/plugin.tsx
@@ -16,7 +16,7 @@ import { createSpacesFeatureCatalogueEntry } from './create_feature_catalogue_en
import { CopySavedObjectsToSpaceService } from './copy_saved_objects_to_space';
import { AdvancedSettingsService } from './advanced_settings';
import { ManagementService } from './management';
-import { SpaceSelector, spaceSelectorApp } from './space_selector';
+import { spaceSelectorApp } from './space_selector';
export interface PluginsSetup {
home?: HomePublicPluginSetup;
@@ -106,14 +106,6 @@ export class SpacesPlugin implements Plugin this.spacesManager.getActiveSpace(),
- __legacyCompat: {
- SpaceSelector: () => (
-
-
-
- ),
- spacesManager: this.spacesManager,
- },
};
}
diff --git a/x-pack/plugins/spaces/public/space_selector/index.tsx b/x-pack/plugins/spaces/public/space_selector/index.tsx
index d06472fe053d5..b99689cbabab1 100644
--- a/x-pack/plugins/spaces/public/space_selector/index.tsx
+++ b/x-pack/plugins/spaces/public/space_selector/index.tsx
@@ -4,5 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export { SpaceSelector } from './space_selector';
export { spaceSelectorApp } from './space_selector_app';
From 73cc2663389f2de9cda354d2fbe36aaeff335ae7 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Mon, 3 Feb 2020 11:39:56 -0500
Subject: [PATCH 13/21] additional testing
---
.../security/common/licensing/index.ts | 2 +
x-pack/plugins/security/public/index.ts | 2 +-
x-pack/plugins/security/public/mocks.ts | 2 +
.../management/spaces_management_app.test.tsx | 137 ++++++++++++++++++
.../management/spaces_management_app.tsx | 2 +-
5 files changed, 143 insertions(+), 2 deletions(-)
create mode 100644 x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx
diff --git a/x-pack/plugins/security/common/licensing/index.ts b/x-pack/plugins/security/common/licensing/index.ts
index 9ddbe86167367..e8efae3dc6a6b 100644
--- a/x-pack/plugins/security/common/licensing/index.ts
+++ b/x-pack/plugins/security/common/licensing/index.ts
@@ -5,3 +5,5 @@
*/
export { SecurityLicenseService, SecurityLicense } from './license_service';
+
+export { SecurityLicenseFeatures } from './license_features';
diff --git a/x-pack/plugins/security/public/index.ts b/x-pack/plugins/security/public/index.ts
index 58a802341882d..712f49afd306e 100644
--- a/x-pack/plugins/security/public/index.ts
+++ b/x-pack/plugins/security/public/index.ts
@@ -10,7 +10,7 @@ import { SecurityPlugin, SecurityPluginSetup, SecurityPluginStart } from './plug
export { SecurityPluginSetup, SecurityPluginStart };
export { SessionInfo } from './types';
export { AuthenticatedUser } from '../common/model';
-export { SecurityLicense } from '../common/licensing';
+export { SecurityLicense, SecurityLicenseFeatures } from '../common/licensing';
export const plugin: PluginInitializer = () =>
new SecurityPlugin();
diff --git a/x-pack/plugins/security/public/mocks.ts b/x-pack/plugins/security/public/mocks.ts
index 3c0c59d10abd1..33c1d1446afba 100644
--- a/x-pack/plugins/security/public/mocks.ts
+++ b/x-pack/plugins/security/public/mocks.ts
@@ -6,11 +6,13 @@
import { authenticationMock } from './authentication/index.mock';
import { createSessionTimeoutMock } from './session/session_timeout.mock';
+import { licenseMock } from '../common/licensing/index.mock';
function createSetupMock() {
return {
authc: authenticationMock.createSetup(),
sessionTimeout: createSessionTimeoutMock(),
+ license: licenseMock.create(),
};
}
diff --git a/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx b/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx
new file mode 100644
index 0000000000000..b19ef995283da
--- /dev/null
+++ b/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ */
+
+jest.mock('./spaces_grid', () => ({
+ SpacesGridPage: (props: any) => `Spaces Page: ${JSON.stringify(props)}`,
+}));
+
+jest.mock('./edit_space', () => ({
+ ManageSpacePage: (props: any) => {
+ if (props.spacesManager && props.onLoadSpace) {
+ props.spacesManager.getSpace().then((space: any) => props.onLoadSpace(space));
+ }
+ return `Spaces Edit Page: ${JSON.stringify(props)}`;
+ },
+}));
+
+import { spacesManagementApp } from './spaces_management_app';
+
+import { coreMock } from '../../../../../src/core/public/mocks';
+import { securityMock } from '../../../security/public/mocks';
+import { spacesManagerMock } from '../spaces_manager/mocks';
+import { SecurityLicenseFeatures } from '../../../security/public';
+
+async function mountApp(basePath: string, spaceId?: string) {
+ const container = document.createElement('div');
+ const setBreadcrumbs = jest.fn();
+
+ const spacesManager = spacesManagerMock.create();
+ if (spaceId) {
+ spacesManager.getSpace.mockResolvedValue({
+ id: spaceId,
+ name: `space with id ${spaceId}`,
+ disabledFeatures: [],
+ });
+ }
+
+ const securityLicense = securityMock.createSetup().license;
+ securityLicense.getFeatures.mockReturnValue({
+ showLinks: true,
+ } as SecurityLicenseFeatures);
+
+ const unmount = await spacesManagementApp
+ .create({
+ spacesManager,
+ securityLicense,
+ getStartServices: coreMock.createSetup().getStartServices as any,
+ })
+ .mount({ basePath, element: container, setBreadcrumbs });
+
+ return { unmount, container, setBreadcrumbs };
+}
+
+describe('spacesManagementApp', () => {
+ it('create() returns proper management app descriptor', () => {
+ expect(
+ spacesManagementApp.create({
+ spacesManager: spacesManagerMock.create(),
+ securityLicense: securityMock.createSetup().license,
+ getStartServices: coreMock.createSetup().getStartServices as any,
+ })
+ ).toMatchInlineSnapshot(`
+ Object {
+ "id": "spaces",
+ "mount": [Function],
+ "order": 10,
+ "title": "Spaces",
+ }
+ `);
+ });
+
+ it('mount() works for the `grid` page', async () => {
+ const basePath = '/some-base-path/spaces';
+ window.location.hash = basePath;
+
+ const { setBreadcrumbs, container, unmount } = await mountApp(basePath);
+
+ expect(setBreadcrumbs).toHaveBeenCalledTimes(1);
+ expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `#${basePath}`, text: 'Spaces' }]);
+ expect(container).toMatchInlineSnapshot(`
+
+ Spaces Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"http":{"basePath":{"basePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{"_isScalar":false}},"securityEnabled":true}
+
+ `);
+
+ unmount();
+
+ expect(container).toMatchInlineSnapshot(``);
+ });
+
+ it('mount() works for the `create space` page', async () => {
+ const basePath = '/some-base-path/spaces';
+ window.location.hash = `${basePath}/create`;
+
+ const { setBreadcrumbs, container, unmount } = await mountApp(basePath);
+
+ expect(setBreadcrumbs).toHaveBeenCalledTimes(1);
+ expect(setBreadcrumbs).toHaveBeenCalledWith([
+ { href: `#${basePath}`, text: 'Spaces' },
+ { text: 'Create' },
+ ]);
+ expect(container).toMatchInlineSnapshot(`
+
+ Spaces Edit Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"http":{"basePath":{"basePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{"_isScalar":false}},"securityEnabled":true}
+
+ `);
+
+ unmount();
+
+ expect(container).toMatchInlineSnapshot(``);
+ });
+
+ it('mount() works for the `edit space` page', async () => {
+ const basePath = '/some-base-path/spaces';
+ const spaceId = 'some-space';
+ window.location.hash = `${basePath}/edit/${spaceId}`;
+
+ const { setBreadcrumbs, container, unmount } = await mountApp(basePath, spaceId);
+
+ expect(setBreadcrumbs).toHaveBeenCalledTimes(1);
+ expect(setBreadcrumbs).toHaveBeenCalledWith([
+ { href: `#${basePath}`, text: 'Spaces' },
+ { href: `#/some-base-path/spaces/edit/${spaceId}`, text: `space with id some-space` },
+ ]);
+ expect(container).toMatchInlineSnapshot(`
+
+ Spaces Edit Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"http":{"basePath":{"basePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{"_isScalar":false}},"spaceId":"some-space","securityEnabled":true}
+
+ `);
+
+ unmount();
+
+ expect(container).toMatchInlineSnapshot(``);
+ });
+});
diff --git a/x-pack/plugins/spaces/public/management/spaces_management_app.tsx b/x-pack/plugins/spaces/public/management/spaces_management_app.tsx
index 4f9654f76b312..a524d7f9829de 100644
--- a/x-pack/plugins/spaces/public/management/spaces_management_app.tsx
+++ b/x-pack/plugins/spaces/public/management/spaces_management_app.tsx
@@ -113,7 +113,7 @@ export const spacesManagementApp = Object.freeze({
-
+
From dca42cc6830e1e52addae4008e6a6cbcef66657c Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Tue, 4 Feb 2020 15:54:11 -0500
Subject: [PATCH 14/21] use NP advancedSettings plugin
---
.../default_component_registry.d.ts | 22 -----------------
src/plugins/advanced_settings/public/mocks.ts | 4 ++--
src/plugins/home/public/mocks/index.ts | 2 ++
x-pack/legacy/plugins/spaces/public/legacy.ts | 16 +++++++------
x-pack/plugins/spaces/kibana.json | 2 +-
.../advanced_settings_service.test.tsx | 8 +++----
.../advanced_settings_service.tsx | 8 +------
x-pack/plugins/spaces/public/plugin.test.ts | 24 +++++++++++++++++++
x-pack/plugins/spaces/public/plugin.tsx | 22 ++++++++---------
9 files changed, 53 insertions(+), 55 deletions(-)
delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/settings/components/default_component_registry.d.ts
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/default_component_registry.d.ts b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/default_component_registry.d.ts
deleted file mode 100644
index b8e6bf3178d20..0000000000000
--- a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/default_component_registry.d.ts
+++ /dev/null
@@ -1,22 +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 const PAGE_TITLE_COMPONENT: string;
-export const PAGE_SUBTITLE_COMPONENT: string;
-export const PAGE_FOOTER_COMPONENT: string;
diff --git a/src/plugins/advanced_settings/public/mocks.ts b/src/plugins/advanced_settings/public/mocks.ts
index e147f57101aae..b44561959cbd3 100644
--- a/src/plugins/advanced_settings/public/mocks.ts
+++ b/src/plugins/advanced_settings/public/mocks.ts
@@ -25,9 +25,9 @@ const componentType = ComponentRegistry.componentType;
export const advancedSettingsMock = {
createSetupContract() {
- return { register, componentType };
+ return { component: { register, componentType } };
},
createStartContract() {
- return { get, componentType };
+ return { component: { get, componentType } };
},
};
diff --git a/src/plugins/home/public/mocks/index.ts b/src/plugins/home/public/mocks/index.ts
index c79d36372b7b2..dead50230ec85 100644
--- a/src/plugins/home/public/mocks/index.ts
+++ b/src/plugins/home/public/mocks/index.ts
@@ -19,10 +19,12 @@
import { featureCatalogueRegistryMock } from '../services/feature_catalogue/feature_catalogue_registry.mock';
import { environmentServiceMock } from '../services/environment/environment.mock';
+import { configSchema } from '../../config';
const createSetupContract = () => ({
featureCatalogue: featureCatalogueRegistryMock.createSetup(),
environment: environmentServiceMock.createSetup(),
+ config: configSchema.validate({}),
});
const createStartContract = () => ({
diff --git a/x-pack/legacy/plugins/spaces/public/legacy.ts b/x-pack/legacy/plugins/spaces/public/legacy.ts
index 6e533b50a6a38..1404bf50edbe5 100644
--- a/x-pack/legacy/plugins/spaces/public/legacy.ts
+++ b/x-pack/legacy/plugins/spaces/public/legacy.ts
@@ -4,13 +4,15 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { npSetup, npStart } from 'ui/new_platform';
+import { SavedObjectsManagementAction } from 'src/legacy/core_plugins/management/public';
+import { npSetup } from 'ui/new_platform';
+import { SpacesPluginSetup } from '../../../../plugins/spaces/public';
import { setup as managementSetup } from '../../../../../src/legacy/core_plugins/management/public/legacy';
-const spacesPlugin: SpacesPlugin = plugin();
-
-const pluginsSetup: PluginsSetup = {
- home: npSetup.plugins.home,
- management: managementSetup,
- advancedSettings: npSetup.plugins.advancedSettings,
+const legacyAPI = {
+ registerSavedObjectsManagementAction: (action: SavedObjectsManagementAction) => {
+ managementSetup.savedObjects.registry.register(action);
+ },
};
+
+((npSetup.plugins as any).spaces as SpacesPluginSetup).registerLegacyAPI(legacyAPI);
diff --git a/x-pack/plugins/spaces/kibana.json b/x-pack/plugins/spaces/kibana.json
index 6d018dfc071ab..4242d2f5c5d09 100644
--- a/x-pack/plugins/spaces/kibana.json
+++ b/x-pack/plugins/spaces/kibana.json
@@ -4,7 +4,7 @@
"kibanaVersion": "kibana",
"configPath": ["xpack", "spaces"],
"requiredPlugins": ["features", "licensing"],
- "optionalPlugins": ["management", "security", "home", "usageCollection"],
+ "optionalPlugins": ["advancedSettings", "home", "management", "security", "usageCollection"],
"server": true,
"ui": true
}
diff --git a/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx b/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx
index 3c6b2332bbbdc..08cc0a638cd78 100644
--- a/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx
+++ b/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx
@@ -5,7 +5,7 @@
*/
import { AdvancedSettingsService } from './advanced_settings_service';
-import { advancedSettingsMock } from '../../../../../../src/plugins/advanced_settings/public/mocks';
+import { advancedSettingsMock } from '../../../../../src/plugins/advanced_settings/public/mocks';
const componentRegistryMock = advancedSettingsMock.createSetupContract();
@@ -14,7 +14,7 @@ describe('Advanced Settings Service', () => {
it('registers space-aware components to augment the advanced settings screen', () => {
const deps = {
getActiveSpace: jest.fn().mockResolvedValue({ id: 'foo', name: 'foo-space' }),
- componentRegistry: componentRegistryMock,
+ componentRegistry: componentRegistryMock.component,
};
const advancedSettingsService = new AdvancedSettingsService();
@@ -22,13 +22,13 @@ describe('Advanced Settings Service', () => {
expect(deps.componentRegistry.register).toHaveBeenCalledTimes(2);
expect(deps.componentRegistry.register).toHaveBeenCalledWith(
- componentRegistryMock.componentType.PAGE_TITLE_COMPONENT,
+ componentRegistryMock.component.componentType.PAGE_TITLE_COMPONENT,
expect.any(Function),
true
);
expect(deps.componentRegistry.register).toHaveBeenCalledWith(
- componentRegistryMock.componentType.PAGE_SUBTITLE_COMPONENT,
+ componentRegistryMock.component.componentType.PAGE_SUBTITLE_COMPONENT,
expect.any(Function),
true
);
diff --git a/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx b/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx
index 3ba9c338c8faf..5dedb285014f8 100644
--- a/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx
+++ b/x-pack/plugins/spaces/public/advanced_settings/advanced_settings_service.tsx
@@ -4,15 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
+import { AdvancedSettingsSetup } from 'src/plugins/advanced_settings/public';
import { Space } from '../../common/model/space';
import { AdvancedSettingsTitle, AdvancedSettingsSubtitle } from './components';
-import { AdvancedSettingsSetup } from '../../../../../../src/plugins/advanced_settings/public';
-
-// TODO: LP imported from ui/management, but that's not available here. Need NP replacement for these string constants
-import {
- PAGE_TITLE_COMPONENT,
- PAGE_SUBTITLE_COMPONENT,
-} from '../../../../../src/legacy/core_plugins/kibana/public/management/sections/settings/components/default_component_registry';
interface SetupDeps {
getActiveSpace: () => Promise;
diff --git a/x-pack/plugins/spaces/public/plugin.test.ts b/x-pack/plugins/spaces/public/plugin.test.ts
index f7d1a908c3710..0f2d0f08c2eaf 100644
--- a/x-pack/plugins/spaces/public/plugin.test.ts
+++ b/x-pack/plugins/spaces/public/plugin.test.ts
@@ -8,6 +8,7 @@ import { coreMock } from 'src/core/public/mocks';
import { SpacesPlugin } from './plugin';
import { homePluginMock } from '../../../../src/plugins/home/public/mocks';
import { managementPluginMock } from '../../../../src/plugins/management/public/mocks';
+import { advancedSettingsMock } from '../../../../src/plugins/advanced_settings/public/mocks';
describe('Spaces plugin', () => {
describe('#setup', () => {
@@ -54,6 +55,29 @@ describe('Spaces plugin', () => {
})
);
});
+
+ it('should register the advanced settings components if the advanced_settings plugin is available', () => {
+ const coreSetup = coreMock.createSetup();
+ const advancedSettings = advancedSettingsMock.createSetupContract();
+
+ const plugin = new SpacesPlugin();
+ plugin.setup(coreSetup, { advancedSettings });
+
+ expect(advancedSettings.component.register.mock.calls).toMatchInlineSnapshot(`
+ Array [
+ Array [
+ "advanced_settings_page_title",
+ [Function],
+ true,
+ ],
+ Array [
+ "advanced_settings_page_subtitle",
+ [Function],
+ true,
+ ],
+ ]
+ `);
+ });
});
describe('#start', () => {
diff --git a/x-pack/plugins/spaces/public/plugin.tsx b/x-pack/plugins/spaces/public/plugin.tsx
index 5de284ed05ea8..c5d9c22dbbef7 100644
--- a/x-pack/plugins/spaces/public/plugin.tsx
+++ b/x-pack/plugins/spaces/public/plugin.tsx
@@ -8,7 +8,7 @@ import { CoreSetup, CoreStart, Plugin } from 'src/core/public';
import { HomePublicPluginSetup } from 'src/plugins/home/public';
import { SavedObjectsManagementAction } from 'src/legacy/core_plugins/management/public';
import { ManagementStart, ManagementSetup } from 'src/plugins/management/public';
-import React from 'react';
+import { AdvancedSettingsSetup } from 'src/plugins/advanced_settings/public';
import { SecurityPluginStart, SecurityPluginSetup } from '../../security/public';
import { SpacesManager } from './spaces_manager';
import { initSpacesNavControl } from './nav_control';
@@ -19,6 +19,7 @@ import { ManagementService } from './management';
import { spaceSelectorApp } from './space_selector';
export interface PluginsSetup {
+ advancedSettings?: AdvancedSettingsSetup;
home?: HomePublicPluginSetup;
management?: ManagementSetup;
security?: SecurityPluginSetup;
@@ -31,11 +32,6 @@ export interface PluginsStart {
interface LegacyAPI {
registerSavedObjectsManagementAction: (action: SavedObjectsManagementAction) => void;
- registerSettingsComponent: (
- id: string,
- component: string | React.FC,
- allowOverride: boolean
- ) => void;
}
export type SpacesPluginSetup = ReturnType;
@@ -64,6 +60,14 @@ export class SpacesPlugin implements Plugin this.spacesManager.getActiveSpace(),
+ componentRegistry: plugins.advancedSettings.component,
+ });
+ }
+
spaceSelectorApp.create({ application: core.application, spacesManager: this.spacesManager });
return {
@@ -86,12 +90,6 @@ export class SpacesPlugin implements Plugin this.spacesManager.getActiveSpace(),
- registerSettingsComponent: legacyAPI.registerSettingsComponent,
- });
},
};
}
From 35b81ea9f7a03028c89a3c2a321f6c49d6464d52 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Wed, 5 Feb 2020 12:55:52 -0500
Subject: [PATCH 15/21] Apply suggestions from code review
Co-Authored-By: Aleh Zasypkin
---
.../copy_saved_objects_to_space_service.test.ts | 2 +-
.../public/management/edit_space/delete_spaces_button.test.tsx | 2 +-
.../plugins/spaces/public/management/spaces_management_app.tsx | 2 +-
x-pack/plugins/spaces/public/plugin.tsx | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
index 7b27466a6b4cf..bb645243a4b4f 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
@@ -16,7 +16,7 @@ describe('CopySavedObjectsToSpaceService', () => {
it('registers the CopyToSpaceSavedObjectsManagementAction', () => {
const deps = {
spacesManager: spacesManagerMock.create(),
- notificationsSetup: (notificationServiceMock.create()
+ notificationsSetup: notificationServiceMock.createSetupContract()
.setup as unknown) as NotificationsSetup,
// we don't have a proper NP mock for this yet
managementSetup: ({
diff --git a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
index 2d3ae53a9f857..d72ed04f5e54a 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
@@ -22,7 +22,7 @@ describe('DeleteSpacesButton', () => {
it('renders as expected', () => {
const spacesManager = spacesManagerMock.create();
- const notificatons = (notificationServiceMock.create().start as unknown) as NotificationsStart;
+ const notifications = notificationServiceMock.createStartContract();
const wrapper = shallowWithIntl(
);
};
diff --git a/x-pack/plugins/spaces/public/plugin.tsx b/x-pack/plugins/spaces/public/plugin.tsx
index 5de284ed05ea8..b36b4fef26441 100644
--- a/x-pack/plugins/spaces/public/plugin.tsx
+++ b/x-pack/plugins/spaces/public/plugin.tsx
@@ -60,7 +60,7 @@ export class SpacesPlugin implements Plugin
Date: Wed, 5 Feb 2020 13:51:55 -0500
Subject: [PATCH 16/21] start addressing PR feedback
---
src/plugins/management/public/mocks/index.ts | 5 +++++
.../account_management_page.test.tsx | 3 +--
.../users/edit_user/edit_user_page.test.tsx | 3 +--
...opy_saved_objects_to_space_service.test.ts | 4 +---
.../edit_space/delete_spaces_button.test.tsx | 3 +--
.../management/management_service.test.ts | 20 ++++---------------
.../public/management/management_service.tsx | 17 +++++++---------
x-pack/plugins/spaces/public/plugin.tsx | 8 ++++++--
.../public/space_selector/space_selector.tsx | 10 ++++++++--
.../space_selector/space_selector_app.tsx | 10 +++++++---
10 files changed, 41 insertions(+), 42 deletions(-)
diff --git a/src/plugins/management/public/mocks/index.ts b/src/plugins/management/public/mocks/index.ts
index 151c6611df6b9..a495f7432272c 100644
--- a/src/plugins/management/public/mocks/index.ts
+++ b/src/plugins/management/public/mocks/index.ts
@@ -28,6 +28,11 @@ const createSetupContract = () => ({
const createStartContract = () => ({
legacy: {},
+ sections: {
+ getSection: jest.fn(),
+ getAllSections: jest.fn(),
+ navigateToApp: jest.fn(),
+ },
});
export const managementPluginMock = {
diff --git a/x-pack/plugins/security/public/account_management/account_management_page.test.tsx b/x-pack/plugins/security/public/account_management/account_management_page.test.tsx
index 9bdf640018999..5e28295957c05 100644
--- a/x-pack/plugins/security/public/account_management/account_management_page.test.tsx
+++ b/x-pack/plugins/security/public/account_management/account_management_page.test.tsx
@@ -11,7 +11,6 @@ import { AccountManagementPage } from './account_management_page';
import { coreMock } from 'src/core/public/mocks';
import { securityMock } from '../mocks';
import { userAPIClientMock } from '../management/users/index.mock';
-import { SecurityPluginSetup } from '..';
interface Options {
withFullName?: boolean;
@@ -39,7 +38,7 @@ const createUser = ({ withFullName = true, withEmail = true, realm = 'native' }:
function getSecuritySetupMock({ currentUser }: { currentUser: AuthenticatedUser }) {
const securitySetupMock = securityMock.createSetup();
securitySetupMock.authc.getCurrentUser.mockResolvedValue(currentUser);
- return (securitySetupMock as unknown) as SecurityPluginSetup;
+ return securitySetupMock;
}
describe('', () => {
diff --git a/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx b/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx
index 871a4d3fb4a0a..7a7542909431f 100644
--- a/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx
+++ b/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx
@@ -15,7 +15,6 @@ import { mockAuthenticatedUser } from '../../../../common/model/authenticated_us
import { securityMock } from '../../../mocks';
import { rolesAPIClientMock } from '../../roles/index.mock';
import { userAPIClientMock } from '../index.mock';
-import { SecurityPluginSetup } from '../../..';
const createUser = (username: string) => {
const user: User = {
@@ -71,7 +70,7 @@ function buildSecuritySetup() {
securitySetupMock.authc.getCurrentUser.mockResolvedValue(
mockAuthenticatedUser(createUser('current_user'))
);
- return (securitySetupMock as unknown) as SecurityPluginSetup;
+ return securitySetupMock;
}
function expectSaveButton(wrapper: ReactWrapper) {
diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
index bb645243a4b4f..2603f80a19520 100644
--- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
+++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts
@@ -9,15 +9,13 @@ import { CopyToSpaceSavedObjectsManagementAction } from './copy_saved_objects_to
import { spacesManagerMock } from '../spaces_manager/mocks';
import { CopySavedObjectsToSpaceService } from '.';
import { notificationServiceMock } from 'src/core/public/mocks';
-import { NotificationsSetup } from 'src/core/public';
describe('CopySavedObjectsToSpaceService', () => {
describe('#setup', () => {
it('registers the CopyToSpaceSavedObjectsManagementAction', () => {
const deps = {
spacesManager: spacesManagerMock.create(),
- notificationsSetup: notificationServiceMock.createSetupContract()
- .setup as unknown) as NotificationsSetup,
+ notificationsSetup: notificationServiceMock.createSetupContract(),
// we don't have a proper NP mock for this yet
managementSetup: ({
savedObjects: {
diff --git a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
index d72ed04f5e54a..e71607ebf41ff 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx
@@ -10,7 +10,6 @@ import { DeleteSpacesButton } from './delete_spaces_button';
import { spacesManagerMock } from '../../spaces_manager/mocks';
import { SpacesManager } from '../../spaces_manager';
import { notificationServiceMock } from 'src/core/public/mocks';
-import { NotificationsStart } from 'src/core/public';
const space = {
id: 'my-space',
@@ -30,7 +29,7 @@ describe('DeleteSpacesButton', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
onDelete={jest.fn()}
intl={null as any}
- notifications={notificatons}
+ notifications={notifications}
/>
);
expect(wrapper).toMatchSnapshot();
diff --git a/x-pack/plugins/spaces/public/management/management_service.test.ts b/x-pack/plugins/spaces/public/management/management_service.test.ts
index a8022e5b52643..d4c6bdaea2776 100644
--- a/x-pack/plugins/spaces/public/management/management_service.test.ts
+++ b/x-pack/plugins/spaces/public/management/management_service.test.ts
@@ -23,10 +23,7 @@ describe('ManagementService', () => {
spacesManager: spacesManagerMock.create(),
};
- deps.management.sections.getSection.mockImplementation(id => {
- if (id === 'kibana') return mockKibanaSection;
- throw new Error(`unexpected getSection call: ${id}`);
- });
+ deps.management.sections.getSection.mockReturnValue(mockKibanaSection);
const service = new ManagementService();
service.setup(deps);
@@ -59,10 +56,7 @@ describe('ManagementService', () => {
it('disables the spaces management page if the user is not authorized', () => {
const mockSpacesManagementPage = { disable: jest.fn() };
const mockKibanaSection = ({
- registerApp: jest.fn(),
- getApp: jest
- .fn()
- .mockImplementation(id => (id === 'spaces' ? mockSpacesManagementPage : undefined)),
+ registerApp: jest.fn().mockReturnValue(mockSpacesManagementPage),
} as unknown) as ManagementSection;
const deps = {
@@ -89,10 +83,7 @@ describe('ManagementService', () => {
it('does not disable the spaces management page if the user is authorized', () => {
const mockSpacesManagementPage = { disable: jest.fn() };
const mockKibanaSection = ({
- registerApp: jest.fn(),
- getApp: jest
- .fn()
- .mockImplementation(id => (id === 'spaces' ? mockSpacesManagementPage : undefined)),
+ registerApp: jest.fn().mockReturnValue(mockSpacesManagementPage),
} as unknown) as ManagementSection;
const deps = {
@@ -121,10 +112,7 @@ describe('ManagementService', () => {
it('disables the spaces management page', () => {
const mockSpacesManagementPage = { disable: jest.fn() };
const mockKibanaSection = ({
- registerApp: jest.fn(),
- getApp: jest
- .fn()
- .mockImplementation(id => (id === 'spaces' ? mockSpacesManagementPage : undefined)),
+ registerApp: jest.fn().mockReturnValue(mockSpacesManagementPage),
} as unknown) as ManagementSection;
const deps = {
diff --git a/x-pack/plugins/spaces/public/management/management_service.tsx b/x-pack/plugins/spaces/public/management/management_service.tsx
index 1e516cbeddee9..1d2ed1bab8791 100644
--- a/x-pack/plugins/spaces/public/management/management_service.tsx
+++ b/x-pack/plugins/spaces/public/management/management_service.tsx
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { ManagementSetup, ManagementSection } from 'src/plugins/management/public';
+import { ManagementSetup, ManagementApp } from 'src/plugins/management/public';
import { CoreSetup, Capabilities } from 'src/core/public';
import { SecurityPluginSetup } from '../../../security/public';
import { SpacesManager } from '../spaces_manager';
@@ -22,12 +22,12 @@ interface StartDeps {
capabilities: Capabilities;
}
export class ManagementService {
- private kibanaSection?: ManagementSection;
+ private registeredSpacesManagementApp?: ManagementApp;
public setup({ getStartServices, management, spacesManager, securityLicense }: SetupDeps) {
- this.kibanaSection = management.sections.getSection('kibana');
- if (this.kibanaSection) {
- this.kibanaSection.registerApp(
+ const kibanaSection = management.sections.getSection('kibana');
+ if (kibanaSection) {
+ this.registeredSpacesManagementApp = kibanaSection.registerApp(
spacesManagementApp.create({ getStartServices, spacesManager, securityLicense })
);
}
@@ -44,11 +44,8 @@ export class ManagementService {
}
private disableSpacesApp() {
- if (this.kibanaSection) {
- const spacesApp = this.kibanaSection.getApp(spacesManagementApp.id);
- if (spacesApp) {
- spacesApp.disable();
- }
+ if (this.registeredSpacesManagementApp) {
+ this.registeredSpacesManagementApp.disable();
}
}
}
diff --git a/x-pack/plugins/spaces/public/plugin.tsx b/x-pack/plugins/spaces/public/plugin.tsx
index 566c1fcd6c388..25f3daf5b266c 100644
--- a/x-pack/plugins/spaces/public/plugin.tsx
+++ b/x-pack/plugins/spaces/public/plugin.tsx
@@ -43,7 +43,7 @@ export class SpacesPlugin implements Plugin {
diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector.tsx
index 262cc1941b4ab..b63de399b95c9 100644
--- a/x-pack/plugins/spaces/public/space_selector/space_selector.tsx
+++ b/x-pack/plugins/spaces/public/space_selector/space_selector.tsx
@@ -22,6 +22,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { Component, Fragment } from 'react';
import ReactDOM from 'react-dom';
+import { CoreStart } from 'src/core/public';
import { Space } from '../../common/model/space';
import { SpaceCards } from './components';
import { SPACE_SEARCH_COUNT_THRESHOLD } from '../../common/constants';
@@ -184,7 +185,12 @@ export class SpaceSelector extends Component {
};
}
-export const renderSpaceSelectorApp = (el: Element, props: Props) => {
- ReactDOM.render(, el);
+export const renderSpaceSelectorApp = (i18nStart: CoreStart['i18n'], el: Element, props: Props) => {
+ ReactDOM.render(
+
+
+ ,
+ el
+ );
return () => ReactDOM.unmountComponentAtNode(el);
};
diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector_app.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector_app.tsx
index 74c56027d6fc3..29ead8d34994d 100644
--- a/x-pack/plugins/spaces/public/space_selector/space_selector_app.tsx
+++ b/x-pack/plugins/spaces/public/space_selector/space_selector_app.tsx
@@ -11,11 +11,12 @@ import { SpacesManager } from '../spaces_manager';
interface CreateDeps {
application: CoreSetup['application'];
spacesManager: SpacesManager;
+ getStartServices: CoreSetup['getStartServices'];
}
export const spaceSelectorApp = Object.freeze({
id: 'space_selector',
- create({ application, spacesManager }: CreateDeps) {
+ create({ application, getStartServices, spacesManager }: CreateDeps) {
application.register({
id: this.id,
title: i18n.translate('xpack.spaces.spaceSelector.appTitle', {
@@ -24,8 +25,11 @@ export const spaceSelectorApp = Object.freeze({
chromeless: true,
appRoute: '/spaces/space_selector',
mount: async (params: AppMountParameters) => {
- const { renderSpaceSelectorApp } = await import('./space_selector');
- return renderSpaceSelectorApp(params.element, { spacesManager });
+ const [[coreStart], { renderSpaceSelectorApp }] = await Promise.all([
+ getStartServices(),
+ import('./space_selector'),
+ ]);
+ return renderSpaceSelectorApp(coreStart.i18n, params.element, { spacesManager });
},
});
},
From d45e63d635fdf8d6609910e84688a15e18e593eb Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Thu, 6 Feb 2020 09:37:46 -0500
Subject: [PATCH 17/21] reverting logic to determine serverBasePath
---
x-pack/plugins/spaces/public/plugin.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x-pack/plugins/spaces/public/plugin.tsx b/x-pack/plugins/spaces/public/plugin.tsx
index 25f3daf5b266c..73dae84c1873b 100644
--- a/x-pack/plugins/spaces/public/plugin.tsx
+++ b/x-pack/plugins/spaces/public/plugin.tsx
@@ -43,7 +43,7 @@ export class SpacesPlugin implements Plugin
Date: Thu, 6 Feb 2020 10:57:11 -0500
Subject: [PATCH 18/21] removing spaces mock
---
src/legacy/ui/public/new_platform/new_platform.karma_mock.js | 3 ---
x-pack/legacy/plugins/spaces/public/legacy.ts | 5 ++++-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js
index 3127815aaf6fa..7f4f67ebb06d3 100644
--- a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js
+++ b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js
@@ -167,9 +167,6 @@ export const npSetup = {
}),
},
},
- spaces: {
- registerLegacyAPI: sinon.fake(),
- },
},
};
diff --git a/x-pack/legacy/plugins/spaces/public/legacy.ts b/x-pack/legacy/plugins/spaces/public/legacy.ts
index 1404bf50edbe5..79717a04183e8 100644
--- a/x-pack/legacy/plugins/spaces/public/legacy.ts
+++ b/x-pack/legacy/plugins/spaces/public/legacy.ts
@@ -15,4 +15,7 @@ const legacyAPI = {
},
};
-((npSetup.plugins as any).spaces as SpacesPluginSetup).registerLegacyAPI(legacyAPI);
+const spaces = (npSetup.plugins as any).spaces as SpacesPluginSetup;
+if (spaces) {
+ spaces.registerLegacyAPI(legacyAPI);
+}
From 9ebe5605487842bb527cd7b2491d67744d61d1ea Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Thu, 6 Feb 2020 10:57:47 -0500
Subject: [PATCH 19/21] mantain BWC with old management links
---
x-pack/legacy/plugins/spaces/public/legacy.ts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/x-pack/legacy/plugins/spaces/public/legacy.ts b/x-pack/legacy/plugins/spaces/public/legacy.ts
index 79717a04183e8..c6740dae81717 100644
--- a/x-pack/legacy/plugins/spaces/public/legacy.ts
+++ b/x-pack/legacy/plugins/spaces/public/legacy.ts
@@ -6,6 +6,7 @@
import { SavedObjectsManagementAction } from 'src/legacy/core_plugins/management/public';
import { npSetup } from 'ui/new_platform';
+import routes from 'ui/routes';
import { SpacesPluginSetup } from '../../../../plugins/spaces/public';
import { setup as managementSetup } from '../../../../../src/legacy/core_plugins/management/public/legacy';
@@ -18,4 +19,10 @@ const legacyAPI = {
const spaces = (npSetup.plugins as any).spaces as SpacesPluginSetup;
if (spaces) {
spaces.registerLegacyAPI(legacyAPI);
+
+ routes.when('/management/spaces/list', { redirectTo: '/management/kibana/spaces' });
+ routes.when('/management/spaces/create', { redirectTo: '/management/kibana/spaces/create' });
+ routes.when('/management/spaces/edit/:spaceId', {
+ redirectTo: '/management/kibana/spaces/edit/:spaceId',
+ });
}
From 2a0109529001f565b3687e00850c54e246556b95 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Thu, 6 Feb 2020 12:41:47 -0500
Subject: [PATCH 20/21] add types to management mock
---
src/plugins/management/public/mocks/index.ts | 7 ++++---
x-pack/plugins/spaces/public/plugin.test.ts | 19 ++++++++++++++++---
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/plugins/management/public/mocks/index.ts b/src/plugins/management/public/mocks/index.ts
index a495f7432272c..6099a2cc32afc 100644
--- a/src/plugins/management/public/mocks/index.ts
+++ b/src/plugins/management/public/mocks/index.ts
@@ -17,16 +17,17 @@
* under the License.
*/
-const createSetupContract = () => ({
+import { ManagementSetup, ManagementStart } from '../types';
+
+const createSetupContract = (): DeeplyMockedKeys => ({
sections: {
register: jest.fn(),
getSection: jest.fn(),
- getSectionsEnabled: jest.fn(),
getAllSections: jest.fn(),
},
});
-const createStartContract = () => ({
+const createStartContract = (): DeeplyMockedKeys => ({
legacy: {},
sections: {
getSection: jest.fn(),
diff --git a/x-pack/plugins/spaces/public/plugin.test.ts b/x-pack/plugins/spaces/public/plugin.test.ts
index 0f2d0f08c2eaf..28f8433be6fd9 100644
--- a/x-pack/plugins/spaces/public/plugin.test.ts
+++ b/x-pack/plugins/spaces/public/plugin.test.ts
@@ -7,6 +7,7 @@
import { coreMock } from 'src/core/public/mocks';
import { SpacesPlugin } from './plugin';
import { homePluginMock } from '../../../../src/plugins/home/public/mocks';
+import { ManagementSection } from '../../../../src/plugins/management/public';
import { managementPluginMock } from '../../../../src/plugins/management/public/mocks';
import { advancedSettingsMock } from '../../../../src/plugins/advanced_settings/public/mocks';
@@ -31,12 +32,24 @@ describe('Spaces plugin', () => {
it('should register the management and feature catalogue sections when the management and home plugins are both available', () => {
const coreSetup = coreMock.createSetup();
- const registerApp = jest.fn();
+ const kibanaSection = new ManagementSection(
+ {
+ id: 'kibana',
+ title: 'Mock Kibana Section',
+ order: 1,
+ },
+ jest.fn(),
+ jest.fn(),
+ jest.fn(),
+ coreSetup.getStartServices
+ );
+
+ const registerAppSpy = jest.spyOn(kibanaSection, 'registerApp');
const home = homePluginMock.createSetupContract();
const management = managementPluginMock.createSetupContract();
- management.sections.getSection.mockReturnValue({ registerApp });
+ management.sections.getSection.mockReturnValue(kibanaSection);
const plugin = new SpacesPlugin();
plugin.setup(coreSetup, {
@@ -44,7 +57,7 @@ describe('Spaces plugin', () => {
home,
});
- expect(registerApp).toHaveBeenCalledWith(expect.objectContaining({ id: 'spaces' }));
+ expect(registerAppSpy).toHaveBeenCalledWith(expect.objectContaining({ id: 'spaces' }));
expect(home.featureCatalogue.register).toHaveBeenCalledWith(
expect.objectContaining({
From 25008da588a1a4ba558ea13696d39b7ab4137f61 Mon Sep 17 00:00:00 2001
From: Larry Gregory
Date: Fri, 7 Feb 2020 14:48:39 -0500
Subject: [PATCH 21/21] address remaining PR feedback
---
.../customize_space/customize_space.tsx | 76 ++++---
.../customize_space_avatar.test.tsx | 4 +-
.../customize_space_avatar.tsx | 40 ++--
.../edit_space/delete_spaces_button.test.tsx | 3 +-
.../edit_space/delete_spaces_button.tsx | 43 ++--
.../enabled_features.test.tsx.snap | 204 ------------------
.../enabled_features.test.tsx | 18 +-
.../enabled_features/enabled_features.tsx | 21 +-
.../enabled_features/feature_table.tsx | 7 +-
.../edit_space/manage_space_page.test.tsx | 12 +-
.../edit_space/manage_space_page.tsx | 139 ++++++------
.../section_panel/section_panel.test.tsx | 24 +--
.../section_panel/section_panel.tsx | 26 +--
.../public/management/management_service.tsx | 4 +-
.../management/spaces_management_app.tsx | 4 +-
15 files changed, 185 insertions(+), 440 deletions(-)
diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx
index b0d74afaa90aa..d581ac22650e3 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx
@@ -16,7 +16,8 @@ import {
EuiTextArea,
EuiTitle,
} from '@elastic/eui';
-import { FormattedMessage, InjectedIntl } from '@kbn/i18n/react';
+import { FormattedMessage } from '@kbn/i18n/react';
+import { i18n } from '@kbn/i18n';
import React, { ChangeEvent, Component, Fragment } from 'react';
import { isReservedSpace } from '../../../../common';
import { Space } from '../../../../common/model/space';
@@ -30,7 +31,6 @@ interface Props {
validator: SpaceValidator;
space: Partial;
editingExistingSpace: boolean;
- intl: InjectedIntl;
onChange: (space: Partial) => void;
}
@@ -46,24 +46,21 @@ export class CustomizeSpace extends Component {
};
public render() {
- const { validator, editingExistingSpace, intl } = this.props;
+ const { validator, editingExistingSpace } = this.props;
const { name = '', description = '' } = this.props.space;
- const panelTitle = intl.formatMessage({
- id: 'xpack.spaces.management.manageSpacePage.customizeSpaceTitle',
- defaultMessage: 'Customize your space',
- });
+ const panelTitle = i18n.translate(
+ 'xpack.spaces.management.manageSpacePage.customizeSpaceTitle',
+ {
+ defaultMessage: 'Customize your space',
+ }
+ );
const extraPopoverProps: Partial = {
initialFocus: 'input[name="spaceInitials"]',
};
return (
-
+
@@ -81,8 +78,7 @@ export class CustomizeSpace extends Component {
{
>
{
@@ -147,14 +149,18 @@ export class CustomizeSpace extends Component {
)}
diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx
index 642f2f0013222..dc20a375ada1e 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx
@@ -15,9 +15,7 @@ const space = {
};
test('renders without crashing', () => {
- const wrapper = shallowWithIntl(
-
- );
+ const wrapper = shallowWithIntl();
expect(wrapper).toMatchSnapshot();
});
diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx
index 36e8c8cc0cb48..55fea3671645b 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.tsx
@@ -16,7 +16,7 @@ import {
EuiSpacer,
isValidHex,
} from '@elastic/eui';
-import { InjectedIntl, injectI18n } from '@kbn/i18n/react';
+import { i18n } from '@kbn/i18n';
import { Space } from '../../../../common/model/space';
import { imageTypes, encode } from '../../../../common/lib/dataurl';
import { getSpaceColor, getSpaceInitials } from '../../../space_avatar';
@@ -24,7 +24,6 @@ import { MAX_SPACE_INITIALS } from '../../../../common';
interface Props {
space: Partial;
onChange: (space: Partial) => void;
- intl: InjectedIntl;
}
interface State {
@@ -32,7 +31,7 @@ interface State {
pendingInitials?: string | null;
}
-class CustomizeSpaceAvatarUI extends Component {
+export class CustomizeSpaceAvatar extends Component {
private initialsRef: HTMLInputElement | null = null;
constructor(props: Props) {
@@ -100,7 +99,7 @@ class CustomizeSpaceAvatarUI extends Component {
};
public render() {
- const { space, intl } = this.props;
+ const { space } = this.props;
const { initialsHasFocus, pendingInitials } = this.state;
@@ -110,10 +109,12 @@ class CustomizeSpaceAvatarUI extends Component {
return (
@@ -130,7 +129,7 @@ export class EnabledFeatures extends Component {
defaultMessage="The feature is hidden in the UI, but is not disabled."
/>
- {this.props.capabilities.spaces.manage && (
+ {this.props.securityEnabled && (
;
features: Feature[];
- intl: InjectedIntl;
onChange: (space: Partial) => void;
}
@@ -66,8 +66,7 @@ export class FeatureTable extends Component {
private getColumns = () => [
{
field: 'feature',
- name: this.props.intl.formatMessage({
- id: 'xpack.spaces.management.enabledSpaceFeaturesFeatureColumnTitle',
+ name: i18n.translate('xpack.spaces.management.enabledSpaceFeaturesFeatureColumnTitle', {
defaultMessage: 'Feature',
}),
render: (feature: Feature, _item: { feature: Feature; space: Props['space'] }) => {
diff --git a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
index 1a16dfbd363aa..2aba1522a7e3f 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
@@ -31,9 +31,8 @@ describe('ManageSpacePage', () => {
httpStart.get.mockResolvedValue([{ id: 'feature-1', name: 'feature 1', icon: 'spacesApp' }]);
const wrapper = mountWithIntl(
- {
const onLoadSpace = jest.fn();
const wrapper = mountWithIntl(
- {
httpStart.get.mockResolvedValue([{ id: 'feature-1', name: 'feature 1', icon: 'spacesApp' }]);
const wrapper = mountWithIntl(
- {
httpStart.get.mockResolvedValue([{ id: 'feature-1', name: 'feature 1', icon: 'spacesApp' }]);
const wrapper = mountWithIntl(
- void;
capabilities: Capabilities;
securityEnabled: boolean;
@@ -55,7 +55,7 @@ interface State {
};
}
-class ManageSpacePageUI extends Component {
+export class ManageSpacePage extends Component {
private readonly validator: SpaceValidator;
constructor(props: Props) {
@@ -75,47 +75,24 @@ class ManageSpacePageUI extends Component {
return;
}
- const { spaceId, spacesManager, intl, onLoadSpace, http } = this.props;
+ const { spaceId, http } = this.props;
const getFeatures = http.get('/api/features');
if (spaceId) {
- try {
- const [space, features] = await Promise.all([spacesManager.getSpace(spaceId), getFeatures]);
- if (space) {
- if (onLoadSpace) {
- onLoadSpace(space);
- }
-
- this.setState({
- space,
- features: await features,
- originalSpace: space,
- isLoading: false,
- });
- }
- } catch (error) {
- const { message = '' } = error.data || {};
-
- this.props.notifications.toasts.addDanger(
- intl.formatMessage(
- {
- id: 'xpack.spaces.management.manageSpacePage.errorLoadingSpaceTitle',
- defaultMessage: 'Error loading space: {message}',
- },
- {
- message,
- }
- )
- );
- this.backToSpacesList();
- }
+ await this.loadSpace(spaceId, getFeatures);
} else {
const features = await getFeatures;
this.setState({ isLoading: false, features });
}
}
+ public async componentDidUpdate(previousProps: Props) {
+ if (this.props.spaceId !== previousProps.spaceId && this.props.spaceId) {
+ await this.loadSpace(this.props.spaceId, Promise.resolve(this.state.features));
+ }
+ }
+
public render() {
const content = this.state.isLoading ? this.getLoadingIndicator() : this.getForm();
@@ -163,7 +140,6 @@ class ManageSpacePageUI extends Component {
onChange={this.onSpaceChange}
editingExistingSpace={this.editingExistingSpace()}
validator={this.validator}
- intl={this.props.intl}
/>
@@ -171,9 +147,8 @@ class ManageSpacePageUI extends Component {
@@ -220,20 +195,26 @@ class ManageSpacePageUI extends Component {
};
public getFormButtons = () => {
- const createSpaceText = this.props.intl.formatMessage({
- id: 'xpack.spaces.management.manageSpacePage.createSpaceButton',
- defaultMessage: 'Create space',
- });
+ const createSpaceText = i18n.translate(
+ 'xpack.spaces.management.manageSpacePage.createSpaceButton',
+ {
+ defaultMessage: 'Create space',
+ }
+ );
- const updateSpaceText = this.props.intl.formatMessage({
- id: 'xpack.spaces.management.manageSpacePage.updateSpaceButton',
- defaultMessage: 'Update space',
- });
+ const updateSpaceText = i18n.translate(
+ 'xpack.spaces.management.manageSpacePage.updateSpaceButton',
+ {
+ defaultMessage: 'Update space',
+ }
+ );
- const cancelButtonText = this.props.intl.formatMessage({
- id: 'xpack.spaces.management.manageSpacePage.cancelSpaceButton',
- defaultMessage: 'Cancel',
- });
+ const cancelButtonText = i18n.translate(
+ 'xpack.spaces.management.manageSpacePage.cancelSpaceButton',
+ {
+ defaultMessage: 'Cancel',
+ }
+ );
const saveText = this.editingExistingSpace() ? updateSpaceText : createSpaceText;
return (
@@ -322,8 +303,40 @@ class ManageSpacePageUI extends Component {
}
};
+ private loadSpace = async (spaceId: string, featuresPromise: Promise) => {
+ const { spacesManager, onLoadSpace } = this.props;
+
+ try {
+ const [space, features] = await Promise.all([
+ spacesManager.getSpace(spaceId),
+ featuresPromise,
+ ]);
+ if (space) {
+ if (onLoadSpace) {
+ onLoadSpace(space);
+ }
+
+ this.setState({
+ space,
+ features: await features,
+ originalSpace: space,
+ isLoading: false,
+ });
+ }
+ } catch (error) {
+ const message = error?.body?.message ?? '';
+
+ this.props.notifications.toasts.addDanger(
+ i18n.translate('xpack.spaces.management.manageSpacePage.errorLoadingSpaceTitle', {
+ defaultMessage: 'Error loading space: {message}',
+ values: { message },
+ })
+ );
+ this.backToSpacesList();
+ }
+ };
+
private performSave = (requireRefresh = false) => {
- const { intl } = this.props;
if (!this.state.space) {
return;
}
@@ -360,14 +373,11 @@ class ManageSpacePageUI extends Component {
action
.then(() => {
this.props.notifications.toasts.addSuccess(
- intl.formatMessage(
+ i18n.translate(
+ 'xpack.spaces.management.manageSpacePage.spaceSuccessfullySavedNotificationMessage',
{
- id:
- 'xpack.spaces.management.manageSpacePage.spaceSuccessfullySavedNotificationMessage',
defaultMessage: `Space {name} was saved.`,
- },
- {
- name: `'${name}'`,
+ values: { name: `'${name}'` },
}
)
);
@@ -379,20 +389,15 @@ class ManageSpacePageUI extends Component {
}
})
.catch(error => {
- const { message = '' } = error.data || {};
+ const message = error?.body?.message ?? '';
this.setState({ saveInProgress: false });
this.props.notifications.toasts.addDanger(
- intl.formatMessage(
- {
- id: 'xpack.spaces.management.manageSpacePage.errorSavingSpaceTitle',
- defaultMessage: 'Error saving space: {message}',
- },
- {
- message,
- }
- )
+ i18n.translate('xpack.spaces.management.manageSpacePage.errorSavingSpaceTitle', {
+ defaultMessage: 'Error saving space: {message}',
+ values: { message },
+ })
);
});
};
@@ -403,5 +408,3 @@ class ManageSpacePageUI extends Component {
private editingExistingSpace = () => !!this.props.spaceId;
}
-
-export const ManageSpacePage = injectI18n(ManageSpacePageUI);
diff --git a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx
index 9b736c98d1f0c..0b8085ff1ad16 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx
@@ -11,13 +11,7 @@ import { SectionPanel } from './section_panel';
test('it renders without blowing up', () => {
const wrapper = shallowWithIntl(
-
+
child
);
@@ -27,13 +21,7 @@ test('it renders without blowing up', () => {
test('it renders children by default', () => {
const wrapper = mountWithIntl(
-
+
child 1
child 2
@@ -45,13 +33,7 @@ test('it renders children by default', () => {
test('it hides children when the "hide" link is clicked', () => {
const wrapper = mountWithIntl(
-
+
child 1
child 2
diff --git a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx
index a205130d2d765..a0a6bc5a89d33 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx
@@ -14,7 +14,7 @@ import {
EuiTitle,
IconType,
} from '@elastic/eui';
-import { InjectedIntl } from '@kbn/i18n/react';
+import { i18n } from '@kbn/i18n';
import React, { Component, Fragment, ReactNode } from 'react';
interface Props {
@@ -22,7 +22,6 @@ interface Props {
title: string | ReactNode;
description: string;
collapsible: boolean;
- intl: InjectedIntl;
initiallyCollapsed?: boolean;
}
@@ -52,38 +51,31 @@ export class SectionPanel extends Component {
}
public getTitle = () => {
- const showLinkText = this.props.intl.formatMessage({
- id: 'xpack.spaces.management.collapsiblePanel.showLinkText',
+ const showLinkText = i18n.translate('xpack.spaces.management.collapsiblePanel.showLinkText', {
defaultMessage: 'show',
});
- const hideLinkText = this.props.intl.formatMessage({
- id: 'xpack.spaces.management.collapsiblePanel.hideLinkText',
+ const hideLinkText = i18n.translate('xpack.spaces.management.collapsiblePanel.hideLinkText', {
defaultMessage: 'hide',
});
- const showLinkDescription = this.props.intl.formatMessage(
+ const showLinkDescription = i18n.translate(
+ 'xpack.spaces.management.collapsiblePanel.showLinkDescription',
{
- id: 'xpack.spaces.management.collapsiblePanel.showLinkDescription',
defaultMessage: 'show {title}',
- },
- {
- title: this.props.description,
+ values: { title: this.props.description },
}
);
- const hideLinkDescription = this.props.intl.formatMessage(
+ const hideLinkDescription = i18n.translate(
+ 'xpack.spaces.management.collapsiblePanel.hideLinkDescription',
{
- id: 'xpack.spaces.management.collapsiblePanel.hideLinkDescription',
defaultMessage: 'hide {title}',
- },
- {
- title: this.props.description,
+ values: { title: this.props.description },
}
);
return (
- // @ts-ignore
diff --git a/x-pack/plugins/spaces/public/management/management_service.tsx b/x-pack/plugins/spaces/public/management/management_service.tsx
index 1d2ed1bab8791..c81a3497762a5 100644
--- a/x-pack/plugins/spaces/public/management/management_service.tsx
+++ b/x-pack/plugins/spaces/public/management/management_service.tsx
@@ -6,7 +6,7 @@
import { ManagementSetup, ManagementApp } from 'src/plugins/management/public';
import { CoreSetup, Capabilities } from 'src/core/public';
-import { SecurityPluginSetup } from '../../../security/public';
+import { SecurityLicense } from '../../../security/public';
import { SpacesManager } from '../spaces_manager';
import { PluginsStart } from '../plugin';
import { spacesManagementApp } from './spaces_management_app';
@@ -15,7 +15,7 @@ interface SetupDeps {
management: ManagementSetup;
getStartServices: CoreSetup['getStartServices'];
spacesManager: SpacesManager;
- securityLicense?: SecurityPluginSetup['license'];
+ securityLicense?: SecurityLicense;
}
interface StartDeps {
diff --git a/x-pack/plugins/spaces/public/management/spaces_management_app.tsx b/x-pack/plugins/spaces/public/management/spaces_management_app.tsx
index 4a8a8aea575cd..663237cfc2e8a 100644
--- a/x-pack/plugins/spaces/public/management/spaces_management_app.tsx
+++ b/x-pack/plugins/spaces/public/management/spaces_management_app.tsx
@@ -72,7 +72,7 @@ export const spacesManagementApp = Object.freeze({
http={http}
notifications={notifications}
spacesManager={spacesManager}
- securityEnabled={Boolean(securityLicense && securityLicense.getFeatures().showLinks)}
+ securityEnabled={securityLicense?.getFeatures().showLinks ?? false}
/>
);
};
@@ -98,7 +98,7 @@ export const spacesManagementApp = Object.freeze({
spacesManager={spacesManager}
spaceId={spaceId}
onLoadSpace={onLoadSpace}
- securityEnabled={Boolean(securityLicense && securityLicense.getFeatures().showLinks)}
+ securityEnabled={securityLicense?.getFeatures().showLinks ?? false}
/>
);
};