Skip to content

Commit

Permalink
Migrate sample-data-telemetry registration to Kibana platform (#63965)
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Apr 22, 2020
1 parent 8ebd0c1 commit 54ca7ed
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 13 deletions.
3 changes: 0 additions & 3 deletions src/legacy/core_plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ export default function(kibana) {
},

savedObjectSchemas: {
'sample-data-telemetry': {
isNamespaceAgnostic: true,
},
'kql-telemetry': {
isNamespaceAgnostic: true,
},
Expand Down
10 changes: 0 additions & 10 deletions src/legacy/core_plugins/kibana/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,5 @@
"type": "long"
}
}
},
"sample-data-telemetry": {
"properties": {
"installCount": {
"type": "long"
},
"unInstallCount": {
"type": "long"
}
}
}
}
2 changes: 2 additions & 0 deletions src/plugins/home/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
SampleDataRegistryStart,
} from './services';
import { UsageCollectionSetup } from '../../usage_collection/server';
import { sampleDataTelemetry } from './saved_objects';

interface HomeServerPluginSetupDependencies {
usage_collection?: UsageCollectionSetup;
Expand All @@ -37,6 +38,7 @@ export class HomeServerPlugin implements Plugin<HomeServerPluginSetup, HomeServe
private readonly sampleDataRegistry = new SampleDataRegistry(this.initContext);

public setup(core: CoreSetup, plugins: HomeServerPluginSetupDependencies): HomeServerPluginSetup {
core.savedObjects.registerType(sampleDataTelemetry);
return {
tutorials: { ...this.tutorialsRegistry.setup(core) },
sampleData: { ...this.sampleDataRegistry.setup(core, plugins.usage_collection) },
Expand Down
20 changes: 20 additions & 0 deletions src/plugins/home/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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 { sampleDataTelemetry } from './sample_data_telemetry';
35 changes: 35 additions & 0 deletions src/plugins/home/server/saved_objects/sample_data_telemetry.ts
Original file line number Diff line number Diff line change
@@ -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 sampleDataTelemetry: SavedObjectsType = {
name: 'sample-data-telemetry',
namespaceType: 'agnostic',
hidden: false,
mappings: {
properties: {
installCount: {
type: 'long',
},
unInstallCount: {
type: 'long',
},
},
},
};

0 comments on commit 54ca7ed

Please sign in to comment.