From 1d83015e1c184a801e793c86b1c42a849e8b71db Mon Sep 17 00:00:00 2001 From: Larry Gregory Date: Mon, 6 Jan 2020 09:34:29 -0500 Subject: [PATCH] additional cleanup --- ...opy_saved_objects_to_space_service.test.ts | 20 ------------------- .../copy_saved_objects_to_space_service.ts | 4 +--- .../public/management/legacy_page_routes.tsx | 8 ++++---- 3 files changed, 5 insertions(+), 27 deletions(-) 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/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts index 50e5c1aa703ec..63a59344dfe5d 100644 --- a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts +++ b/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.test.ts @@ -33,25 +33,5 @@ describe('CopySavedObjectsToSpaceService', () => { expect.any(CopyToSpaceSavedObjectsManagementAction) ); }); - - it('will not re-register the CopyToSpaceSavedObjectsManagementAction', () => { - const deps = { - spacesManager: spacesManagerMock.create(), - // we don't have a proper NP mock for this yet - managementSetup: ({ - savedObjects: { - registry: { - has: jest.fn().mockReturnValue(true), - register: jest.fn(), - }, - }, - } as unknown) as ManagementSetup, - }; - - const service = new CopySavedObjectsToSpaceService(); - service.setup(deps); - - expect(deps.managementSetup.savedObjects.registry.register).toHaveBeenCalledTimes(0); - }); }); }); diff --git a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts b/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts index e67ee8eb2e9f3..37354f985a2fc 100644 --- a/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts +++ b/x-pack/legacy/plugins/spaces/public/copy_saved_objects_to_space/copy_saved_objects_to_space_service.ts @@ -16,8 +16,6 @@ interface SetupDeps { export class CopySavedObjectsToSpaceService { public setup({ spacesManager, managementSetup }: SetupDeps) { const action = new CopyToSpaceSavedObjectsManagementAction(spacesManager); - if (!managementSetup.savedObjects.registry.has(action.id)) { - managementSetup.savedObjects.registry.register(action); - } + managementSetup.savedObjects.registry.register(action); } } 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 9dafd052037ee..8cf4a129e5b8f 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 @@ -53,10 +53,10 @@ routes.when('/management/spaces/list', { k7Breadcrumbs: getListBreadcrumbs, requireUICapability: 'management.kibana.spaces', controller($scope: any) { - $scope.$$postDigest(async () => { + $scope.$$postDigest(() => { const domNode = document.getElementById(reactRootNodeId); - const { spacesManager } = await spacesNPStart; + const { spacesManager } = spacesNPStart; render( @@ -83,10 +83,10 @@ routes.when('/management/spaces/create', { k7Breadcrumbs: getCreateBreadcrumbs, requireUICapability: 'management.kibana.spaces', controller($scope: any) { - $scope.$$postDigest(async () => { + $scope.$$postDigest(() => { const domNode = document.getElementById(reactRootNodeId); - const { spacesManager } = await spacesNPStart; + const { spacesManager } = spacesNPStart; render(