From 91a8edddebc1656ddd010203d8f529aaf658388c Mon Sep 17 00:00:00 2001 From: Ahmad Bamieh Date: Thu, 5 Aug 2021 13:11:40 +0300 Subject: [PATCH] update functional tests and i18n --- src/plugins/telemetry/server/config.ts | 17 ++++++++++++----- src/plugins/telemetry/server/index.ts | 4 ++-- src/plugins/telemetry/server/plugin.ts | 2 +- test/common/config.js | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/plugins/telemetry/server/config.ts b/src/plugins/telemetry/server/config.ts index e7a5ce953713e..70f48fe86921b 100644 --- a/src/plugins/telemetry/server/config.ts +++ b/src/plugins/telemetry/server/config.ts @@ -17,7 +17,7 @@ const clusterEnvSchema: [Type<'prod'>, Type<'staging'>] = [ schema.literal('staging'), ]; -export const configSchema = schema.object({ +const configSchema = schema.object({ enabled: schema.boolean({ defaultValue: true }), allowChangingOptInStatus: schema.boolean({ defaultValue: true }), optIn: schema.conditional( @@ -36,6 +36,10 @@ export const configSchema = schema.object({ schema.oneOf(clusterEnvSchema, { defaultValue: 'staging' }), schema.oneOf(clusterEnvSchema, { defaultValue: 'prod' }) ), + /** + * REMOVE IN 8.0 - INTERNAL CONFIG DEPRECATED IN 7.15 + * REPLACED WITH `telemetry.sendUsageTo: staging | prod` + */ url: schema.conditional( schema.contextRef('dist'), schema.literal(false), // Point to staging if it's not a distributable release @@ -46,6 +50,10 @@ export const configSchema = schema.object({ defaultValue: TELEMETRY_ENDPOINT.MAIN_CHANNEL.PROD, }) ), + /** + * REMOVE IN 8.0 - INTERNAL CONFIG DEPRECATED IN 7.15 + * REPLACED WITH `telemetry.sendUsageTo: staging | prod` + */ optInStatusUrl: schema.conditional( schema.contextRef('dist'), schema.literal(false), // Point to staging if it's not a distributable release @@ -93,19 +101,18 @@ export const config: PluginConfigDescriptor = { addDeprecation({ message: i18n.translate('telemetry.config.url.deprecationMessage', { defaultMessage: - '"{{configPath}}" has been deprecated. Set "telemetry.sendUsageTo: staging" to the Kibana configurations to send usage to the staging telemetry cluster.', + '"{configPath}" has been deprecated. Set "telemetry.sendUsageTo: staging" to the Kibana configurations to send usage to the staging endpoint.', values: { configPath: fullConfigPath }, }), correctiveActions: { manualSteps: [ i18n.translate('telemetry.config.url.deprecationManualStep1', { - defaultMessage: 'Remove "{{configPath}}" from the Kibana configuration', + defaultMessage: 'Remove "{configPath}" from the Kibana configuration.', values: { configPath: fullConfigPath }, }), i18n.translate('telemetry.config.url.deprecationManualStep2', { defaultMessage: - 'To send usage to staging, add "telemetry.sendUsageTo: staging" to the Kibana configuration.', - values: { configPath: fullConfigPath }, + 'To send usage to the staging endpoint add "telemetry.sendUsageTo: staging" to the Kibana configuration.', }), ], }, diff --git a/src/plugins/telemetry/server/index.ts b/src/plugins/telemetry/server/index.ts index 287b17142bf6b..6b56996c756aa 100644 --- a/src/plugins/telemetry/server/index.ts +++ b/src/plugins/telemetry/server/index.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ -import { PluginInitializerContext } from 'kibana/server'; +import type { PluginInitializerContext } from 'kibana/server'; +import type { TelemetryConfigType } from './config'; import { TelemetryPlugin } from './plugin'; -import { TelemetryConfigType } from './config'; export { config } from './config'; export type { TelemetryPluginSetup, TelemetryPluginStart } from './plugin'; diff --git a/src/plugins/telemetry/server/plugin.ts b/src/plugins/telemetry/server/plugin.ts index a0b0b025c48e6..d38f054a4402e 100644 --- a/src/plugins/telemetry/server/plugin.ts +++ b/src/plugins/telemetry/server/plugin.ts @@ -30,7 +30,7 @@ import { registerTelemetryUsageCollector, registerTelemetryPluginUsageCollector, } from './collectors'; -import { TelemetryConfigType } from './config'; +import type { TelemetryConfigType } from './config'; import { FetcherTask } from './fetcher'; import { handleOldSettings } from './handle_old_settings'; import { getTelemetrySavedObject } from './telemetry_repository'; diff --git a/test/common/config.js b/test/common/config.js index 9372c2173cd0f..5b5d01cfeb1e4 100644 --- a/test/common/config.js +++ b/test/common/config.js @@ -48,7 +48,7 @@ export default function () { '--telemetry.banner=false', '--telemetry.optIn=false', // These are *very* important to have them pointing to staging - '--telemetry.sentUsageTo=staging', + '--telemetry.sendUsageTo=staging', `--server.maxPayload=1679958`, // newsfeed mock service `--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'newsfeed')}`,