Migrate saved object of type url to kibana platform (#64043)
This commit is contained in:
parent
5f13ad107f
commit
0b8cd6eb46
|
@ -118,16 +118,6 @@ export default function(kibana) {
|
|||
},
|
||||
],
|
||||
|
||||
savedObjectsManagement: {
|
||||
url: {
|
||||
defaultSearchField: 'url',
|
||||
isImportableAndExportable: true,
|
||||
getTitle(obj) {
|
||||
return `/goto/${encodeURIComponent(obj.id)}`;
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
injectDefaultVars(server, options) {
|
||||
const mapConfig = server.config().get('map');
|
||||
const tilemap = mapConfig.tilemap;
|
||||
|
|
|
@ -1,26 +1,4 @@
|
|||
{
|
||||
"url": {
|
||||
"properties": {
|
||||
"accessCount": {
|
||||
"type": "long"
|
||||
},
|
||||
"accessDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"createDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"url": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 2048
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
"properties": {
|
||||
"uuid": {
|
||||
|
|
|
@ -19,12 +19,14 @@
|
|||
|
||||
import { CoreSetup, Plugin, PluginInitializerContext } from 'kibana/server';
|
||||
import { createRoutes } from './routes/create_routes';
|
||||
import { url } from './saved_objects';
|
||||
|
||||
export class SharePlugin implements Plugin {
|
||||
constructor(private readonly initializerContext: PluginInitializerContext) {}
|
||||
|
||||
public async setup(core: CoreSetup) {
|
||||
createRoutes(core, this.initializerContext.logger.get());
|
||||
core.savedObjects.registerType(url);
|
||||
}
|
||||
|
||||
public start() {
|
||||
|
|
19
src/plugins/share/server/saved_objects/index.ts
Normal file
19
src/plugins/share/server/saved_objects/index.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
export { url } from './url';
|
54
src/plugins/share/server/saved_objects/url.ts
Normal file
54
src/plugins/share/server/saved_objects/url.ts
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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 { SavedObjectsType } from 'kibana/server';
|
||||
|
||||
export const url: SavedObjectsType = {
|
||||
name: 'url',
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
management: {
|
||||
icon: 'link',
|
||||
defaultSearchField: 'url',
|
||||
importableAndExportable: true,
|
||||
getTitle(obj) {
|
||||
return `/goto/${encodeURIComponent(obj.id)}`;
|
||||
},
|
||||
},
|
||||
mappings: {
|
||||
properties: {
|
||||
accessCount: {
|
||||
type: 'long',
|
||||
},
|
||||
accessDate: {
|
||||
type: 'date',
|
||||
},
|
||||
createDate: {
|
||||
type: 'date',
|
||||
},
|
||||
url: {
|
||||
type: 'text',
|
||||
fields: {
|
||||
keyword: {
|
||||
type: 'keyword',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue