kibana/x-pack/plugins/lens/server/saved_objects.ts
Devon Thomson ca82b9b10a
[Lens] By Value Migrations for 7.13 (#100622)
* quick fix for 7.13 lens migration not being run on by value panels

Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
2021-05-27 15:37:58 -04:00

73 lines
1.7 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { CoreSetup } from 'kibana/server';
import { getEditPath } from '../common';
import { migrations } from './migrations/saved_object_migrations';
export function setupSavedObjects(core: CoreSetup) {
core.savedObjects.registerType({
name: 'lens',
hidden: false,
namespaceType: 'single',
management: {
icon: 'lensApp',
defaultSearchField: 'title',
importableAndExportable: true,
getTitle: (obj: { attributes: { title: string } }) => obj.attributes.title,
getInAppUrl: (obj: { id: string }) => ({
path: `/app/lens${getEditPath(obj.id)}`,
uiCapabilitiesPath: 'visualize.show',
}),
},
migrations,
mappings: {
properties: {
title: {
type: 'text',
},
description: {
type: 'text',
},
visualizationType: {
type: 'keyword',
},
state: {
type: 'flattened',
},
expression: {
index: false,
doc_values: false,
type: 'keyword',
},
},
},
});
core.savedObjects.registerType({
name: 'lens-ui-telemetry',
hidden: false,
namespaceType: 'single',
mappings: {
properties: {
name: {
type: 'keyword',
},
type: {
type: 'keyword',
},
date: {
type: 'date',
},
count: {
type: 'integer',
},
},
},
});
}