Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Spaces -> Client to NP (#54298) #57200

Merged
merged 1 commit into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/plugins/advanced_settings/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } };
},
};
38 changes: 38 additions & 0 deletions src/plugins/home/public/mocks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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';
import { configSchema } from '../../config';

const createSetupContract = () => ({
featureCatalogue: featureCatalogueRegistryMock.createSetup(),
environment: environmentServiceMock.createSetup(),
config: configSchema.validate({}),
});

const createStartContract = () => ({
featureCatalogue: featureCatalogueRegistryMock.createStart(),
environment: environmentServiceMock.createStart(),
});

export const homePluginMock = {
createSetupContract,
createStartContract,
};
18 changes: 17 additions & 1 deletion src/plugins/management/public/mocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,26 @@
* under the License.
*/

const createStartContract = () => ({
import { ManagementSetup, ManagementStart } from '../types';

const createSetupContract = (): DeeplyMockedKeys<ManagementSetup> => ({
sections: {
register: jest.fn(),
getSection: jest.fn(),
getAllSections: jest.fn(),
},
});

const createStartContract = (): DeeplyMockedKeys<ManagementStart> => ({
legacy: {},
sections: {
getSection: jest.fn(),
getAllSections: jest.fn(),
navigateToApp: jest.fn(),
},
});

export const managementPluginMock = {
createSetupContract,
createStartContract,
};
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/ml/server/lib/spaces_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import { Request } from 'hapi';
import { Space } from '../../../../../plugins/spaces/server';
import { LegacySpacesPlugin } from '../../../spaces';
import { Space } from '../../../spaces/common/model/space';

interface GetActiveSpaceResponse {
valid: boolean;
Expand Down
28 changes: 0 additions & 28 deletions x-pack/legacy/plugins/spaces/common/constants.ts

This file was deleted.

8 changes: 0 additions & 8 deletions x-pack/legacy/plugins/spaces/common/index.ts

This file was deleted.

34 changes: 0 additions & 34 deletions x-pack/legacy/plugins/spaces/common/is_reserved_space.test.ts

This file was deleted.

18 changes: 0 additions & 18 deletions x-pack/legacy/plugins/spaces/common/is_reserved_space.ts

This file was deleted.

16 changes: 0 additions & 16 deletions x-pack/legacy/plugins/spaces/common/model/space.ts

This file was deleted.

14 changes: 2 additions & 12 deletions x-pack/legacy/plugins/spaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<SpacesServiceSetup['getSpaceId']>;
Expand Down Expand Up @@ -50,15 +50,7 @@ export const spaces = (kibana: Record<string, any>) =>
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: {
Expand Down Expand Up @@ -131,11 +123,9 @@ export const spaces = (kibana: Record<string, any>) =>
create: (pluginId: string) =>
new AuditLogger(server, pluginId, server.config(), server.plugins.xpack_main.info),
},
xpackMain: server.plugins.xpack_main,
});

initEnterSpaceView(server);
initSpaceSelectorView(server);

watchStatusAndLicenseToInitialize(server.plugins.xpack_main, this, async () => {
await createDefaultSpace();
Expand Down
18 changes: 0 additions & 18 deletions x-pack/legacy/plugins/spaces/public/__mocks__/xpack_info.ts

This file was deleted.

14 changes: 1 addition & 13 deletions x-pack/legacy/plugins/spaces/public/index.scss
Original file line number Diff line number Diff line change
@@ -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';
32 changes: 17 additions & 15 deletions x-pack/legacy/plugins/spaces/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@
* 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 routes from 'ui/routes';
import { SpacesPluginSetup } from '../../../../plugins/spaces/public';
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,
advancedSettings: npSetup.plugins.advancedSettings,
const legacyAPI = {
registerSavedObjectsManagementAction: (action: SavedObjectsManagementAction) => {
managementSetup.savedObjects.registry.register(action);
},
};

const pluginsStart: PluginsStart = {
management: npStart.plugins.management,
};
const spaces = (npSetup.plugins as any).spaces as SpacesPluginSetup;
if (spaces) {
spaces.registerLegacyAPI(legacyAPI);

export const setup = spacesPlugin.setup(npSetup.core, pluginsSetup);
export const start = spacesPlugin.start(npStart.core, pluginsStart);
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',
});
}

This file was deleted.

This file was deleted.

Loading