Migrate kql_telemetry saved object registration to Kibana platform (#64149)

This commit is contained in:
Matthias Wilhelm 2020-04-27 10:39:29 +02:00 committed by GitHub
parent 3d78b1bcf9
commit 2d525380fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 17 deletions

View file

@ -128,12 +128,6 @@ export default function(kibana) {
},
},
savedObjectSchemas: {
'kql-telemetry': {
isNamespaceAgnostic: true,
},
},
injectDefaultVars(server, options) {
const mapConfig = server.config().get('map');
const tilemap = mapConfig.tilemap;

View file

@ -27,15 +27,5 @@
"type": "keyword"
}
}
},
"kql-telemetry": {
"properties": {
"optInCount": {
"type": "long"
},
"optOutCount": {
"type": "long"
}
}
}
}

View file

@ -22,14 +22,16 @@ import { CoreSetup, Plugin, PluginInitializerContext } from 'kibana/server';
import { registerKqlTelemetryRoute } from './route';
import { UsageCollectionSetup } from '../../../usage_collection/server';
import { makeKQLUsageCollector } from './usage_collector';
import { kqlTelemetry } from '../saved_objects';
export class KqlTelemetryService implements Plugin<void> {
constructor(private initializerContext: PluginInitializerContext) {}
public setup(
{ http, getStartServices }: CoreSetup,
{ http, getStartServices, savedObjects }: CoreSetup,
{ usageCollection }: { usageCollection?: UsageCollectionSetup }
) {
savedObjects.registerType(kqlTelemetry);
registerKqlTelemetryRoute(
http.createRouter(),
getStartServices,

View file

@ -20,3 +20,4 @@
export { searchSavedObjectType } from './search';
export { querySavedObjectType } from './query';
export { indexPatternSavedObjectType } from './index_patterns';
export { kqlTelemetry } from './kql_telementry';

View file

@ -0,0 +1,35 @@
/*
* 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 kqlTelemetry: SavedObjectsType = {
name: 'kql-telemetry',
namespaceType: 'agnostic',
hidden: false,
mappings: {
properties: {
optInCount: {
type: 'long',
},
optOutCount: {
type: 'long',
},
},
},
};