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

Spaces -> Client to NP #54298

Merged
merged 31 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d2883da
moves
legrego Jan 8, 2020
8c4516d
updates to support spaces client in NP
legrego Jan 8, 2020
cce8d1f
fixing MLs import
legrego Jan 8, 2020
890b685
update karma mock
legrego Jan 8, 2020
e0ac89c
Merge branch 'master' of github.com:elastic/kibana into spaces/np-client
legrego Jan 9, 2020
6c8c55d
remove unnecessary setup license
legrego Jan 10, 2020
33f04bd
Merge branch 'master' into spaces/np-client
elasticmachine Jan 10, 2020
f650303
Merge branch 'master' of github.com:elastic/kibana into spaces/np-client
legrego Jan 30, 2020
25fcc60
fix merge from master
legrego Jan 30, 2020
0a4198f
moving management app registration to NP
legrego Jan 30, 2020
295773c
move space selector app to NP
legrego Jan 30, 2020
1df82cf
Merge branch 'spaces/np-client' of github.com:legrego/kibana into spa…
legrego Jan 30, 2020
5bdf2b9
remove unused xpackMain legacy dependency
legrego Jan 30, 2020
925ceed
hide spaces management if not authorized
legrego Jan 30, 2020
602b11e
Merge branch 'master' of github.com:elastic/kibana into spaces/np-client
legrego Jan 31, 2020
03a122f
additional testing
legrego Jan 31, 2020
95d390e
additional cleanup
legrego Jan 31, 2020
73cc266
additional testing
legrego Feb 3, 2020
7350cfa
Merge branch 'master' of github.com:elastic/kibana into spaces/np-client
legrego Feb 4, 2020
dca42cc
use NP advancedSettings plugin
legrego Feb 4, 2020
35b81ea
Apply suggestions from code review
legrego Feb 5, 2020
e038ff1
Merge branch 'spaces/np-client' of github.com:legrego/kibana into spa…
legrego Feb 5, 2020
4399b59
start addressing PR feedback
legrego Feb 5, 2020
d6ffb18
Merge branch 'master' of github.com:elastic/kibana into spaces/np-client
legrego Feb 5, 2020
d45e63d
reverting logic to determine serverBasePath
legrego Feb 6, 2020
3f24902
removing spaces mock
legrego Feb 6, 2020
9ebe560
mantain BWC with old management links
legrego Feb 6, 2020
6fac7e4
Merge branch 'master' of github.com:elastic/kibana into spaces/np-client
legrego Feb 6, 2020
2a01095
add types to management mock
legrego Feb 6, 2020
25008da
address remaining PR feedback
legrego Feb 7, 2020
cdf2c10
Merge branch 'master' into spaces/np-client
elasticmachine Feb 10, 2020
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