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

Do not register SO in the legacy platform #66203

Merged
merged 5 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
11 changes: 11 additions & 0 deletions src/core/server/core_app/core_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ export class CoreApp {
router.get({ path: '/core', validate: false }, async (context, req, res) =>
res.ok({ body: { version: '0.0.1' } })
);

coreSetup.savedObjects.registerType({
name: 'server',
hidden: false,
namespaceType: 'single',
mappings: {
properties: {
uuid: { type: 'keyword' },
Copy link
Contributor Author

@mshustov mshustov May 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to find any usages. Don't know whether we can delete it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not aware of this being used anywhere either. Probably could remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be done as a separate PR

},
},
});
}
private registerStaticDirs(coreSetup: InternalCoreSetup) {
coreSetup.http.registerStaticDir('/ui/{path*}', Path.resolve(__dirname, './assets'));
Expand Down
2 changes: 0 additions & 2 deletions src/legacy/core_plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { promisify } from 'util';

import { importApi } from './server/routes/api/import';
import { exportApi } from './server/routes/api/export';
import mappings from './mappings.json';
import { getUiSettingDefaults } from './server/ui_setting_defaults';
import { registerCspCollector } from './server/lib/csp_usage_collector';
import { injectVars } from './inject_vars';
Expand Down Expand Up @@ -138,7 +137,6 @@ export default function(kibana) {
};
},

mappings,
uiSettingDefaults: getUiSettingDefaults(),
},

Expand Down
9 changes: 0 additions & 9 deletions src/legacy/core_plugins/kibana/mappings.json

This file was deleted.

1 change: 0 additions & 1 deletion src/legacy/core_plugins/timelion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const timelionPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPl
},
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
hacks: [resolve(__dirname, 'public/legacy')],
mappings: require('./mappings.json'),
uiSettingDefaults: {
'timelion:showTutorial': {
name: i18n.translate('timelion.uiSettings.showTutorialLabel', {
Expand Down
43 changes: 0 additions & 43 deletions src/legacy/core_plugins/timelion/mappings.json

This file was deleted.

8 changes: 8 additions & 0 deletions src/plugins/timelion/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "timelion",
"version": "0.0.1",
"kibanaVersion": "kibana",
"configPath": "timelion",
"ui": false,
"server": true
}
22 changes: 22 additions & 0 deletions src/plugins/timelion/server/index.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
import { PluginInitializerContext } from 'src/core/server';
import { TimelionPlugin } from './plugin';

export const plugin = (context: PluginInitializerContext) => new TimelionPlugin(context);
52 changes: 52 additions & 0 deletions src/plugins/timelion/server/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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 { CoreSetup, Plugin, PluginInitializerContext } from 'src/core/server';

export class TimelionPlugin implements Plugin {
constructor(context: PluginInitializerContext) {}

setup(core: CoreSetup) {
core.savedObjects.registerType({
name: 'timelion-sheet',
hidden: false,
namespaceType: 'single',
mappings: {
properties: {
description: { type: 'text' },
hits: { type: 'integer' },
kibanaSavedObjectMeta: {
properties: {
searchSourceJSON: { type: 'text' },
},
},
timelion_chart_height: { type: 'integer' },
timelion_columns: { type: 'integer' },
timelion_interval: { type: 'keyword' },
timelion_other_interval: { type: 'keyword' },
timelion_rows: { type: 'integer' },
timelion_sheet: { type: 'text' },
title: { type: 'text' },
version: { type: 'integer' },
},
},
});
}
start() {}
stop() {}
}
32 changes: 1 addition & 31 deletions x-pack/legacy/plugins/maps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/

import mappings from './mappings.json';
import { i18n } from '@kbn/i18n';
import { resolve } from 'path';
import { migrations } from './migrations';
import { getAppTitle } from '../../../plugins/maps/common/i18n_getters';
import { MapPlugin } from './server/plugin';
import {
APP_ID,
APP_ICON,
createMapPath,
MAP_SAVED_OBJECT_TYPE,
} from '../../../plugins/maps/common/constants';
import { APP_ID, APP_ICON } from '../../../plugins/maps/common/constants';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';

export function maps(kibana) {
Expand Down Expand Up @@ -48,29 +41,6 @@ export function maps(kibana) {
};
},
styleSheetPaths: `${__dirname}/public/index.scss`,
savedObjectSchemas: {
'maps-telemetry': {
isNamespaceAgnostic: true,
},
},
savedObjectsManagement: {
[MAP_SAVED_OBJECT_TYPE]: {
icon: APP_ICON,
defaultSearchField: 'title',
isImportableAndExportable: true,
getTitle(obj) {
return obj.attributes.title;
},
getInAppUrl(obj) {
return {
path: createMapPath(obj.id),
uiCapabilitiesPath: 'maps.show',
};
},
},
},
mappings,
migrations,
},
config(Joi) {
return Joi.object({
Expand Down
91 changes: 0 additions & 91 deletions x-pack/legacy/plugins/maps/mappings.json

This file was deleted.

4 changes: 4 additions & 0 deletions x-pack/plugins/maps/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'src/core
import { PluginSetupContract as FeaturesPluginSetupContract } from '../../features/server';

import { APP_ID, APP_ICON, MAP_SAVED_OBJECT_TYPE } from '../common/constants';
import { mapSavedObjects, mapsTelemetrySavedObjects } from './saved_objects';

interface SetupDeps {
features: FeaturesPluginSetupContract;
Expand Down Expand Up @@ -47,6 +48,9 @@ export class MapsPlugin implements Plugin {
},
},
});

core.savedObjects.registerType(mapsTelemetrySavedObjects);
core.savedObjects.registerType(mapSavedObjects);
}
start(core: CoreStart) {}
}
7 changes: 7 additions & 0 deletions x-pack/plugins/maps/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* 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 { mapsTelemetrySavedObjects } from './maps_telemetry';
export { mapSavedObjects } from './map';
41 changes: 41 additions & 0 deletions x-pack/plugins/maps/server/saved_objects/map.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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 { SavedObjectsType } from 'src/core/server';
import { APP_ICON, createMapPath } from '../../common/constants';
// @ts-ignore
import { migrations } from './migrations';

export const mapSavedObjects: SavedObjectsType = {
name: 'map',
hidden: false,
namespaceType: 'single',
mappings: {
properties: {
description: { type: 'text' },
title: { type: 'text' },
version: { type: 'integer' },
bounds: { type: 'geo_shape' },
mapStateJSON: { type: 'text' },
layerListJSON: { type: 'text' },
uiStateJSON: { type: 'text' },
},
},
management: {
icon: APP_ICON,
defaultSearchField: 'title',
importableAndExportable: true,
getTitle(obj) {
return obj.attributes.title;
},
getInAppUrl(obj) {
return {
path: createMapPath(obj.id),
uiCapabilitiesPath: 'maps.show',
};
},
},
migrations: migrations.map,
};
Comment on lines +11 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've actually also done this in a draft PR in-progress. Is this work necessary for you to move forward?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aaronjcaldwell Any ideas when this can be merged? We can wait for a week.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, scratch that. I see you mentioned this is blocking #65461. Let's go with what you have done which is more fleshed out anyway. I'll work out the merge on the Maps end

Loading