Skip to content
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
19 changes: 1 addition & 18 deletions x-pack/legacy/plugins/lens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
import * as Joi from 'joi';
import { resolve } from 'path';
import { LegacyPluginInitializer } from 'src/legacy/types';
import mappings from './mappings.json';
import {
PLUGIN_ID,
getEditPath,
NOT_INTERNATIONALIZED_PRODUCT_NAME,
} from '../../../plugins/lens/common';
import { PLUGIN_ID, NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../../../plugins/lens/common';

export const lens: LegacyPluginInitializer = kibana => {
return new kibana.Plugin({
Expand All @@ -32,18 +27,6 @@ export const lens: LegacyPluginInitializer = kibana => {
visualize: [`plugins/${PLUGIN_ID}/legacy`],
embeddableFactories: [`plugins/${PLUGIN_ID}/legacy`],
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
mappings,
savedObjectsManagement: {
lens: {
defaultSearchField: 'title',
isImportableAndExportable: true,
getTitle: (obj: { attributes: { title: string } }) => obj.attributes.title,
getInAppUrl: (obj: { id: string }) => ({
path: getEditPath(obj.id),
uiCapabilitiesPath: 'lens.show',
}),
},
},
},

config: () => {
Expand Down
35 changes: 0 additions & 35 deletions x-pack/legacy/plugins/lens/mappings.json

This file was deleted.

2 changes: 2 additions & 0 deletions x-pack/plugins/lens/server/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
initializeLensTelemetry,
scheduleLensTelemetry,
} from './usage';
import { setupSavedObjects } from './saved_objects';

export interface PluginSetupContract {
usageCollection?: UsageCollectionSetup;
Expand All @@ -33,6 +34,7 @@ export class LensServerPlugin implements Plugin<{}, {}, {}, {}> {
this.telemetryLogger = initializerContext.logger.get('telemetry');
}
setup(core: CoreSetup<PluginStartContract>, plugins: PluginSetupContract) {
setupSavedObjects(core);
setupRoutes(core);
if (plugins.usageCollection && plugins.taskManager) {
registerLensUsageCollector(
Expand Down
65 changes: 65 additions & 0 deletions x-pack/plugins/lens/server/saved_objects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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 } from 'kibana/server';
import { getEditPath } from '../common';

export function setupSavedObjects(core: CoreSetup) {
core.savedObjects.registerType({
name: 'lens',
hidden: false,
namespaceAgnostic: false,
management: {
icon: 'lensApp',
defaultSearchField: 'title',
importableAndExportable: true,
getTitle: (obj: { attributes: { title: string } }) => obj.attributes.title,
getInAppUrl: (obj: { id: string }) => ({
path: getEditPath(obj.id),
uiCapabilitiesPath: 'visualize.show',
}),
},
mappings: {
properties: {
title: {
type: 'text',
},
visualizationType: {
type: 'keyword',
},
state: {
type: 'flattened',
},
expression: {
index: false,
type: 'keyword',
},
},
},
});

core.savedObjects.registerType({
name: 'lens-ui-telemetry',
hidden: false,
namespaceAgnostic: false,
mappings: {
properties: {
name: {
type: 'keyword',
},
type: {
type: 'keyword',
},
date: {
type: 'date',
},
count: {
type: 'integer',
},
},
},
});
}