diff --git a/src/legacy/core_plugins/kibana/common/lib/__tests__/convert_pattern_and_ingest_name.js b/src/legacy/core_plugins/kibana/common/lib/__tests__/convert_pattern_and_ingest_name.js deleted file mode 100644 index 2d138df67ebf9..0000000000000 --- a/src/legacy/core_plugins/kibana/common/lib/__tests__/convert_pattern_and_ingest_name.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 expect from '@kbn/expect'; -import { patternToIngest, ingestToPattern } from '../convert_pattern_and_ingest_name'; - -describe('convertPatternAndTemplateName', function() { - describe('ingestToPattern', function() { - it("should convert an index template's name to its matching index pattern's title", function() { - expect(ingestToPattern('kibana-logstash-*')).to.be('logstash-*'); - }); - - it("should throw an error if the template name isn't a valid kibana namespaced name", function() { - expect(ingestToPattern) - .withArgs('logstash-*') - .to.throwException('not a valid kibana namespaced template name'); - expect(ingestToPattern) - .withArgs('') - .to.throwException(/not a valid kibana namespaced template name/); - }); - }); - - describe('patternToIngest', function() { - it("should convert an index pattern's title to its matching index template's name", function() { - expect(patternToIngest('logstash-*')).to.be('kibana-logstash-*'); - }); - - it('should throw an error if the pattern is empty', function() { - expect(patternToIngest) - .withArgs('') - .to.throwException(/pattern must not be empty/); - }); - }); -}); diff --git a/src/legacy/core_plugins/kibana/common/lib/convert_pattern_and_ingest_name.js b/src/legacy/core_plugins/kibana/common/lib/convert_pattern_and_ingest_name.js deleted file mode 100644 index 216dc7d882a2c..0000000000000 --- a/src/legacy/core_plugins/kibana/common/lib/convert_pattern_and_ingest_name.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ - -// To avoid index template naming collisions the index pattern creation API -// namespaces template names by prepending 'kibana-' to the matching pattern's title. -// e.g. a pattern with title `logstash-*` will have a matching template named `kibana-logstash-*`. -// This module provides utility functions for easily converting between template and pattern names. - -export function ingestToPattern(templateName) { - if (templateName.indexOf('kibana-') === -1) { - throw new Error('not a valid kibana namespaced template name'); - } - - return templateName.slice(templateName.indexOf('-') + 1); -} - -export function patternToIngest(patternName) { - if (patternName === '') { - throw new Error('pattern must not be empty'); - } - - return `kibana-${patternName.toLowerCase()}`; -} diff --git a/src/legacy/core_plugins/kibana/common/tutorials/tutorial_category.js b/src/legacy/core_plugins/kibana/common/tutorials/tutorial_category.js deleted file mode 100644 index 8ac4d2490c17f..0000000000000 --- a/src/legacy/core_plugins/kibana/common/tutorials/tutorial_category.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 const TUTORIAL_CATEGORY = { - LOGGING: 'logging', - SIEM: 'siem', - METRICS: 'metrics', - OTHER: 'other', -}; diff --git a/src/legacy/core_plugins/kibana/common/tutorials/tutorial_schema.js b/src/legacy/core_plugins/kibana/common/tutorials/tutorial_schema.js deleted file mode 100644 index 1d04e0d83fa31..0000000000000 --- a/src/legacy/core_plugins/kibana/common/tutorials/tutorial_schema.js +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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 Joi from 'joi'; -import { PARAM_TYPES } from './param_types'; -import { TUTORIAL_CATEGORY } from './tutorial_category'; - -const dashboardSchema = Joi.object({ - id: Joi.string().required(), // Dashboard saved object id - linkLabel: Joi.string().when('isOverview', { - is: true, - then: Joi.required(), - }), - // Is this an Overview / Entry Point dashboard? - isOverview: Joi.boolean().required(), -}); - -const artifactsSchema = Joi.object({ - // Fields present in Elasticsearch documents created by this product. - exportedFields: Joi.object({ - documentationUrl: Joi.string().required(), - }), - // Kibana dashboards created by this product. - dashboards: Joi.array() - .items(dashboardSchema) - .required(), - application: Joi.object({ - path: Joi.string().required(), - label: Joi.string().required(), - }), -}); - -const statusCheckSchema = Joi.object({ - title: Joi.string(), - text: Joi.string(), - btnLabel: Joi.string(), - success: Joi.string(), - error: Joi.string(), - esHitsCheck: Joi.object({ - index: Joi.alternatives() - .try(Joi.string(), Joi.array().items(Joi.string())) - .required(), - query: Joi.object().required(), - }).required(), -}); - -const instructionSchema = Joi.object({ - title: Joi.string(), - textPre: Joi.string(), - commands: Joi.array().items(Joi.string().allow('')), - textPost: Joi.string(), -}); - -const instructionVariantSchema = Joi.object({ - id: Joi.string().required(), - instructions: Joi.array() - .items(instructionSchema) - .required(), -}); - -const instructionSetSchema = Joi.object({ - title: Joi.string(), - callOut: Joi.object({ - title: Joi.string().required(), - message: Joi.string(), - iconType: Joi.string(), - }), - // Variants (OSes, languages, etc.) for which tutorial instructions are specified. - instructionVariants: Joi.array() - .items(instructionVariantSchema) - .required(), - statusCheck: statusCheckSchema, -}); - -const paramSchema = Joi.object({ - defaultValue: Joi.required(), - id: Joi.string() - .regex(/^[a-zA-Z_]+$/) - .required(), - label: Joi.string().required(), - type: Joi.string() - .valid(Object.values(PARAM_TYPES)) - .required(), -}); - -const instructionsSchema = Joi.object({ - instructionSets: Joi.array() - .items(instructionSetSchema) - .required(), - params: Joi.array().items(paramSchema), -}); - -export const tutorialSchema = { - id: Joi.string() - .regex(/^[a-zA-Z0-9-]+$/) - .required(), - category: Joi.string() - .valid(Object.values(TUTORIAL_CATEGORY)) - .required(), - name: Joi.string().required(), - isBeta: Joi.boolean().default(false), - shortDescription: Joi.string().required(), - euiIconType: Joi.string(), //EUI icon type string, one of https://elastic.github.io/eui/#/icons - longDescription: Joi.string().required(), - completionTimeMinutes: Joi.number().integer(), - previewImagePath: Joi.string(), - - // kibana and elastic cluster running on prem - onPrem: instructionsSchema.required(), - - // kibana and elastic cluster running in elastic's cloud - elasticCloud: instructionsSchema, - - // kibana running on prem and elastic cluster running in elastic's cloud - onPremElasticCloud: instructionsSchema, - - // Elastic stack artifacts produced by product when it is setup and run. - artifacts: artifactsSchema, - - // saved objects used by data module. - savedObjects: Joi.array().items(), - savedObjectsInstallMsg: Joi.string(), -}; diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 55bd852050218..682a39a516e11 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -24,10 +24,8 @@ import { promisify } from 'util'; import { migrations } from './migrations'; import { importApi } from './server/routes/api/import'; import { exportApi } from './server/routes/api/export'; -import { homeApi } from './server/routes/api/home'; import { managementApi } from './server/routes/api/management'; import { registerFieldFormats } from './server/field_formats/register'; -import { registerTutorials } from './server/tutorials/register'; import * as systemApi from './server/lib/system_api'; import mappings from './mappings.json'; import { getUiSettingDefaults } from './ui_setting_defaults'; @@ -332,10 +330,8 @@ export default function(kibana) { // routes importApi(server); exportApi(server); - homeApi(server); managementApi(server); registerFieldFormats(server); - registerTutorials(server); registerCspCollector(usageCollection, server); server.expose('systemApi', systemApi); server.injectUiAppVars('kibana', () => injectVars(server)); diff --git a/src/legacy/core_plugins/kibana/public/home/np_ready/components/tutorial/instruction_set.js b/src/legacy/core_plugins/kibana/public/home/np_ready/components/tutorial/instruction_set.js index 4f60de00819e7..15bda33534185 100644 --- a/src/legacy/core_plugins/kibana/public/home/np_ready/components/tutorial/instruction_set.js +++ b/src/legacy/core_plugins/kibana/public/home/np_ready/components/tutorial/instruction_set.js @@ -22,7 +22,7 @@ import PropTypes from 'prop-types'; import { Instruction } from './instruction'; import { ParameterForm } from './parameter_form'; import { Content } from './content'; -import { getDisplayText } from '../../../../../common/tutorials/instruction_variant'; +import { getDisplayText } from '../../../../../../../../plugins/home/server/tutorials/instructions/instruction_variant'; import { EuiTabs, EuiTab, diff --git a/src/legacy/core_plugins/kibana/public/home/np_ready/load_tutorials.js b/src/legacy/core_plugins/kibana/public/home/np_ready/load_tutorials.js index 6a0a01ebda8db..2f6d4d631baf5 100644 --- a/src/legacy/core_plugins/kibana/public/home/np_ready/load_tutorials.js +++ b/src/legacy/core_plugins/kibana/public/home/np_ready/load_tutorials.js @@ -21,7 +21,6 @@ import _ from 'lodash'; import { getServices } from '../kibana_services'; import { i18n } from '@kbn/i18n'; -const baseUrlLP = getServices().addBasePath('/api/kibana/home/tutorials_LP'); const baseUrl = getServices().addBasePath('/api/kibana/home/tutorials'); const headers = new Headers(); headers.append('Accept', 'application/json'); @@ -29,42 +28,25 @@ headers.append('Content-Type', 'application/json'); headers.append('kbn-xsrf', 'kibana'); let tutorials = []; -let tutorialsLegacyPlatform = []; -let tutorialsNewPlatform = []; let tutorialsLoaded = false; async function loadTutorials() { try { - const responseLegacyPlatform = await fetch(baseUrlLP, { + const response = await fetch(baseUrl, { method: 'get', credentials: 'include', headers: headers, }); - if (responseLegacyPlatform.status >= 300) { + if (response.status >= 300) { throw new Error( i18n.translate('kbn.home.loadTutorials.requestFailedErrorMessage', { defaultMessage: 'Request failed with status code: {status}', - values: { status: responseLegacyPlatform.status }, - }) - ); - } - const responseNewPlatform = await fetch(baseUrl, { - method: 'get', - credentials: 'include', - headers: headers, - }); - if (responseNewPlatform.status >= 300) { - throw new Error( - i18n.translate('kbn.home.loadTutorials.requestFailedErrorMessage', { - defaultMessage: 'Request failed with status code: {status}', - values: { status: responseNewPlatform.status }, + values: { status: response.status }, }) ); } - tutorialsLegacyPlatform = await responseLegacyPlatform.json(); - tutorialsNewPlatform = await responseNewPlatform.json(); - tutorials = tutorialsLegacyPlatform.concat(tutorialsNewPlatform); + tutorials = await response.json(); tutorialsLoaded = true; } catch (err) { getServices().toastNotifications.addDanger({ diff --git a/src/legacy/core_plugins/kibana/server/routes/api/home/index.js b/src/legacy/core_plugins/kibana/server/routes/api/home/index.js deleted file mode 100644 index 6a4303819f3e9..0000000000000 --- a/src/legacy/core_plugins/kibana/server/routes/api/home/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 { registerTutorials } from './register_tutorials'; - -export function homeApi(server) { - registerTutorials(server); -} diff --git a/src/legacy/core_plugins/kibana/server/routes/api/home/register_tutorials.js b/src/legacy/core_plugins/kibana/server/routes/api/home/register_tutorials.js deleted file mode 100644 index 315553af53892..0000000000000 --- a/src/legacy/core_plugins/kibana/server/routes/api/home/register_tutorials.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 function registerTutorials(server) { - server.route({ - path: '/api/kibana/home/tutorials_LP', - method: ['GET'], - handler: function(req) { - return server.getTutorials(req); - }, - }); -} diff --git a/src/legacy/core_plugins/kibana/server/tutorials/apm/index.js b/src/legacy/core_plugins/kibana/server/tutorials/apm/index.js deleted file mode 100644 index d86810a8bdf18..0000000000000 --- a/src/legacy/core_plugins/kibana/server/tutorials/apm/index.js +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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 { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; -import { onPremInstructions } from './envs/on_prem'; -import { createElasticCloudInstructions } from './envs/elastic_cloud'; -import apmIndexPattern from './index_pattern.json'; - -const apmIntro = i18n.translate('kbn.server.tutorials.apm.introduction', { - defaultMessage: 'Collect in-depth performance metrics and errors from inside your applications.', -}); - -function isEnabled(config) { - const ENABLED_KEY = 'xpack.apm.ui.enabled'; - if (config.has(ENABLED_KEY)) { - return config.get(ENABLED_KEY); - } - - return false; -} - -export function apmSpecProvider(server) { - const config = server.config(); - const apmIndexPatternTitle = config.get('apm_oss.indexPattern'); - const { cloud } = server.newPlatform.setup; - - const savedObjects = [ - { - ...apmIndexPattern, - attributes: { - ...apmIndexPattern.attributes, - title: apmIndexPatternTitle, - }, - }, - ]; - - const artifacts = { - dashboards: [ - { - id: '8d3ed660-7828-11e7-8c47-65b845b5cfb3', - linkLabel: i18n.translate( - 'kbn.server.tutorials.apm.specProvider.artifacts.dashboards.linkLabel', - { - defaultMessage: 'APM dashboard', - } - ), - isOverview: true, - }, - ], - }; - - if (isEnabled(config)) { - artifacts.application = { - path: '/app/apm', - label: i18n.translate('kbn.server.tutorials.apm.specProvider.artifacts.application.label', { - defaultMessage: 'Launch APM', - }), - }; - } - - return { - id: 'apm', - name: i18n.translate('kbn.server.tutorials.apm.specProvider.name', { - defaultMessage: 'APM', - }), - category: TUTORIAL_CATEGORY.OTHER, - shortDescription: apmIntro, - longDescription: i18n.translate('kbn.server.tutorials.apm.specProvider.longDescription', { - defaultMessage: - 'Application Performance Monitoring (APM) collects in-depth \ -performance metrics and errors from inside your application. \ -It allows you to monitor the performance of thousands of applications in real time. \ -[Learn more]({learnMoreLink}).', - values: { - learnMoreLink: - '{config.docs.base_url}guide/en/apm/get-started/{config.docs.version}/index.html', - }, - }), - euiIconType: 'logoAPM', - artifacts, - onPrem: onPremInstructions(config), - elasticCloud: createElasticCloudInstructions(cloud), - previewImagePath: '/plugins/kibana/home/tutorial_resources/apm/apm.png', - savedObjects, - savedObjectsInstallMsg: i18n.translate( - 'kbn.server.tutorials.apm.specProvider.savedObjectsInstallMsg', - { - defaultMessage: 'An APM index pattern is required for some features in the APM UI.', - } - ), - }; -} diff --git a/src/legacy/core_plugins/kibana/server/tutorials/register.js b/src/legacy/core_plugins/kibana/server/tutorials/register.js deleted file mode 100644 index 2f69e7dbcbc7d..0000000000000 --- a/src/legacy/core_plugins/kibana/server/tutorials/register.js +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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 { systemLogsSpecProvider } from './system_logs'; -import { systemMetricsSpecProvider } from './system_metrics'; -import { apacheLogsSpecProvider } from './apache_logs'; -import { apacheMetricsSpecProvider } from './apache_metrics'; -import { elasticsearchLogsSpecProvider } from './elasticsearch_logs'; -import { iisLogsSpecProvider } from './iis_logs'; -import { kafkaLogsSpecProvider } from './kafka_logs'; -import { logstashLogsSpecProvider } from './logstash_logs'; -import { nginxLogsSpecProvider } from './nginx_logs'; -import { nginxMetricsSpecProvider } from './nginx_metrics'; -import { mysqlLogsSpecProvider } from './mysql_logs'; -import { mysqlMetricsSpecProvider } from './mysql_metrics'; -import { mongodbMetricsSpecProvider } from './mongodb_metrics'; -import { osqueryLogsSpecProvider } from './osquery_logs'; -import { phpfpmMetricsSpecProvider } from './php_fpm_metrics'; -import { postgresqlMetricsSpecProvider } from './postgresql_metrics'; -import { postgresqlLogsSpecProvider } from './postgresql_logs'; -import { rabbitmqMetricsSpecProvider } from './rabbitmq_metrics'; -import { redisLogsSpecProvider } from './redis_logs'; -import { redisMetricsSpecProvider } from './redis_metrics'; -import { suricataLogsSpecProvider } from './suricata_logs'; -import { dockerMetricsSpecProvider } from './docker_metrics'; -import { kubernetesMetricsSpecProvider } from './kubernetes_metrics'; -import { uwsgiMetricsSpecProvider } from './uwsgi_metrics'; -import { netflowSpecProvider } from './netflow'; -import { traefikLogsSpecProvider } from './traefik_logs'; -import { apmSpecProvider } from './apm'; -import { cephMetricsSpecProvider } from './ceph_metrics'; -import { aerospikeMetricsSpecProvider } from './aerospike_metrics'; -import { couchbaseMetricsSpecProvider } from './couchbase_metrics'; -import { dropwizardMetricsSpecProvider } from './dropwizard_metrics'; -import { elasticsearchMetricsSpecProvider } from './elasticsearch_metrics'; -import { etcdMetricsSpecProvider } from './etcd_metrics'; -import { haproxyMetricsSpecProvider } from './haproxy_metrics'; -import { kafkaMetricsSpecProvider } from './kafka_metrics'; -import { kibanaMetricsSpecProvider } from './kibana_metrics'; -import { memcachedMetricsSpecProvider } from './memcached_metrics'; -import { muninMetricsSpecProvider } from './munin_metrics'; -import { vSphereMetricsSpecProvider } from './vsphere_metrics'; -import { windowsMetricsSpecProvider } from './windows_metrics'; -import { windowsEventLogsSpecProvider } from './windows_event_logs'; -import { golangMetricsSpecProvider } from './golang_metrics'; -import { logstashMetricsSpecProvider } from './logstash_metrics'; -import { prometheusMetricsSpecProvider } from './prometheus_metrics'; -import { zookeeperMetricsSpecProvider } from './zookeeper_metrics'; -import { uptimeMonitorsSpecProvider } from './uptime_monitors'; -import { cloudwatchLogsSpecProvider } from './cloudwatch_logs'; -import { awsMetricsSpecProvider } from './aws_metrics'; -import { mssqlMetricsSpecProvider } from './mssql_metrics'; -import { natsMetricsSpecProvider } from './nats_metrics'; -import { natsLogsSpecProvider } from './nats_logs'; -import { zeekLogsSpecProvider } from './zeek_logs'; -import { corednsMetricsSpecProvider } from './coredns_metrics'; -import { corednsLogsSpecProvider } from './coredns_logs'; -import { auditbeatSpecProvider } from './auditbeat'; -import { iptablesLogsSpecProvider } from './iptables_logs'; -import { ciscoLogsSpecProvider } from './cisco_logs'; -import { envoyproxyLogsSpecProvider } from './envoyproxy_logs'; -import { couchdbMetricsSpecProvider } from './couchdb_metrics'; -import { emsBoundariesSpecProvider } from './ems'; -import { consulMetricsSpecProvider } from './consul_metrics'; -import { cockroachdbMetricsSpecProvider } from './cockroachdb_metrics'; -import { traefikMetricsSpecProvider } from './traefik_metrics'; -import { awsLogsSpecProvider } from './aws_logs'; -import { activemqLogsSpecProvider } from './activemq_logs'; -import { activemqMetricsSpecProvider } from './activemq_metrics'; -import { azureMetricsSpecProvider } from './azure_metrics'; -import { ibmmqLogsSpecProvider } from './ibmmq_logs'; -import { ibmmqMetricsSpecProvider } from './ibmmq_metrics'; -import { stanMetricsSpecProvider } from './stan_metrics'; -import { envoyproxyMetricsSpecProvider } from './envoyproxy_metrics'; - -export function registerTutorials(server) { - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(systemLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(systemMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(apacheLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(apacheMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(elasticsearchLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(iisLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(kafkaLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(logstashLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(nginxLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(nginxMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(mysqlLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(mysqlMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(mongodbMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(osqueryLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(phpfpmMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(postgresqlMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(postgresqlLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(rabbitmqMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(redisLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(redisMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(suricataLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(dockerMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(kubernetesMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(uwsgiMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(netflowSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(traefikLogsSpecProvider); - server.registerTutorial(apmSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(cephMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(aerospikeMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(couchbaseMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(dropwizardMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial( - elasticsearchMetricsSpecProvider - ); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(etcdMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(haproxyMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(kafkaMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(kibanaMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(memcachedMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(muninMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(vSphereMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(windowsMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(windowsEventLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(golangMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(logstashMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(prometheusMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(zookeeperMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(uptimeMonitorsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(cloudwatchLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(awsMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(mssqlMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(natsMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(natsLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(zeekLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(corednsMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(corednsLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(auditbeatSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(iptablesLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(ciscoLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(envoyproxyLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(couchdbMetricsSpecProvider); - server.registerTutorial(emsBoundariesSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(consulMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(cockroachdbMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(traefikMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(awsLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(activemqLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(activemqMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(azureMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(ibmmqLogsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(ibmmqMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(stanMetricsSpecProvider); - server.newPlatform.setup.plugins.home.tutorials.registerTutorial(envoyproxyMetricsSpecProvider); -} diff --git a/src/legacy/ui/tutorials_mixin.js b/src/legacy/ui/tutorials_mixin.js deleted file mode 100644 index efaf4ee7e78f0..0000000000000 --- a/src/legacy/ui/tutorials_mixin.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 Joi from 'joi'; -import { tutorialSchema } from '../core_plugins/kibana/common/tutorials/tutorial_schema'; - -export function tutorialsMixin(kbnServer, server) { - const tutorialProviders = []; - const scopedTutorialContextFactories = []; - - server.decorate('server', 'getTutorials', request => { - const initialContext = {}; - const scopedContext = scopedTutorialContextFactories.reduce( - (accumulatedContext, contextFactory) => { - return { ...accumulatedContext, ...contextFactory(request) }; - }, - initialContext - ); - - return tutorialProviders.map(tutorialProvider => { - return tutorialProvider(server, scopedContext); - }); - }); - - server.decorate('server', 'registerTutorial', specProvider => { - // registration during setup - const emptyContext = {}; - const { error } = Joi.validate(specProvider(server, emptyContext), tutorialSchema); - - if (error) { - throw new Error(`Unable to register tutorial spec because its invalid. ${error}`); - } - - tutorialProviders.push(specProvider); - }); - - server.decorate('server', 'addScopedTutorialContextFactory', scopedTutorialContextFactory => { - // returned by the setup method of the new plugin, they will do the same thing as now - if (typeof scopedTutorialContextFactory !== 'function') { - throw new Error( - `Unable to add scoped(request) context factory because you did not provide a function` - ); - } - - scopedTutorialContextFactories.push(scopedTutorialContextFactory); - }); -} diff --git a/src/legacy/ui/tutorials_mixin.test.js b/src/legacy/ui/tutorials_mixin.test.js deleted file mode 100644 index 58841987e0281..0000000000000 --- a/src/legacy/ui/tutorials_mixin.test.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 { tutorialsMixin } from './tutorials_mixin'; - -const validTutorial = { - id: 'spec1', - category: 'other', - name: 'spec1', - shortDescription: 'short description', - longDescription: 'long description', - onPrem: { - instructionSets: [ - { - instructionVariants: [ - { - id: 'instructionVariant1', - instructions: [{}], - }, - ], - }, - ], - }, -}; - -describe('tutorial mixins', () => { - let getTutorials; - let registerTutorial; - let addScopedTutorialContextFactory; - const serverMock = { decorate: jest.fn() }; - beforeEach(async () => { - await tutorialsMixin({}, serverMock); - - [ - [, , getTutorials], - [, , registerTutorial], - [, , addScopedTutorialContextFactory], - ] = serverMock.decorate.mock.calls; - }); - - afterEach(() => { - jest.clearAllMocks(); - }); - - describe('scoped context', () => { - const mockRequest = {}; - const spacesContextFactory = request => { - if (request !== mockRequest) { - throw new Error('context factory not called with request object'); - } - return { - spaceId: 'my-space', - }; - }; - const specProvider = (server, context) => { - const tutorial = { ...validTutorial }; - tutorial.shortDescription = `I have been provided with scoped context, spaceId: ${context.spaceId}`; - return tutorial; - }; - beforeEach(async () => { - addScopedTutorialContextFactory(spacesContextFactory); - registerTutorial(specProvider); - }); - - test('passes scoped context to specProviders', () => { - const tutorials = getTutorials(mockRequest); - expect(tutorials.length).toBe(1); - expect(tutorials[0].shortDescription).toBe( - 'I have been provided with scoped context, spaceId: my-space' - ); - }); - }); -}); diff --git a/src/legacy/ui/ui_mixin.js b/src/legacy/ui/ui_mixin.js index 24d22efe4fa06..addfed05cdb48 100644 --- a/src/legacy/ui/ui_mixin.js +++ b/src/legacy/ui/ui_mixin.js @@ -18,7 +18,6 @@ */ import { fieldFormatsMixin } from './field_formats'; -import { tutorialsMixin } from './tutorials_mixin'; import { uiAppsMixin } from './ui_apps'; import { uiBundlesMixin } from './ui_bundles'; import { uiRenderMixin } from './ui_render'; @@ -29,6 +28,5 @@ export async function uiMixin(kbnServer) { await kbnServer.mixin(uiBundlesMixin); await kbnServer.mixin(uiSettingsMixin); await kbnServer.mixin(fieldFormatsMixin); - await kbnServer.mixin(tutorialsMixin); await kbnServer.mixin(uiRenderMixin); } diff --git a/src/plugins/home/server/index.ts b/src/plugins/home/server/index.ts index ed336f4a41d6e..0961c729698b9 100644 --- a/src/plugins/home/server/index.ts +++ b/src/plugins/home/server/index.ts @@ -24,3 +24,6 @@ import { PluginInitializerContext } from 'src/core/server'; import { HomeServerPlugin } from './plugin'; export const plugin = (initContext: PluginInitializerContext) => new HomeServerPlugin(initContext); + +export { INSTRUCTION_VARIANT } from './tutorials/instructions/instruction_variant'; +export { ArtifactsSchema, TutorialsCategory } from './services/tutorials'; diff --git a/src/plugins/home/server/services/tutorials/lib/tutorials_registry_types.ts b/src/plugins/home/server/services/tutorials/lib/tutorials_registry_types.ts index 951ce935760a1..80849513a3fad 100644 --- a/src/plugins/home/server/services/tutorials/lib/tutorials_registry_types.ts +++ b/src/plugins/home/server/services/tutorials/lib/tutorials_registry_types.ts @@ -26,17 +26,30 @@ export enum TutorialsCategory { METRICS = 'metrics', OTHER = 'other', } +export type Platform = 'WINDOWS' | 'OSX' | 'DEB' | 'RPM'; + export interface ParamTypes { NUMBER: string; STRING: string; } +export interface Instruction { + title?: string; + textPre?: string; + commands?: string[]; + textPost?: string; +} +export interface InstructionVariant { + id: string; + instructions: Instruction[]; +} export interface InstructionSetSchema { - readonly title: string; - readonly callOut: { + readonly title?: string; + readonly callOut?: { title: string; - message: string; - iconType: IconType; + message?: string; + iconType?: IconType; }; + instructionVariants: InstructionVariant[]; } export interface ParamsSchema { defaultValue: any; @@ -46,22 +59,19 @@ export interface ParamsSchema { } export interface InstructionsSchema { readonly instructionSets: InstructionSetSchema[]; - readonly params: ParamsSchema[]; + readonly params?: ParamsSchema[]; } export interface DashboardSchema { id: string; - linkLabel?: { - is: boolean; - then: any; - }; + linkLabel?: string; isOverview: boolean; } export interface ArtifactsSchema { - readonly exportedFields: { + exportedFields?: { documentationUrl: string; }; - readonly dashboards: DashboardSchema[]; - readonly application: { + dashboards: DashboardSchema[]; + application?: { path: string; label: string; }; @@ -70,29 +80,32 @@ export interface TutorialSchema { id: string; category: TutorialsCategory; name: string; - isBeta: boolean; + isBeta?: boolean; shortDescription: string; - euiIconType: IconType; // EUI icon type string, one of https://elastic.github.io/eui/#/icon; + euiIconType?: IconType; // EUI icon type string, one of https://elastic.github.io/eui/#/icon; longDescription: string; - completionTimeMinutes: number; - previewImagePath: string; + completionTimeMinutes?: number; + previewImagePath?: string; // kibana and elastic cluster running on prem onPrem: InstructionsSchema; // kibana and elastic cluster running in elastic's cloud - elasticCloud: InstructionsSchema; + elasticCloud?: InstructionsSchema; // kibana running on prem and elastic cluster running in elastic's cloud - onPremElasticCloud: InstructionsSchema; + onPremElasticCloud?: InstructionsSchema; // Elastic stack artifacts produced by product when it is setup and run. - artifacts: ArtifactsSchema; + artifacts?: ArtifactsSchema; // saved objects used by data module. - savedObjects: any[]; - savedObjectsInstallMsg: string; + savedObjects?: any[]; + savedObjectsInstallMsg?: string; +} +export interface TutorialContext { + [key: string]: unknown; } -export type TutorialProvider = (context: { [key: string]: unknown }) => TutorialSchema; +export type TutorialProvider = (context: TutorialContext) => TutorialSchema; export type TutorialContextFactory = (req: KibanaRequest) => { [key: string]: unknown }; export type ScopedTutorialContextFactory = (...args: any[]) => any; diff --git a/src/plugins/home/server/services/tutorials/tutorials_registry.ts b/src/plugins/home/server/services/tutorials/tutorials_registry.ts index be0302cbd8188..e820924d7608d 100644 --- a/src/plugins/home/server/services/tutorials/tutorials_registry.ts +++ b/src/plugins/home/server/services/tutorials/tutorials_registry.ts @@ -25,6 +25,7 @@ import { ScopedTutorialContextFactory, } from './lib/tutorials_registry_types'; import { tutorialSchema } from './lib/tutorial_schema'; +import { builtInTutorials } from '../../tutorials/register'; export class TutorialsRegistry { private readonly tutorialProviders: TutorialProvider[] = []; // pre-register all the tutorials we know we want in here @@ -77,6 +78,8 @@ export class TutorialsRegistry { } public start() { + // pre-populate with built in tutorials + this.tutorialProviders.push(...builtInTutorials); return {}; } } diff --git a/src/legacy/core_plugins/kibana/server/tutorials/activemq_logs/index.js b/src/plugins/home/server/tutorials/activemq_logs/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/activemq_logs/index.js rename to src/plugins/home/server/tutorials/activemq_logs/index.ts index fa5fe3b0ecfe3..6511a21b15c44 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/activemq_logs/index.js +++ b/src/plugins/home/server/tutorials/activemq_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function activemqLogsSpecProvider(server, context) { +export function activemqLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'activemq'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'activemqLogs', - name: i18n.translate('kbn.server.tutorials.activemqLogs.nameTitle', { + name: i18n.translate('home.tutorials.activemqLogs.nameTitle', { defaultMessage: 'ActiveMQ logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.activemqLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.activemqLogs.shortDescription', { defaultMessage: 'Collect ActiveMQ logs with Filebeat.', }), - longDescription: i18n.translate('kbn.server.tutorials.activemqLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.activemqLogs.longDescription', { defaultMessage: 'Collect ActiveMQ logs with Filebeat. \ [Learn more]({learnMoreLink}).', values: { @@ -49,12 +53,9 @@ export function activemqLogsSpecProvider(server, context) { dashboards: [ { id: '26434790-1464-11ea-8fd8-030a13064883', - linkLabel: i18n.translate( - 'kbn.server.tutorials.activemqLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'ActiveMQ Application Events', - } - ), + linkLabel: i18n.translate('home.tutorials.activemqLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'ActiveMQ Application Events', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/activemq_metrics/index.js b/src/plugins/home/server/tutorials/activemq_metrics/index.ts similarity index 73% rename from src/legacy/core_plugins/kibana/server/tutorials/activemq_metrics/index.js rename to src/plugins/home/server/tutorials/activemq_metrics/index.ts index 7ed2d370debd1..3898e2b5338b1 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/activemq_metrics/index.js +++ b/src/plugins/home/server/tutorials/activemq_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialsCategory, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function activemqMetricsSpecProvider(context) { +export function activemqMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'activemq'; return { id: 'activemqMetrics', - name: i18n.translate('kbn.server.tutorials.activemqMetrics.nameTitle', { + name: i18n.translate('home.tutorials.activemqMetrics.nameTitle', { defaultMessage: 'ActiveMQ metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.activemqMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.activemqMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from ActiveMQ instances.', }), - longDescription: i18n.translate('kbn.server.tutorials.activemqMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.activemqMetrics.longDescription', { defaultMessage: 'The `activemq` Metricbeat module fetches monitoring metrics from ActiveMQ instances \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function activemqMetricsSpecProvider(context) { isBeta: true, artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.activemqMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.activemqMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function activemqMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/aerospike_metrics/index.js b/src/plugins/home/server/tutorials/aerospike_metrics/index.ts similarity index 72% rename from src/legacy/core_plugins/kibana/server/tutorials/aerospike_metrics/index.js rename to src/plugins/home/server/tutorials/aerospike_metrics/index.ts index aeb00dfa526fe..656e7feceed0c 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/aerospike_metrics/index.js +++ b/src/plugins/home/server/tutorials/aerospike_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialsCategory, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function aerospikeMetricsSpecProvider(context) { +export function aerospikeMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'aerospike'; return { id: 'aerospikeMetrics', - name: i18n.translate('kbn.server.tutorials.aerospikeMetrics.nameTitle', { + name: i18n.translate('home.tutorials.aerospikeMetrics.nameTitle', { defaultMessage: 'Aerospike metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.aerospikeMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.aerospikeMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the Aerospike server.', }), - longDescription: i18n.translate('kbn.server.tutorials.aerospikeMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.aerospikeMetrics.longDescription', { defaultMessage: 'The `aerospike` Metricbeat module fetches internal metrics from Aerospike. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function aerospikeMetricsSpecProvider(context) { euiIconType: 'logoAerospike', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.aerospikeMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.aerospikeMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function aerospikeMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/apache_logs/index.js b/src/plugins/home/server/tutorials/apache_logs/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/apache_logs/index.js rename to src/plugins/home/server/tutorials/apache_logs/index.ts index d60884e196498..adf94f5567096 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/apache_logs/index.js +++ b/src/plugins/home/server/tutorials/apache_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function apacheLogsSpecProvider(context) { +export function apacheLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'apache'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'apacheLogs', - name: i18n.translate('kbn.server.tutorials.apacheLogs.nameTitle', { + name: i18n.translate('home.tutorials.apacheLogs.nameTitle', { defaultMessage: 'Apache logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.apacheLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.apacheLogs.shortDescription', { defaultMessage: 'Collect and parse access and error logs created by the Apache HTTP server.', }), - longDescription: i18n.translate('kbn.server.tutorials.apacheLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.apacheLogs.longDescription', { defaultMessage: 'The apache Filebeat module parses access and error logs created by the Apache HTTP server. \ [Learn more]({learnMoreLink}).', @@ -50,12 +54,9 @@ export function apacheLogsSpecProvider(context) { dashboards: [ { id: 'Filebeat-Apache-Dashboard-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.apacheLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Apache logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.apacheLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Apache logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/apache_metrics/index.js b/src/plugins/home/server/tutorials/apache_metrics/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/apache_metrics/index.js rename to src/plugins/home/server/tutorials/apache_metrics/index.ts index 5e20bfd1e9650..e272f3efb5abe 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/apache_metrics/index.js +++ b/src/plugins/home/server/tutorials/apache_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function apacheMetricsSpecProvider(context) { +export function apacheMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'apache'; return { id: 'apacheMetrics', - name: i18n.translate('kbn.server.tutorials.apacheMetrics.nameTitle', { + name: i18n.translate('home.tutorials.apacheMetrics.nameTitle', { defaultMessage: 'Apache metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.apacheMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.apacheMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the Apache 2 HTTP server.', }), - longDescription: i18n.translate('kbn.server.tutorials.apacheMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.apacheMetrics.longDescription', { defaultMessage: 'The `apache` Metricbeat module fetches internal metrics from the Apache 2 HTTP server. \ [Learn more]({learnMoreLink}).', @@ -49,12 +53,9 @@ export function apacheMetricsSpecProvider(context) { dashboards: [ { id: 'Metricbeat-Apache-HTTPD-server-status-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.apacheMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Apache metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.apacheMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'Apache metrics dashboard', + }), isOverview: true, }, ], @@ -64,7 +65,7 @@ export function apacheMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/apache_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/auditbeat/index.js b/src/plugins/home/server/tutorials/auditbeat/index.ts similarity index 73% rename from src/legacy/core_plugins/kibana/server/tutorials/auditbeat/index.js rename to src/plugins/home/server/tutorials/auditbeat/index.ts index b67a872dcc0aa..6d94e7507ff42 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/auditbeat/index.js +++ b/src/plugins/home/server/tutorials/auditbeat/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/auditbeat_instructions'; +} from '../instructions/auditbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function auditbeatSpecProvider(context) { - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; +export function auditbeatSpecProvider(context: TutorialContext): TutorialSchema { + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'auditbeat', - name: i18n.translate('kbn.server.tutorials.auditbeat.nameTitle', { + name: i18n.translate('home.tutorials.auditbeat.nameTitle', { defaultMessage: 'Auditbeat', }), - category: TUTORIAL_CATEGORY.SIEM, - shortDescription: i18n.translate('kbn.server.tutorials.auditbeat.shortDescription', { + category: TutorialsCategory.SIEM, + shortDescription: i18n.translate('home.tutorials.auditbeat.shortDescription', { defaultMessage: 'Collect audit data from your hosts.', }), - longDescription: i18n.translate('kbn.server.tutorials.auditbeat.longDescription', { + longDescription: i18n.translate('home.tutorials.auditbeat.longDescription', { defaultMessage: 'Use Auditbeat to collect auditing data from your hosts. These include \ processes, users, logins, sockets information, file accesses, and more. \ @@ -50,7 +54,7 @@ processes, users, logins, sockets information, file accesses, and more. \ dashboards: [], application: { path: '/app/siem', - label: i18n.translate('kbn.server.tutorials.auditbeat.artifacts.dashboards.linkLabel', { + label: i18n.translate('home.tutorials.auditbeat.artifacts.dashboards.linkLabel', { defaultMessage: 'SIEM App', }), }, diff --git a/src/legacy/core_plugins/kibana/server/tutorials/aws_logs/index.js b/src/plugins/home/server/tutorials/aws_logs/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/aws_logs/index.js rename to src/plugins/home/server/tutorials/aws_logs/index.ts index 5f7131cb4dcde..8908838bd558a 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/aws_logs/index.js +++ b/src/plugins/home/server/tutorials/aws_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function awsLogsSpecProvider(server, context) { +export function awsLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'aws'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'awsLogs', - name: i18n.translate('kbn.server.tutorials.awsLogs.nameTitle', { + name: i18n.translate('home.tutorials.awsLogs.nameTitle', { defaultMessage: 'AWS S3 based logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.awsLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.awsLogs.shortDescription', { defaultMessage: 'Collect AWS logs from S3 bucket with Filebeat.', }), - longDescription: i18n.translate('kbn.server.tutorials.awsLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.awsLogs.longDescription', { defaultMessage: 'Collect AWS logs by exporting them to an S3 bucket which is configured with SQS notification. \ [Learn more]({learnMoreLink}).', @@ -50,7 +54,7 @@ export function awsLogsSpecProvider(server, context) { dashboards: [ { id: '4746e000-bacd-11e9-9f70-1f7bda85a5eb', - linkLabel: i18n.translate('kbn.server.tutorials.awsLogs.artifacts.dashboards.linkLabel', { + linkLabel: i18n.translate('home.tutorials.awsLogs.artifacts.dashboards.linkLabel', { defaultMessage: 'AWS S3 server access log dashboard', }), isOverview: true, diff --git a/src/legacy/core_plugins/kibana/server/tutorials/aws_metrics/index.js b/src/plugins/home/server/tutorials/aws_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/aws_metrics/index.js rename to src/plugins/home/server/tutorials/aws_metrics/index.ts index e7b6644ecea1c..d00951b524530 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/aws_metrics/index.js +++ b/src/plugins/home/server/tutorials/aws_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function awsMetricsSpecProvider(context) { +export function awsMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'aws'; return { id: 'awsMetrics', - name: i18n.translate('kbn.server.tutorials.awsMetrics.nameTitle', { + name: i18n.translate('home.tutorials.awsMetrics.nameTitle', { defaultMessage: 'AWS metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.awsMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.awsMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics for EC2 instances from the AWS APIs and Cloudwatch.', }), - longDescription: i18n.translate('kbn.server.tutorials.awsMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.awsMetrics.longDescription', { defaultMessage: 'The `aws` Metricbeat module fetches monitoring metrics from the AWS APIs and Cloudwatch. \ [Learn more]({learnMoreLink}).', @@ -51,12 +55,9 @@ export function awsMetricsSpecProvider(context) { dashboards: [ { id: 'c5846400-f7fb-11e8-af03-c999c9dea608-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.awsMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'AWS metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.awsMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'AWS metrics dashboard', + }), isOverview: true, }, ], @@ -66,7 +67,7 @@ export function awsMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/aws_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/azure_metrics/index.js b/src/plugins/home/server/tutorials/azure_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/azure_metrics/index.js rename to src/plugins/home/server/tutorials/azure_metrics/index.ts index cbefd713a7381..72befcf8d2065 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/azure_metrics/index.js +++ b/src/plugins/home/server/tutorials/azure_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function azureMetricsSpecProvider(context) { +export function azureMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'azure'; return { id: 'azureMetrics', - name: i18n.translate('kbn.server.tutorials.azureMetrics.nameTitle', { + name: i18n.translate('home.tutorials.azureMetrics.nameTitle', { defaultMessage: 'Azure metrics', }), isBeta: true, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.azureMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.azureMetrics.shortDescription', { defaultMessage: 'Fetch Azure Monitor metrics.', }), - longDescription: i18n.translate('kbn.server.tutorials.azureMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.azureMetrics.longDescription', { defaultMessage: 'The `azure` Metricbeat module fetches Azure Monitor metrics. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function azureMetricsSpecProvider(context) { euiIconType: 'logoAzure', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.azureMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.azureMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function azureMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/ceph_metrics/index.js b/src/plugins/home/server/tutorials/ceph_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/ceph_metrics/index.js rename to src/plugins/home/server/tutorials/ceph_metrics/index.ts index d844dd016657c..6b5f9c4c6fe5f 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/ceph_metrics/index.js +++ b/src/plugins/home/server/tutorials/ceph_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function cephMetricsSpecProvider(context) { +export function cephMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'ceph'; return { id: 'cephMetrics', - name: i18n.translate('kbn.server.tutorials.cephMetrics.nameTitle', { + name: i18n.translate('home.tutorials.cephMetrics.nameTitle', { defaultMessage: 'Ceph metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.cephMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.cephMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the Ceph server.', }), - longDescription: i18n.translate('kbn.server.tutorials.cephMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.cephMetrics.longDescription', { defaultMessage: 'The `ceph` Metricbeat module fetches internal metrics from Ceph. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function cephMetricsSpecProvider(context) { euiIconType: 'logoCeph', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.cephMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.cephMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function cephMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/cisco_logs/index.js b/src/plugins/home/server/tutorials/cisco_logs/index.ts similarity index 72% rename from src/legacy/core_plugins/kibana/server/tutorials/cisco_logs/index.js rename to src/plugins/home/server/tutorials/cisco_logs/index.ts index 90190bd0d6877..303dbd9a9d856 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/cisco_logs/index.js +++ b/src/plugins/home/server/tutorials/cisco_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function ciscoLogsSpecProvider(context) { +export function ciscoLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'cisco'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'ciscoLogs', - name: i18n.translate('kbn.server.tutorials.ciscoLogs.nameTitle', { + name: i18n.translate('home.tutorials.ciscoLogs.nameTitle', { defaultMessage: 'Cisco', }), - category: TUTORIAL_CATEGORY.SIEM, - shortDescription: i18n.translate('kbn.server.tutorials.ciscoLogs.shortDescription', { + category: TutorialsCategory.SIEM, + shortDescription: i18n.translate('home.tutorials.ciscoLogs.shortDescription', { defaultMessage: 'Collect and parse logs received from Cisco ASA firewalls.', }), - longDescription: i18n.translate('kbn.server.tutorials.ciscoLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.ciscoLogs.longDescription', { defaultMessage: 'This is a module for Cisco network device’s logs. Currently \ supports the "asa" fileset for Cisco ASA firewall logs received over syslog or read from a file. \ @@ -46,12 +50,12 @@ supports the "asa" fileset for Cisco ASA firewall logs received over syslog or r learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-cisco.html', }, }), - //euiIconType: 'logoCisco', + // euiIconType: 'logoCisco', artifacts: { dashboards: [], application: { path: '/app/siem', - label: i18n.translate('kbn.server.tutorials.ciscoLogs.artifacts.dashboards.linkLabel', { + label: i18n.translate('home.tutorials.ciscoLogs.artifacts.dashboards.linkLabel', { defaultMessage: 'SIEM App', }), }, diff --git a/src/legacy/core_plugins/kibana/server/tutorials/cloudwatch_logs/index.js b/src/plugins/home/server/tutorials/cloudwatch_logs/index.ts similarity index 69% rename from src/legacy/core_plugins/kibana/server/tutorials/cloudwatch_logs/index.js rename to src/plugins/home/server/tutorials/cloudwatch_logs/index.ts index 6abc7161d8bf2..10f0eb3e4f34f 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/cloudwatch_logs/index.js +++ b/src/plugins/home/server/tutorials/cloudwatch_logs/index.ts @@ -18,24 +18,28 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/functionbeat_instructions'; +} from '../instructions/functionbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function cloudwatchLogsSpecProvider(context) { +export function cloudwatchLogsSpecProvider(context: TutorialContext): TutorialSchema { return { id: 'cloudwatchLogs', - name: i18n.translate('kbn.server.tutorials.cloudwatchLogs.nameTitle', { + name: i18n.translate('home.tutorials.cloudwatchLogs.nameTitle', { defaultMessage: 'AWS Cloudwatch logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.cloudwatchLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.cloudwatchLogs.shortDescription', { defaultMessage: 'Collect Cloudwatch logs with Functionbeat.', }), - longDescription: i18n.translate('kbn.server.tutorials.cloudwatchLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.cloudwatchLogs.longDescription', { defaultMessage: 'Collect Cloudwatch logs by deploying Functionbeat to run as \ an AWS Lambda function. \ @@ -54,8 +58,8 @@ export function cloudwatchLogsSpecProvider(context) { }, }, completionTimeMinutes: 10, - //previewImagePath: '/plugins/kibana/home/tutorial_resources/uptime_monitors/screenshot.png', - onPrem: onPremInstructions(null, null, null, context), + // previewImagePath: '/plugins/kibana/home/tutorial_resources/uptime_monitors/screenshot.png', + onPrem: onPremInstructions([], context), elasticCloud: cloudInstructions(), onPremElasticCloud: onPremCloudInstructions(), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/cockroachdb_metrics/index.js b/src/plugins/home/server/tutorials/cockroachdb_metrics/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/cockroachdb_metrics/index.js rename to src/plugins/home/server/tutorials/cockroachdb_metrics/index.ts index 0eb54700b50c2..a8146e024a37e 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/cockroachdb_metrics/index.js +++ b/src/plugins/home/server/tutorials/cockroachdb_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function cockroachdbMetricsSpecProvider(context) { +export function cockroachdbMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'cockroachdb'; return { id: 'cockroachdbMetrics', - name: i18n.translate('kbn.server.tutorials.cockroachdbMetrics.nameTitle', { + name: i18n.translate('home.tutorials.cockroachdbMetrics.nameTitle', { defaultMessage: 'CockroachDB metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.cockroachdbMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.cockroachdbMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from the CockroachDB server.', }), - longDescription: i18n.translate('kbn.server.tutorials.cockroachdbMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.cockroachdbMetrics.longDescription', { defaultMessage: 'The `cockroachdb` Metricbeat module fetches monitoring metrics from CockroachDB. \ [Learn more]({learnMoreLink}).', @@ -50,7 +54,7 @@ export function cockroachdbMetricsSpecProvider(context) { { id: 'e3ba0c30-9766-11e9-9eea-6f554992ec1f', linkLabel: i18n.translate( - 'kbn.server.tutorials.cockroachdbMetrics.artifacts.dashboards.linkLabel', + 'home.tutorials.cockroachdbMetrics.artifacts.dashboards.linkLabel', { defaultMessage: 'CockroachDB metrics dashboard', } @@ -64,7 +68,7 @@ export function cockroachdbMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/cockroachdb_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/consul_metrics/index.js b/src/plugins/home/server/tutorials/consul_metrics/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/consul_metrics/index.js rename to src/plugins/home/server/tutorials/consul_metrics/index.ts index 361fd1db39e5a..8b12f38274ee9 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/consul_metrics/index.js +++ b/src/plugins/home/server/tutorials/consul_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function consulMetricsSpecProvider(context) { +export function consulMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'consul'; return { id: 'consulMetrics', - name: i18n.translate('kbn.server.tutorials.consulMetrics.nameTitle', { + name: i18n.translate('home.tutorials.consulMetrics.nameTitle', { defaultMessage: 'Consul metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.consulMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.consulMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from the Consul server.', }), - longDescription: i18n.translate('kbn.server.tutorials.consulMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.consulMetrics.longDescription', { defaultMessage: 'The `consul` Metricbeat module fetches monitoring metrics from Consul. \ [Learn more]({learnMoreLink}).', @@ -49,12 +53,9 @@ export function consulMetricsSpecProvider(context) { dashboards: [ { id: '496910f0-b952-11e9-a579-f5c0a5d81340', - linkLabel: i18n.translate( - 'kbn.server.tutorials.consulMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Consul metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.consulMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'Consul metrics dashboard', + }), isOverview: true, }, ], @@ -64,7 +65,7 @@ export function consulMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/consul_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/coredns_logs/index.js b/src/plugins/home/server/tutorials/coredns_logs/index.ts similarity index 72% rename from src/legacy/core_plugins/kibana/server/tutorials/coredns_logs/index.js rename to src/plugins/home/server/tutorials/coredns_logs/index.ts index ca308ac969e49..e2f976c0f377b 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/coredns_logs/index.js +++ b/src/plugins/home/server/tutorials/coredns_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function corednsLogsSpecProvider(server, context) { +export function corednsLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'coredns'; - const platforms = ['OSX', 'DEB', 'RPM']; + const platforms = ['OSX', 'DEB', 'RPM'] as const; return { id: 'corednsLogs', - name: i18n.translate('kbn.server.tutorials.corednsLogs.nameTitle', { + name: i18n.translate('home.tutorials.corednsLogs.nameTitle', { defaultMessage: 'CoreDNS logs', }), - category: TUTORIAL_CATEGORY.SIEM, - shortDescription: i18n.translate('kbn.server.tutorials.corednsLogs.shortDescription', { + category: TutorialsCategory.SIEM, + shortDescription: i18n.translate('home.tutorials.corednsLogs.shortDescription', { defaultMessage: 'Collect the logs created by Coredns.', }), - longDescription: i18n.translate('kbn.server.tutorials.corednsLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.corednsLogs.longDescription', { defaultMessage: 'The `coredns` Filebeat module collects the logs from \ [CoreDNS](https://coredns.io/manual/toc/). \ @@ -51,12 +55,9 @@ export function corednsLogsSpecProvider(server, context) { dashboards: [ { id: '53aa1f70-443e-11e9-8548-ab7fbe04f038', - linkLabel: i18n.translate( - 'kbn.server.tutorials.corednsLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'CoreDNS logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.corednsLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'CoreDNS logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/coredns_metrics/index.js b/src/plugins/home/server/tutorials/coredns_metrics/index.ts similarity index 72% rename from src/legacy/core_plugins/kibana/server/tutorials/coredns_metrics/index.js rename to src/plugins/home/server/tutorials/coredns_metrics/index.ts index 58bd8f656bafb..ad0ce4a58c738 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/coredns_metrics/index.js +++ b/src/plugins/home/server/tutorials/coredns_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function corednsMetricsSpecProvider(context) { +export function corednsMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'coredns'; return { id: 'corednsMetrics', - name: i18n.translate('kbn.server.tutorials.corednsMetrics.nameTitle', { + name: i18n.translate('home.tutorials.corednsMetrics.nameTitle', { defaultMessage: 'CoreDNS metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.corednsMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.corednsMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from the CoreDNS server.', }), - longDescription: i18n.translate('kbn.server.tutorials.corednsMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.corednsMetrics.longDescription', { defaultMessage: 'The `coredns` Metricbeat module fetches monitoring metrics from CoreDNS. \ [Learn more]({learnMoreLink}).', @@ -47,7 +51,7 @@ export function corednsMetricsSpecProvider(context) { euiIconType: '/plugins/kibana/home/tutorial_resources/logos/coredns.svg', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.corednsMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.corednsMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function corednsMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/coredns_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/couchbase_metrics/index.js b/src/plugins/home/server/tutorials/couchbase_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/couchbase_metrics/index.js rename to src/plugins/home/server/tutorials/couchbase_metrics/index.ts index 3348b9edb7b9c..66b70ba2fb456 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/couchbase_metrics/index.js +++ b/src/plugins/home/server/tutorials/couchbase_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function couchbaseMetricsSpecProvider(context) { +export function couchbaseMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'couchbase'; return { id: 'couchbaseMetrics', - name: i18n.translate('kbn.server.tutorials.couchbaseMetrics.nameTitle', { + name: i18n.translate('home.tutorials.couchbaseMetrics.nameTitle', { defaultMessage: 'Couchbase metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.couchbaseMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.couchbaseMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from Couchbase.', }), - longDescription: i18n.translate('kbn.server.tutorials.couchbaseMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.couchbaseMetrics.longDescription', { defaultMessage: 'The `couchbase` Metricbeat module fetches internal metrics from Couchbase. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function couchbaseMetricsSpecProvider(context) { euiIconType: 'logoCouchbase', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.couchbaseMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.couchbaseMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function couchbaseMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/couchdb_metrics/index.js b/src/plugins/home/server/tutorials/couchdb_metrics/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/couchdb_metrics/index.js rename to src/plugins/home/server/tutorials/couchdb_metrics/index.ts index cf7cec60c1f13..e1423e96b1d47 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/couchdb_metrics/index.js +++ b/src/plugins/home/server/tutorials/couchdb_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function couchdbMetricsSpecProvider(context) { +export function couchdbMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'couchdb'; return { id: 'couchdbMetrics', - name: i18n.translate('kbn.server.tutorials.couchdbMetrics.nameTitle', { + name: i18n.translate('home.tutorials.couchdbMetrics.nameTitle', { defaultMessage: 'CouchDB metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.couchdbMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.couchdbMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from the CouchdB server.', }), - longDescription: i18n.translate('kbn.server.tutorials.couchdbMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.couchdbMetrics.longDescription', { defaultMessage: 'The `couchdb` Metricbeat module fetches monitoring metrics from CouchDB. \ [Learn more]({learnMoreLink}).', @@ -50,7 +54,7 @@ export function couchdbMetricsSpecProvider(context) { { id: '496910f0-b952-11e9-a579-f5c0a5d81340', linkLabel: i18n.translate( - 'kbn.server.tutorials.couchdbMetrics.artifacts.dashboards.linkLabel', + 'home.tutorials.couchdbMetrics.artifacts.dashboards.linkLabel', { defaultMessage: 'CouchDB metrics dashboard', } @@ -64,7 +68,7 @@ export function couchdbMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/couchdb_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/docker_metrics/index.js b/src/plugins/home/server/tutorials/docker_metrics/index.ts similarity index 69% rename from src/legacy/core_plugins/kibana/server/tutorials/docker_metrics/index.js rename to src/plugins/home/server/tutorials/docker_metrics/index.ts index 0ed852afec7b7..4d9d0c9ee68d7 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/docker_metrics/index.js +++ b/src/plugins/home/server/tutorials/docker_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function dockerMetricsSpecProvider(context) { +export function dockerMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'docker'; return { id: 'dockerMetrics', - name: i18n.translate('kbn.server.tutorials.dockerMetrics.nameTitle', { + name: i18n.translate('home.tutorials.dockerMetrics.nameTitle', { defaultMessage: 'Docker metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.dockerMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.dockerMetrics.shortDescription', { defaultMessage: 'Fetch metrics about your Docker containers.', }), - longDescription: i18n.translate('kbn.server.tutorials.dockerMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.dockerMetrics.longDescription', { defaultMessage: 'The `docker` Metricbeat module fetches metrics from the Docker server. \ [Learn more]({learnMoreLink}).', @@ -49,12 +53,9 @@ export function dockerMetricsSpecProvider(context) { dashboards: [ { id: 'AV4REOpp5NkDleZmzKkE-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.dockerMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Docker metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.dockerMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'Docker metrics dashboard', + }), isOverview: true, }, ], @@ -64,7 +65,7 @@ export function dockerMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/docker_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/dropwizard_metrics/index.js b/src/plugins/home/server/tutorials/dropwizard_metrics/index.ts similarity index 69% rename from src/legacy/core_plugins/kibana/server/tutorials/dropwizard_metrics/index.js rename to src/plugins/home/server/tutorials/dropwizard_metrics/index.ts index c32779fb36368..164214ffd749c 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/dropwizard_metrics/index.js +++ b/src/plugins/home/server/tutorials/dropwizard_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function dropwizardMetricsSpecProvider(context) { +export function dropwizardMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'dropwizard'; return { id: 'dropwizardMetrics', - name: i18n.translate('kbn.server.tutorials.dropwizardMetrics.nameTitle', { + name: i18n.translate('home.tutorials.dropwizardMetrics.nameTitle', { defaultMessage: 'Dropwizard metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.dropwizardMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.dropwizardMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from Dropwizard Java application.', }), - longDescription: i18n.translate('kbn.server.tutorials.dropwizardMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.dropwizardMetrics.longDescription', { defaultMessage: 'The `dropwizard` Metricbeat module fetches internal metrics from Dropwizard Java Application. \ [Learn more]({learnMoreLink}).', @@ -48,12 +52,9 @@ export function dropwizardMetricsSpecProvider(context) { euiIconType: 'logoDropwizard', artifacts: { application: { - label: i18n.translate( - 'kbn.server.tutorials.dropwizardMetrics.artifacts.application.label', - { - defaultMessage: 'Discover', - } - ), + label: i18n.translate('home.tutorials.dropwizardMetrics.artifacts.application.label', { + defaultMessage: 'Discover', + }), path: '/app/kibana#/discover', }, dashboards: [], @@ -62,7 +63,7 @@ export function dropwizardMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/elasticsearch_logs/index.js b/src/plugins/home/server/tutorials/elasticsearch_logs/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/elasticsearch_logs/index.js rename to src/plugins/home/server/tutorials/elasticsearch_logs/index.ts index 20bdf38a5f779..4369c805dc7c4 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/elasticsearch_logs/index.js +++ b/src/plugins/home/server/tutorials/elasticsearch_logs/index.ts @@ -18,27 +18,31 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function elasticsearchLogsSpecProvider(context) { +export function elasticsearchLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'elasticsearch'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'elasticsearchLogs', - name: i18n.translate('kbn.server.tutorials.elasticsearchLogs.nameTitle', { + name: i18n.translate('home.tutorials.elasticsearchLogs.nameTitle', { defaultMessage: 'Elasticsearch logs', }), - category: TUTORIAL_CATEGORY.LOGGING, + category: TutorialsCategory.LOGGING, isBeta: true, - shortDescription: i18n.translate('kbn.server.tutorials.elasticsearchLogs.shortDescription', { + shortDescription: i18n.translate('home.tutorials.elasticsearchLogs.shortDescription', { defaultMessage: 'Collect and parse logs created by Elasticsearch.', }), - longDescription: i18n.translate('kbn.server.tutorials.elasticsearchLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.elasticsearchLogs.longDescription', { defaultMessage: 'The `elasticsearch` Filebeat module parses logs created by Elasticsearch. \ [Learn more]({learnMoreLink}).', @@ -49,12 +53,9 @@ export function elasticsearchLogsSpecProvider(context) { euiIconType: 'logoElasticsearch', artifacts: { application: { - label: i18n.translate( - 'kbn.server.tutorials.elasticsearchLogs.artifacts.application.label', - { - defaultMessage: 'Discover', - } - ), + label: i18n.translate('home.tutorials.elasticsearchLogs.artifacts.application.label', { + defaultMessage: 'Discover', + }), path: '/app/kibana#/discover', }, dashboards: [], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/elasticsearch_metrics/index.js b/src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts similarity index 69% rename from src/legacy/core_plugins/kibana/server/tutorials/elasticsearch_metrics/index.js rename to src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts index a4d193ebc1d1f..d9004e72733f9 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/elasticsearch_metrics/index.js +++ b/src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function elasticsearchMetricsSpecProvider(context) { +export function elasticsearchMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'elasticsearch'; return { id: 'elasticsearchMetrics', - name: i18n.translate('kbn.server.tutorials.elasticsearchMetrics.nameTitle', { + name: i18n.translate('home.tutorials.elasticsearchMetrics.nameTitle', { defaultMessage: 'Elasticsearch metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.elasticsearchMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.elasticsearchMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from Elasticsearch.', }), - longDescription: i18n.translate('kbn.server.tutorials.elasticsearchMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.elasticsearchMetrics.longDescription', { defaultMessage: 'The `elasticsearch` Metricbeat module fetches internal metrics from Elasticsearch. \ [Learn more]({learnMoreLink}).', @@ -48,12 +52,9 @@ export function elasticsearchMetricsSpecProvider(context) { euiIconType: 'logoElasticsearch', artifacts: { application: { - label: i18n.translate( - 'kbn.server.tutorials.elasticsearchMetrics.artifacts.application.label', - { - defaultMessage: 'Discover', - } - ), + label: i18n.translate('home.tutorials.elasticsearchMetrics.artifacts.application.label', { + defaultMessage: 'Discover', + }), path: '/app/kibana#/discover', }, dashboards: [], @@ -62,7 +63,7 @@ export function elasticsearchMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/envoyproxy_logs/index.js b/src/plugins/home/server/tutorials/envoyproxy_logs/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/envoyproxy_logs/index.js rename to src/plugins/home/server/tutorials/envoyproxy_logs/index.ts index 977decd413f08..ac2db66dff6b6 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/envoyproxy_logs/index.js +++ b/src/plugins/home/server/tutorials/envoyproxy_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function envoyproxyLogsSpecProvider(context) { +export function envoyproxyLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'envoyproxy'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'envoyproxyLogs', - name: i18n.translate('kbn.server.tutorials.envoyproxyLogs.nameTitle', { + name: i18n.translate('home.tutorials.envoyproxyLogs.nameTitle', { defaultMessage: 'Envoyproxy', }), - category: TUTORIAL_CATEGORY.SIEM, - shortDescription: i18n.translate('kbn.server.tutorials.envoyproxyLogs.shortDescription', { + category: TutorialsCategory.SIEM, + shortDescription: i18n.translate('home.tutorials.envoyproxyLogs.shortDescription', { defaultMessage: 'Collect and parse logs received from the Envoy proxy.', }), - longDescription: i18n.translate('kbn.server.tutorials.envoyproxyLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.envoyproxyLogs.longDescription', { defaultMessage: 'This is a filebeat module for [Envoy proxy access log](https://www.envoyproxy.io/docs/envoy/v1.10.0/configuration/access_log). \ It supports both standalone deployment and Envoy proxy deployment in Kubernetes. \ @@ -46,17 +50,14 @@ It supports both standalone deployment and Envoy proxy deployment in Kubernetes. learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-envoyproxy.html', }, }), - //euiIconType: 'logoCisco', + // euiIconType: 'logoCisco', artifacts: { dashboards: [], application: { path: '/app/siem', - label: i18n.translate( - 'kbn.server.tutorials.envoyproxyLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'SIEM App', - } - ), + label: i18n.translate('home.tutorials.envoyproxyLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'SIEM App', + }), }, exportedFields: { documentationUrl: '{config.docs.beats.filebeat}/exported-fields-envoyproxy.html', diff --git a/src/legacy/core_plugins/kibana/server/tutorials/envoyproxy_metrics/index.js b/src/plugins/home/server/tutorials/envoyproxy_metrics/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/envoyproxy_metrics/index.js rename to src/plugins/home/server/tutorials/envoyproxy_metrics/index.ts index 4e5301149b35b..d405e77918546 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/envoyproxy_metrics/index.js +++ b/src/plugins/home/server/tutorials/envoyproxy_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function envoyproxyMetricsSpecProvider(server, context) { +export function envoyproxyMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'envoyproxy'; return { id: 'envoyproxyMetrics', - name: i18n.translate('kbn.server.tutorials.envoyproxyMetrics.nameTitle', { + name: i18n.translate('home.tutorials.envoyproxyMetrics.nameTitle', { defaultMessage: 'Envoy Proxy metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.envoyproxyMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.envoyproxyMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from Envoy Proxy.', }), - longDescription: i18n.translate('kbn.server.tutorials.envoyproxyMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.envoyproxyMetrics.longDescription', { defaultMessage: 'The `envoyproxy` Metricbeat module fetches monitoring metrics from Envoy Proxy. \ [Learn more]({learnMoreLink}).', @@ -53,7 +57,7 @@ export function envoyproxyMetricsSpecProvider(server, context) { }, completionTimeMinutes: 10, // previewImagePath: '/plugins/kibana/home/tutorial_resources/envoyproxy_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/etcd_metrics/index.js b/src/plugins/home/server/tutorials/etcd_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/etcd_metrics/index.js rename to src/plugins/home/server/tutorials/etcd_metrics/index.ts index fdd0956bb25bb..919700356d98a 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/etcd_metrics/index.js +++ b/src/plugins/home/server/tutorials/etcd_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function etcdMetricsSpecProvider(context) { +export function etcdMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'etcd'; return { id: 'etcdMetrics', - name: i18n.translate('kbn.server.tutorials.etcdMetrics.nameTitle', { + name: i18n.translate('home.tutorials.etcdMetrics.nameTitle', { defaultMessage: 'Etcd metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.etcdMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.etcdMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the Etcd server.', }), - longDescription: i18n.translate('kbn.server.tutorials.etcdMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.etcdMetrics.longDescription', { defaultMessage: 'The `etcd` Metricbeat module fetches internal metrics from Etcd. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function etcdMetricsSpecProvider(context) { euiIconType: 'logoEtcd', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.etcdMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.etcdMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function etcdMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/golang_metrics/index.js b/src/plugins/home/server/tutorials/golang_metrics/index.ts similarity index 69% rename from src/legacy/core_plugins/kibana/server/tutorials/golang_metrics/index.js rename to src/plugins/home/server/tutorials/golang_metrics/index.ts index 7eb6e340c863d..c53f8b2bba281 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/golang_metrics/index.js +++ b/src/plugins/home/server/tutorials/golang_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function golangMetricsSpecProvider(context) { +export function golangMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'golang'; return { id: moduleName + 'Metrics', - name: i18n.translate('kbn.server.tutorials.golangMetrics.nameTitle', { + name: i18n.translate('home.tutorials.golangMetrics.nameTitle', { defaultMessage: 'Golang metrics', }), isBeta: true, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.golangMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.golangMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from a Golang app.', }), - longDescription: i18n.translate('kbn.server.tutorials.golangMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.golangMetrics.longDescription', { defaultMessage: 'The `{moduleName}` Metricbeat module fetches internal metrics from a Golang app. \ [Learn more]({learnMoreLink}).', @@ -51,12 +55,9 @@ export function golangMetricsSpecProvider(context) { dashboards: [ { id: 'f2dc7320-f519-11e6-a3c9-9d1f7c42b045-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.golangMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Golang metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.golangMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'Golang metrics dashboard', + }), isOverview: true, }, ], @@ -65,7 +66,7 @@ export function golangMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/haproxy_metrics/index.js b/src/plugins/home/server/tutorials/haproxy_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/haproxy_metrics/index.js rename to src/plugins/home/server/tutorials/haproxy_metrics/index.ts index 7e2ca4af7fd9c..8e1c0a0da8b18 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/haproxy_metrics/index.js +++ b/src/plugins/home/server/tutorials/haproxy_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function haproxyMetricsSpecProvider(context) { +export function haproxyMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'haproxy'; return { id: 'haproxyMetrics', - name: i18n.translate('kbn.server.tutorials.haproxyMetrics.nameTitle', { + name: i18n.translate('home.tutorials.haproxyMetrics.nameTitle', { defaultMessage: 'HAProxy metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.haproxyMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.haproxyMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the HAProxy server.', }), - longDescription: i18n.translate('kbn.server.tutorials.haproxyMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.haproxyMetrics.longDescription', { defaultMessage: 'The `haproxy` Metricbeat module fetches internal metrics from HAProxy. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function haproxyMetricsSpecProvider(context) { euiIconType: 'logoHAproxy', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.haproxyMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.haproxyMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function haproxyMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/ibmmq_logs/index.js b/src/plugins/home/server/tutorials/ibmmq_logs/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/ibmmq_logs/index.js rename to src/plugins/home/server/tutorials/ibmmq_logs/index.ts index 4ffda2d7a523c..9922cb0e6341e 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/ibmmq_logs/index.js +++ b/src/plugins/home/server/tutorials/ibmmq_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function ibmmqLogsSpecProvider(server, context) { +export function ibmmqLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'ibmmq'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'ibmmqLogs', - name: i18n.translate('kbn.server.tutorials.ibmmqLogs.nameTitle', { + name: i18n.translate('home.tutorials.ibmmqLogs.nameTitle', { defaultMessage: 'IBM MQ logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.ibmmqLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.ibmmqLogs.shortDescription', { defaultMessage: 'Collect IBM MQ logs with Filebeat.', }), - longDescription: i18n.translate('kbn.server.tutorials.ibmmqLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.ibmmqLogs.longDescription', { defaultMessage: 'Collect IBM MQ logs with Filebeat. \ [Learn more]({learnMoreLink}).', values: { @@ -49,12 +53,9 @@ export function ibmmqLogsSpecProvider(server, context) { dashboards: [ { id: 'ba1d8830-7c7b-11e9-9645-e37efaf5baff', - linkLabel: i18n.translate( - 'kbn.server.tutorials.ibmmqLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'IBM MQ Events', - } - ), + linkLabel: i18n.translate('home.tutorials.ibmmqLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'IBM MQ Events', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/ibmmq_metrics/index.js b/src/plugins/home/server/tutorials/ibmmq_metrics/index.ts similarity index 73% rename from src/legacy/core_plugins/kibana/server/tutorials/ibmmq_metrics/index.js rename to src/plugins/home/server/tutorials/ibmmq_metrics/index.ts index b2824832dc14c..2055196f833b2 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/ibmmq_metrics/index.js +++ b/src/plugins/home/server/tutorials/ibmmq_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function ibmmqMetricsSpecProvider(context) { +export function ibmmqMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'ibmmq'; return { id: 'ibmmqMetrics', - name: i18n.translate('kbn.server.tutorials.ibmmqMetrics.nameTitle', { + name: i18n.translate('home.tutorials.ibmmqMetrics.nameTitle', { defaultMessage: 'IBM MQ metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.ibmmqMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.ibmmqMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from IBM MQ instances.', }), - longDescription: i18n.translate('kbn.server.tutorials.ibmmqMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.ibmmqMetrics.longDescription', { defaultMessage: 'The `ibmmq` Metricbeat module fetches monitoring metrics from IBM MQ instances \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function ibmmqMetricsSpecProvider(context) { isBeta: true, artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.ibmmqMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.ibmmqMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -60,7 +64,7 @@ export function ibmmqMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/ibmmq_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/iis_logs/index.js b/src/plugins/home/server/tutorials/iis_logs/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/iis_logs/index.js rename to src/plugins/home/server/tutorials/iis_logs/index.ts index d2a5b5f113d29..ff9996c1b0187 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/iis_logs/index.js +++ b/src/plugins/home/server/tutorials/iis_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function iisLogsSpecProvider(context) { +export function iisLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'iis'; - const platforms = ['WINDOWS']; + const platforms = ['WINDOWS'] as const; return { id: 'iisLogs', - name: i18n.translate('kbn.server.tutorials.iisLogs.nameTitle', { + name: i18n.translate('home.tutorials.iisLogs.nameTitle', { defaultMessage: 'IIS logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.iisLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.iisLogs.shortDescription', { defaultMessage: 'Collect and parse access and error logs created by the IIS HTTP server.', }), - longDescription: i18n.translate('kbn.server.tutorials.iisLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.iisLogs.longDescription', { defaultMessage: 'The `iis` Filebeat module parses access and error logs created by the IIS HTTP server. \ [Learn more]({learnMoreLink}).', @@ -50,7 +54,7 @@ export function iisLogsSpecProvider(context) { dashboards: [ { id: '4278ad30-fe16-11e7-a3b0-d13028918f9f-ecs', - linkLabel: i18n.translate('kbn.server.tutorials.iisLogs.artifacts.dashboards.linkLabel', { + linkLabel: i18n.translate('home.tutorials.iisLogs.artifacts.dashboards.linkLabel', { defaultMessage: 'IIS logs dashboard', }), isOverview: true, diff --git a/src/legacy/core_plugins/kibana/common/tutorials/auditbeat_instructions.js b/src/plugins/home/server/tutorials/instructions/auditbeat_instructions.ts similarity index 67% rename from src/legacy/core_plugins/kibana/common/tutorials/auditbeat_instructions.js rename to src/plugins/home/server/tutorials/instructions/auditbeat_instructions.ts index 3d95738ab21f7..6a9dba69b193f 100644 --- a/src/legacy/core_plugins/kibana/common/tutorials/auditbeat_instructions.js +++ b/src/plugins/home/server/tutorials/instructions/auditbeat_instructions.ts @@ -20,15 +20,16 @@ import { i18n } from '@kbn/i18n'; import { INSTRUCTION_VARIANT } from './instruction_variant'; import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions'; -import { getSpaceIdForBeatsTutorial } from '../lib/get_space_id_for_beats_tutorial'; +import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial'; +import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types'; -export const createAuditbeatInstructions = context => ({ +export const createAuditbeatInstructions = (context?: TutorialContext) => ({ INSTALL: { OSX: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.install.osxTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.osxTitle', { defaultMessage: 'Download and install Auditbeat', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.install.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.install.osxTextPre', { defaultMessage: 'First time using Auditbeat? See the [Getting Started Guide]({linkUrl}).', values: { linkUrl: '{config.docs.beats.auditbeat}/auditbeat-getting-started.html', @@ -41,10 +42,10 @@ export const createAuditbeatInstructions = context => ({ ], }, DEB: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.install.debTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.debTitle', { defaultMessage: 'Download and install Auditbeat', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.install.debTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.install.debTextPre', { defaultMessage: 'First time using Auditbeat? See the [Getting Started Guide]({linkUrl}).', values: { linkUrl: '{config.docs.beats.auditbeat}/auditbeat-getting-started.html', @@ -54,7 +55,7 @@ export const createAuditbeatInstructions = context => ({ 'curl -L -O https://artifacts.elastic.co/downloads/beats/auditbeat/auditbeat-{config.kibana.version}-amd64.deb', 'sudo dpkg -i auditbeat-{config.kibana.version}-amd64.deb', ], - textPost: i18n.translate('kbn.common.tutorials.auditbeatInstructions.install.debTextPost', { + textPost: i18n.translate('home.tutorials.common.auditbeatInstructions.install.debTextPost', { defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).', values: { linkUrl: 'https://www.elastic.co/downloads/beats/auditbeat', @@ -62,10 +63,10 @@ export const createAuditbeatInstructions = context => ({ }), }, RPM: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.install.rpmTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.rpmTitle', { defaultMessage: 'Download and install Auditbeat', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.install.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.install.rpmTextPre', { defaultMessage: 'First time using Auditbeat? See the [Getting Started Guide]({linkUrl}).', values: { linkUrl: '{config.docs.beats.auditbeat}/auditbeat-getting-started.html', @@ -75,7 +76,7 @@ export const createAuditbeatInstructions = context => ({ 'curl -L -O https://artifacts.elastic.co/downloads/beats/auditbeat/auditbeat-{config.kibana.version}-x86_64.rpm', 'sudo rpm -vi auditbeat-{config.kibana.version}-x86_64.rpm', ], - textPost: i18n.translate('kbn.common.tutorials.auditbeatInstructions.install.rpmTextPost', { + textPost: i18n.translate('home.tutorials.common.auditbeatInstructions.install.rpmTextPost', { defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).', values: { linkUrl: 'https://www.elastic.co/downloads/beats/auditbeat', @@ -83,28 +84,31 @@ export const createAuditbeatInstructions = context => ({ }), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.install.windowsTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.windowsTitle', { defaultMessage: 'Download and install Auditbeat', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.install.windowsTextPre', { - defaultMessage: - 'First time using Auditbeat? See the [Getting Started Guide]({guideLinkUrl}).\n\ + textPre: i18n.translate( + 'home.tutorials.common.auditbeatInstructions.install.windowsTextPre', + { + defaultMessage: + 'First time using Auditbeat? See the [Getting Started Guide]({guideLinkUrl}).\n\ 1. Download the Auditbeat Windows zip file from the [Download]({auditbeatLinkUrl}) page.\n\ 2. Extract the contents of the zip file into {folderPath}.\n\ 3. Rename the `{directoryName}` directory to `Auditbeat`.\n\ 4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select \ **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n\ 5. From the PowerShell prompt, run the following commands to install Auditbeat as a Windows service.', - values: { - folderPath: '`C:\\Program Files`', - guideLinkUrl: '{config.docs.beats.auditbeat}/auditbeat-getting-started.html', - auditbeatLinkUrl: 'https://www.elastic.co/downloads/beats/auditbeat', - directoryName: 'auditbeat-{config.kibana.version}-windows', - }, - }), + values: { + folderPath: '`C:\\Program Files`', + guideLinkUrl: '{config.docs.beats.auditbeat}/auditbeat-getting-started.html', + auditbeatLinkUrl: 'https://www.elastic.co/downloads/beats/auditbeat', + directoryName: 'auditbeat-{config.kibana.version}-windows', + }, + } + ), commands: ['cd "C:\\Program Files\\Auditbeat"', '.\\install-service-auditbeat.ps1'], textPost: i18n.translate( - 'kbn.common.tutorials.auditbeatInstructions.install.windowsTextPost', + 'home.tutorials.common.auditbeatInstructions.install.windowsTextPost', { defaultMessage: 'Modify the settings under {propertyName} in the {auditbeatPath} file to point to your Elasticsearch installation.', @@ -118,40 +122,40 @@ export const createAuditbeatInstructions = context => ({ }, START: { OSX: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.start.osxTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.osxTitle', { defaultMessage: 'Start Auditbeat', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.start.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.osxTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), commands: ['./auditbeat setup', './auditbeat -e'], }, DEB: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.start.debTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.debTitle', { defaultMessage: 'Start Auditbeat', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.start.debTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.debTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), commands: ['sudo auditbeat setup', 'sudo service auditbeat start'], }, RPM: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.start.rpmTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.rpmTitle', { defaultMessage: 'Start Auditbeat', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.start.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.rpmTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), commands: ['sudo auditbeat setup', 'sudo service auditbeat start'], }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.start.windowsTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.windowsTitle', { defaultMessage: 'Start Auditbeat', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.start.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.windowsTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), @@ -160,10 +164,10 @@ export const createAuditbeatInstructions = context => ({ }, CONFIG: { OSX: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.osxTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.osxTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.osxTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`auditbeat.yml`', @@ -178,7 +182,7 @@ export const createAuditbeatInstructions = context => ({ ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.osxTextPost', { + textPost: i18n.translate('home.tutorials.common.auditbeatInstructions.config.osxTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -190,10 +194,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, DEB: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.debTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.debTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.debTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.debTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`/etc/auditbeat/auditbeat.yml`', @@ -208,7 +212,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.debTextPost', { + textPost: i18n.translate('home.tutorials.common.auditbeatInstructions.config.debTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -220,10 +224,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, RPM: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.rpmTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.rpmTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.rpmTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`/etc/auditbeat/auditbeat.yml`', @@ -238,7 +242,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.rpmTextPost', { + textPost: i18n.translate('home.tutorials.common.auditbeatInstructions.config.rpmTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -250,10 +254,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.windowsTitle', { + title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.windowsTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatInstructions.config.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.windowsTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`C:\\Program Files\\Auditbeat\\auditbeat.yml`', @@ -269,7 +273,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', getSpaceIdForBeatsTutorial(context), ], textPost: i18n.translate( - 'kbn.common.tutorials.auditbeatInstructions.config.windowsTextPost', + 'home.tutorials.common.auditbeatInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ @@ -288,18 +292,21 @@ and {kibanaUrlTemplate} is the URL of Kibana.', export const createAuditbeatCloudInstructions = () => ({ CONFIG: { OSX: { - title: i18n.translate('kbn.common.tutorials.auditbeatCloudInstructions.config.osxTitle', { + title: i18n.translate('home.tutorials.common.auditbeatCloudInstructions.config.osxTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatCloudInstructions.config.osxTextPre', { - defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', - values: { - path: '`auditbeat.yml`', - }, - }), + textPre: i18n.translate( + 'home.tutorials.common.auditbeatCloudInstructions.config.osxTextPre', + { + defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', + values: { + path: '`auditbeat.yml`', + }, + } + ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.auditbeatCloudInstructions.config.osxTextPost', + 'home.tutorials.common.auditbeatCloudInstructions.config.osxTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -307,18 +314,21 @@ export const createAuditbeatCloudInstructions = () => ({ ), }, DEB: { - title: i18n.translate('kbn.common.tutorials.auditbeatCloudInstructions.config.debTitle', { + title: i18n.translate('home.tutorials.common.auditbeatCloudInstructions.config.debTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatCloudInstructions.config.debTextPre', { - defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', - values: { - path: '`/etc/auditbeat/auditbeat.yml`', - }, - }), + textPre: i18n.translate( + 'home.tutorials.common.auditbeatCloudInstructions.config.debTextPre', + { + defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', + values: { + path: '`/etc/auditbeat/auditbeat.yml`', + }, + } + ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.auditbeatCloudInstructions.config.debTextPost', + 'home.tutorials.common.auditbeatCloudInstructions.config.debTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -326,18 +336,21 @@ export const createAuditbeatCloudInstructions = () => ({ ), }, RPM: { - title: i18n.translate('kbn.common.tutorials.auditbeatCloudInstructions.config.rpmTitle', { + title: i18n.translate('home.tutorials.common.auditbeatCloudInstructions.config.rpmTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.auditbeatCloudInstructions.config.rpmTextPre', { - defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', - values: { - path: '`/etc/auditbeat/auditbeat.yml`', - }, - }), + textPre: i18n.translate( + 'home.tutorials.common.auditbeatCloudInstructions.config.rpmTextPre', + { + defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', + values: { + path: '`/etc/auditbeat/auditbeat.yml`', + }, + } + ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.auditbeatCloudInstructions.config.rpmTextPost', + 'home.tutorials.common.auditbeatCloudInstructions.config.rpmTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -345,11 +358,14 @@ export const createAuditbeatCloudInstructions = () => ({ ), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.auditbeatCloudInstructions.config.windowsTitle', { - defaultMessage: 'Edit the configuration', - }), + title: i18n.translate( + 'home.tutorials.common.auditbeatCloudInstructions.config.windowsTitle', + { + defaultMessage: 'Edit the configuration', + } + ), textPre: i18n.translate( - 'kbn.common.tutorials.auditbeatCloudInstructions.config.windowsTextPre', + 'home.tutorials.common.auditbeatCloudInstructions.config.windowsTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { @@ -359,7 +375,7 @@ export const createAuditbeatCloudInstructions = () => ({ ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.auditbeatCloudInstructions.config.windowsTextPost', + 'home.tutorials.common.auditbeatCloudInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -371,19 +387,19 @@ export const createAuditbeatCloudInstructions = () => ({ export function auditbeatStatusCheck() { return { - title: i18n.translate('kbn.common.tutorials.auditbeatStatusCheck.title', { + title: i18n.translate('home.tutorials.common.auditbeatStatusCheck.title', { defaultMessage: 'Status', }), - text: i18n.translate('kbn.common.tutorials.auditbeatStatusCheck.text', { + text: i18n.translate('home.tutorials.common.auditbeatStatusCheck.text', { defaultMessage: 'Check that data is received from Auditbeat', }), - btnLabel: i18n.translate('kbn.common.tutorials.auditbeatStatusCheck.buttonLabel', { + btnLabel: i18n.translate('home.tutorials.common.auditbeatStatusCheck.buttonLabel', { defaultMessage: 'Check data', }), - success: i18n.translate('kbn.common.tutorials.auditbeatStatusCheck.successText', { + success: i18n.translate('home.tutorials.common.auditbeatStatusCheck.successText', { defaultMessage: 'Data successfully received', }), - error: i18n.translate('kbn.common.tutorials.auditbeatStatusCheck.errorText', { + error: i18n.translate('home.tutorials.common.auditbeatStatusCheck.errorText', { defaultMessage: 'No data has been received yet', }), esHitsCheck: { @@ -401,7 +417,7 @@ export function auditbeatStatusCheck() { }; } -export function onPremInstructions(platforms, context) { +export function onPremInstructions(platforms: readonly Platform[], context?: TutorialContext) { const AUDITBEAT_INSTRUCTIONS = createAuditbeatInstructions(context); const variants = []; @@ -413,14 +429,14 @@ export function onPremInstructions(platforms, context) { instructions.push(AUDITBEAT_INSTRUCTIONS.START[platform]); variants.push({ id: INSTRUCTION_VARIANT[platform], - instructions: instructions, + instructions, }); } return { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.auditbeat.premInstructions.gettingStarted.title', + 'home.tutorials.common.auditbeat.premInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -432,7 +448,7 @@ export function onPremInstructions(platforms, context) { }; } -export function onPremCloudInstructions(platforms) { +export function onPremCloudInstructions(platforms: readonly Platform[]) { const AUDITBEAT_INSTRUCTIONS = createAuditbeatInstructions(); const TRYCLOUD_OPTION1 = createTrycloudOption1(); const TRYCLOUD_OPTION2 = createTrycloudOption2(); @@ -456,7 +472,7 @@ export function onPremCloudInstructions(platforms) { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.auditbeat.premCloudInstructions.gettingStarted.title', + 'home.tutorials.common.auditbeat.premCloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -468,7 +484,7 @@ export function onPremCloudInstructions(platforms) { }; } -export function cloudInstructions(platforms) { +export function cloudInstructions(platforms: readonly Platform[]) { const AUDITBEAT_INSTRUCTIONS = createAuditbeatInstructions(); const AUDITBEAT_CLOUD_INSTRUCTIONS = createAuditbeatCloudInstructions(); @@ -489,7 +505,7 @@ export function cloudInstructions(platforms) { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.auditbeat.cloudInstructions.gettingStarted.title', + 'home.tutorials.common.auditbeat.cloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } diff --git a/src/legacy/core_plugins/kibana/common/tutorials/filebeat_instructions.js b/src/plugins/home/server/tutorials/instructions/filebeat_instructions.ts similarity index 70% rename from src/legacy/core_plugins/kibana/common/tutorials/filebeat_instructions.js rename to src/plugins/home/server/tutorials/instructions/filebeat_instructions.ts index 2180a489a449d..176a3901821f1 100644 --- a/src/legacy/core_plugins/kibana/common/tutorials/filebeat_instructions.js +++ b/src/plugins/home/server/tutorials/instructions/filebeat_instructions.ts @@ -20,15 +20,16 @@ import { i18n } from '@kbn/i18n'; import { INSTRUCTION_VARIANT } from './instruction_variant'; import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions'; -import { getSpaceIdForBeatsTutorial } from '../lib/get_space_id_for_beats_tutorial'; +import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial'; +import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types'; -export const createFilebeatInstructions = context => ({ +export const createFilebeatInstructions = (context?: TutorialContext) => ({ INSTALL: { OSX: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.osxTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.install.osxTitle', { defaultMessage: 'Download and install Filebeat', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.osxTextPre', { defaultMessage: 'First time using Filebeat? See the [Getting Started Guide]({linkUrl}).', values: { linkUrl: '{config.docs.beats.filebeat}/filebeat-getting-started.html', @@ -41,10 +42,10 @@ export const createFilebeatInstructions = context => ({ ], }, DEB: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.debTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.install.debTitle', { defaultMessage: 'Download and install Filebeat', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.debTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.debTextPre', { defaultMessage: 'First time using Filebeat? See the [Getting Started Guide]({linkUrl}).', values: { linkUrl: '{config.docs.beats.filebeat}/filebeat-getting-started.html', @@ -54,7 +55,7 @@ export const createFilebeatInstructions = context => ({ 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-amd64.deb', 'sudo dpkg -i filebeat-{config.kibana.version}-amd64.deb', ], - textPost: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.debTextPost', { + textPost: i18n.translate('home.tutorials.common.filebeatInstructions.install.debTextPost', { defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).', values: { linkUrl: 'https://www.elastic.co/downloads/beats/filebeat', @@ -62,10 +63,10 @@ export const createFilebeatInstructions = context => ({ }), }, RPM: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.rpmTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.install.rpmTitle', { defaultMessage: 'Download and install Filebeat', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.rpmTextPre', { defaultMessage: 'First time using Filebeat? See the [Getting Started Guide]({linkUrl}).', values: { linkUrl: '{config.docs.beats.filebeat}/filebeat-getting-started.html', @@ -75,7 +76,7 @@ export const createFilebeatInstructions = context => ({ 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-x86_64.rpm', 'sudo rpm -vi filebeat-{config.kibana.version}-x86_64.rpm', ], - textPost: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.rpmTextPost', { + textPost: i18n.translate('home.tutorials.common.filebeatInstructions.install.rpmTextPost', { defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).', values: { linkUrl: 'https://www.elastic.co/downloads/beats/filebeat', @@ -83,10 +84,10 @@ export const createFilebeatInstructions = context => ({ }), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.windowsTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.install.windowsTitle', { defaultMessage: 'Download and install Filebeat', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.windowsTextPre', { defaultMessage: 'First time using Filebeat? See the [Getting Started Guide]({guideLinkUrl}).\n\ 1. Download the Filebeat Windows zip file from the [Download]({filebeatLinkUrl}) page.\n\ @@ -104,7 +105,7 @@ export const createFilebeatInstructions = context => ({ }), commands: ['cd "C:\\Program Files\\Filebeat"', '.\\install-service-filebeat.ps1'], textPost: i18n.translate( - 'kbn.common.tutorials.filebeatInstructions.install.windowsTextPost', + 'home.tutorials.common.filebeatInstructions.install.windowsTextPost', { defaultMessage: 'Modify the settings under {propertyName} in the {filebeatPath} file to point to your Elasticsearch installation.', @@ -118,40 +119,40 @@ export const createFilebeatInstructions = context => ({ }, START: { OSX: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.start.osxTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.start.osxTitle', { defaultMessage: 'Start Filebeat', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.start.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.osxTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), commands: ['./filebeat setup', './filebeat -e'], }, DEB: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.start.debTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.start.debTitle', { defaultMessage: 'Start Filebeat', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.start.debTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.debTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), commands: ['sudo filebeat setup', 'sudo service filebeat start'], }, RPM: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.start.rpmTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.start.rpmTitle', { defaultMessage: 'Start Filebeat', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.start.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.rpmTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), commands: ['sudo filebeat setup', 'sudo service filebeat start'], }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.start.windowsTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.start.windowsTitle', { defaultMessage: 'Start Filebeat', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.start.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.windowsTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), @@ -160,10 +161,10 @@ export const createFilebeatInstructions = context => ({ }, CONFIG: { OSX: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.osxTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.config.osxTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.osxTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`filebeat.yml`', @@ -178,7 +179,7 @@ export const createFilebeatInstructions = context => ({ ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.osxTextPost', { + textPost: i18n.translate('home.tutorials.common.filebeatInstructions.config.osxTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -190,10 +191,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, DEB: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.debTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.config.debTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.debTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.debTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`/etc/filebeat/filebeat.yml`', @@ -208,7 +209,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.debTextPost', { + textPost: i18n.translate('home.tutorials.common.filebeatInstructions.config.debTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -220,10 +221,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, RPM: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.rpmTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.config.rpmTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.rpmTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`/etc/filebeat/filebeat.yml`', @@ -238,7 +239,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.rpmTextPost', { + textPost: i18n.translate('home.tutorials.common.filebeatInstructions.config.rpmTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -250,10 +251,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.windowsTitle', { + title: i18n.translate('home.tutorials.common.filebeatInstructions.config.windowsTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.windowsTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`C:\\Program Files\\Filebeat\\filebeat.yml`', @@ -268,16 +269,19 @@ and {kibanaUrlTemplate} is the URL of Kibana.', ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.windowsTextPost', { - defaultMessage: - 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ + textPost: i18n.translate( + 'home.tutorials.common.filebeatInstructions.config.windowsTextPost', + { + defaultMessage: + 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', - values: { - passwordTemplate: '``', - esUrlTemplate: '``', - kibanaUrlTemplate: '``', - }, - }), + values: { + passwordTemplate: '``', + esUrlTemplate: '``', + kibanaUrlTemplate: '``', + }, + } + ), }, }, }); @@ -285,10 +289,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', export const createFilebeatCloudInstructions = () => ({ CONFIG: { OSX: { - title: i18n.translate('kbn.common.tutorials.filebeatCloudInstructions.config.osxTitle', { + title: i18n.translate('home.tutorials.common.filebeatCloudInstructions.config.osxTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatCloudInstructions.config.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatCloudInstructions.config.osxTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { path: '`filebeat.yml`', @@ -296,7 +300,7 @@ export const createFilebeatCloudInstructions = () => ({ }), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.filebeatCloudInstructions.config.osxTextPost', + 'home.tutorials.common.filebeatCloudInstructions.config.osxTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -304,10 +308,10 @@ export const createFilebeatCloudInstructions = () => ({ ), }, DEB: { - title: i18n.translate('kbn.common.tutorials.filebeatCloudInstructions.config.debTitle', { + title: i18n.translate('home.tutorials.common.filebeatCloudInstructions.config.debTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatCloudInstructions.config.debTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatCloudInstructions.config.debTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { path: '`/etc/filebeat/filebeat.yml`', @@ -315,7 +319,7 @@ export const createFilebeatCloudInstructions = () => ({ }), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.filebeatCloudInstructions.config.debTextPost', + 'home.tutorials.common.filebeatCloudInstructions.config.debTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -323,10 +327,10 @@ export const createFilebeatCloudInstructions = () => ({ ), }, RPM: { - title: i18n.translate('kbn.common.tutorials.filebeatCloudInstructions.config.rpmTitle', { + title: i18n.translate('home.tutorials.common.filebeatCloudInstructions.config.rpmTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.filebeatCloudInstructions.config.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatCloudInstructions.config.rpmTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { path: '`/etc/filebeat/filebeat.yml`', @@ -334,7 +338,7 @@ export const createFilebeatCloudInstructions = () => ({ }), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.filebeatCloudInstructions.config.rpmTextPost', + 'home.tutorials.common.filebeatCloudInstructions.config.rpmTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -342,11 +346,11 @@ export const createFilebeatCloudInstructions = () => ({ ), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.filebeatCloudInstructions.config.windowsTitle', { + title: i18n.translate('home.tutorials.common.filebeatCloudInstructions.config.windowsTitle', { defaultMessage: 'Edit the configuration', }), textPre: i18n.translate( - 'kbn.common.tutorials.filebeatCloudInstructions.config.windowsTextPre', + 'home.tutorials.common.filebeatCloudInstructions.config.windowsTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { @@ -356,7 +360,7 @@ export const createFilebeatCloudInstructions = () => ({ ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.filebeatCloudInstructions.config.windowsTextPost', + 'home.tutorials.common.filebeatCloudInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -366,57 +370,57 @@ export const createFilebeatCloudInstructions = () => ({ }, }); -export function filebeatEnableInstructions(moduleName) { +export function filebeatEnableInstructions(moduleName: string) { return { OSX: { - title: i18n.translate('kbn.common.tutorials.filebeatEnableInstructions.osxTitle', { + title: i18n.translate('home.tutorials.common.filebeatEnableInstructions.osxTitle', { defaultMessage: 'Enable and configure the {moduleName} module', values: { moduleName }, }), - textPre: i18n.translate('kbn.common.tutorials.filebeatEnableInstructions.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatEnableInstructions.osxTextPre', { defaultMessage: 'From the installation directory, run:', }), commands: ['./filebeat modules enable ' + moduleName], - textPost: i18n.translate('kbn.common.tutorials.filebeatEnableInstructions.osxTextPost', { + textPost: i18n.translate('home.tutorials.common.filebeatEnableInstructions.osxTextPost', { defaultMessage: 'Modify the settings in the `modules.d/{moduleName}.yml` file.', values: { moduleName }, }), }, DEB: { - title: i18n.translate('kbn.common.tutorials.filebeatEnableInstructions.debTitle', { + title: i18n.translate('home.tutorials.common.filebeatEnableInstructions.debTitle', { defaultMessage: 'Enable and configure the {moduleName} module', values: { moduleName }, }), commands: ['sudo filebeat modules enable ' + moduleName], - textPost: i18n.translate('kbn.common.tutorials.filebeatEnableInstructions.debTextPost', { + textPost: i18n.translate('home.tutorials.common.filebeatEnableInstructions.debTextPost', { defaultMessage: 'Modify the settings in the `/etc/filebeat/modules.d/{moduleName}.yml` file.', values: { moduleName }, }), }, RPM: { - title: i18n.translate('kbn.common.tutorials.filebeatEnableInstructions.rpmTitle', { + title: i18n.translate('home.tutorials.common.filebeatEnableInstructions.rpmTitle', { defaultMessage: 'Enable and configure the {moduleName} module', values: { moduleName }, }), commands: ['sudo filebeat modules enable ' + moduleName], - textPost: i18n.translate('kbn.common.tutorials.filebeatEnableInstructions.rpmTextPost', { + textPost: i18n.translate('home.tutorials.common.filebeatEnableInstructions.rpmTextPost', { defaultMessage: 'Modify the settings in the `/etc/filebeat/modules.d/{moduleName}.yml` file.', values: { moduleName }, }), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.filebeatEnableInstructions.windowsTitle', { + title: i18n.translate('home.tutorials.common.filebeatEnableInstructions.windowsTitle', { defaultMessage: 'Enable and configure the {moduleName} module', values: { moduleName }, }), - textPre: i18n.translate('kbn.common.tutorials.filebeatEnableInstructions.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.filebeatEnableInstructions.windowsTextPre', { defaultMessage: 'From the {path} folder, run:', values: { path: `C:\\Program Files\\Filebeat` }, }), commands: ['filebeat.exe modules enable ' + moduleName], - textPost: i18n.translate('kbn.common.tutorials.filebeatEnableInstructions.windowsTextPost', { + textPost: i18n.translate('home.tutorials.common.filebeatEnableInstructions.windowsTextPost', { defaultMessage: 'Modify the settings in the `modules.d/{moduleName}.yml` file.', values: { moduleName }, }), @@ -424,22 +428,22 @@ export function filebeatEnableInstructions(moduleName) { }; } -export function filebeatStatusCheck(moduleName) { +export function filebeatStatusCheck(moduleName: string) { return { - title: i18n.translate('kbn.common.tutorials.filebeatStatusCheck.title', { + title: i18n.translate('home.tutorials.common.filebeatStatusCheck.title', { defaultMessage: 'Module status', }), - text: i18n.translate('kbn.common.tutorials.filebeatStatusCheck.text', { + text: i18n.translate('home.tutorials.common.filebeatStatusCheck.text', { defaultMessage: 'Check that data is received from the Filebeat `{moduleName}` module', values: { moduleName }, }), - btnLabel: i18n.translate('kbn.common.tutorials.filebeatStatusCheck.buttonLabel', { + btnLabel: i18n.translate('home.tutorials.common.filebeatStatusCheck.buttonLabel', { defaultMessage: 'Check data', }), - success: i18n.translate('kbn.common.tutorials.filebeatStatusCheck.successText', { + success: i18n.translate('home.tutorials.common.filebeatStatusCheck.successText', { defaultMessage: 'Data successfully received from this module', }), - error: i18n.translate('kbn.common.tutorials.filebeatStatusCheck.errorText', { + error: i18n.translate('home.tutorials.common.filebeatStatusCheck.errorText', { defaultMessage: 'No data has been received from this module yet', }), esHitsCheck: { @@ -457,7 +461,11 @@ export function filebeatStatusCheck(moduleName) { }; } -export function onPremInstructions(moduleName, platforms, context) { +export function onPremInstructions( + moduleName: string, + platforms: readonly Platform[] = [], + context?: TutorialContext +) { const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions(context); const variants = []; @@ -470,14 +478,14 @@ export function onPremInstructions(moduleName, platforms, context) { instructions.push(FILEBEAT_INSTRUCTIONS.START[platform]); variants.push({ id: INSTRUCTION_VARIANT[platform], - instructions: instructions, + instructions, }); } return { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.filebeat.premInstructions.gettingStarted.title', + 'home.tutorials.common.filebeat.premInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -489,7 +497,7 @@ export function onPremInstructions(moduleName, platforms, context) { }; } -export function onPremCloudInstructions(moduleName, platforms) { +export function onPremCloudInstructions(moduleName: string, platforms: readonly Platform[] = []) { const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions(); const TRYCLOUD_OPTION1 = createTrycloudOption1(); const TRYCLOUD_OPTION2 = createTrycloudOption2(); @@ -514,7 +522,7 @@ export function onPremCloudInstructions(moduleName, platforms) { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.filebeat.premCloudInstructions.gettingStarted.title', + 'home.tutorials.common.filebeat.premCloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -526,7 +534,7 @@ export function onPremCloudInstructions(moduleName, platforms) { }; } -export function cloudInstructions(moduleName, platforms) { +export function cloudInstructions(moduleName: string, platforms: readonly Platform[] = []) { const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions(); const FILEBEAT_CLOUD_INSTRUCTIONS = createFilebeatCloudInstructions(); @@ -548,7 +556,7 @@ export function cloudInstructions(moduleName, platforms) { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.filebeat.cloudInstructions.gettingStarted.title', + 'home.tutorials.common.filebeat.cloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } diff --git a/src/legacy/core_plugins/kibana/common/tutorials/functionbeat_instructions.js b/src/plugins/home/server/tutorials/instructions/functionbeat_instructions.ts similarity index 79% rename from src/legacy/core_plugins/kibana/common/tutorials/functionbeat_instructions.js rename to src/plugins/home/server/tutorials/instructions/functionbeat_instructions.ts index f4116191c1cac..385880ba9780f 100644 --- a/src/legacy/core_plugins/kibana/common/tutorials/functionbeat_instructions.js +++ b/src/plugins/home/server/tutorials/instructions/functionbeat_instructions.ts @@ -20,15 +20,16 @@ import { i18n } from '@kbn/i18n'; import { INSTRUCTION_VARIANT } from './instruction_variant'; import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions'; -import { getSpaceIdForBeatsTutorial } from '../lib/get_space_id_for_beats_tutorial'; +import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial'; +import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types'; -export const createFunctionbeatInstructions = context => ({ +export const createFunctionbeatInstructions = (context?: TutorialContext) => ({ INSTALL: { OSX: { - title: i18n.translate('kbn.common.tutorials.functionbeatInstructions.install.osxTitle', { + title: i18n.translate('home.tutorials.common.functionbeatInstructions.install.osxTitle', { defaultMessage: 'Download and install Functionbeat', }), - textPre: i18n.translate('kbn.common.tutorials.functionbeatInstructions.install.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.functionbeatInstructions.install.osxTextPre', { defaultMessage: 'First time using Functionbeat? See the [Getting Started Guide]({link}).', values: { link: '{config.docs.beats.functionbeat}/functionbeat-getting-started.html' }, }), @@ -39,11 +40,11 @@ export const createFunctionbeatInstructions = context => ({ ], }, LINUX: { - title: i18n.translate('kbn.common.tutorials.functionbeatInstructions.install.linuxTitle', { + title: i18n.translate('home.tutorials.common.functionbeatInstructions.install.linuxTitle', { defaultMessage: 'Download and install Functionbeat', }), textPre: i18n.translate( - 'kbn.common.tutorials.functionbeatInstructions.install.linuxTextPre', + 'home.tutorials.common.functionbeatInstructions.install.linuxTextPre', { defaultMessage: 'First time using Functionbeat? See the [Getting Started Guide]({link}).', values: { link: '{config.docs.beats.functionbeat}/functionbeat-getting-started.html' }, @@ -56,11 +57,11 @@ export const createFunctionbeatInstructions = context => ({ ], }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.functionbeatInstructions.install.windowsTitle', { + title: i18n.translate('home.tutorials.common.functionbeatInstructions.install.windowsTitle', { defaultMessage: 'Download and install Functionbeat', }), textPre: i18n.translate( - 'kbn.common.tutorials.functionbeatInstructions.install.windowsTextPre', + 'home.tutorials.common.functionbeatInstructions.install.windowsTextPre', { defaultMessage: 'First time using Functionbeat? See the [Getting Started Guide]({functionbeatLink}).\n\ @@ -83,10 +84,10 @@ export const createFunctionbeatInstructions = context => ({ }, DEPLOY: { OSX_LINUX: { - title: i18n.translate('kbn.common.tutorials.functionbeatInstructions.deploy.osxTitle', { + title: i18n.translate('home.tutorials.common.functionbeatInstructions.deploy.osxTitle', { defaultMessage: 'Deploy Functionbeat to AWS Lambda', }), - textPre: i18n.translate('kbn.common.tutorials.functionbeatInstructions.deploy.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.functionbeatInstructions.deploy.osxTextPre', { defaultMessage: 'This installs Functionbeat as a Lambda function.\ The `setup` command checks the Elasticsearch configuration and loads the \ @@ -95,11 +96,11 @@ Kibana index pattern. It is normally safe to omit this command.', commands: ['./functionbeat setup', './functionbeat deploy fn-cloudwatch-logs'], }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.functionbeatInstructions.deploy.windowsTitle', { + title: i18n.translate('home.tutorials.common.functionbeatInstructions.deploy.windowsTitle', { defaultMessage: 'Deploy Functionbeat to AWS Lambda', }), textPre: i18n.translate( - 'kbn.common.tutorials.functionbeatInstructions.deploy.windowsTextPre', + 'home.tutorials.common.functionbeatInstructions.deploy.windowsTextPre', { defaultMessage: 'This installs Functionbeat as a Lambda function.\ @@ -112,10 +113,10 @@ Kibana index pattern. It is normally safe to omit this command.', }, CONFIG: { OSX_LINUX: { - title: i18n.translate('kbn.common.tutorials.functionbeatInstructions.config.osxTitle', { + title: i18n.translate('home.tutorials.common.functionbeatInstructions.config.osxTitle', { defaultMessage: 'Configure the Elastic cluster', }), - textPre: i18n.translate('kbn.common.tutorials.functionbeatInstructions.config.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.functionbeatInstructions.config.osxTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`functionbeat.yml`', @@ -130,23 +131,26 @@ Kibana index pattern. It is normally safe to omit this command.', ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.functionbeatInstructions.config.osxTextPost', { - defaultMessage: - 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ + textPost: i18n.translate( + 'home.tutorials.common.functionbeatInstructions.config.osxTextPost', + { + defaultMessage: + 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', - values: { - passwordTemplate: '``', - esUrlTemplate: '``', - kibanaUrlTemplate: '``', - }, - }), + values: { + passwordTemplate: '``', + esUrlTemplate: '``', + kibanaUrlTemplate: '``', + }, + } + ), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.functionbeatInstructions.config.windowsTitle', { + title: i18n.translate('home.tutorials.common.functionbeatInstructions.config.windowsTitle', { defaultMessage: 'Edit the configuration', }), textPre: i18n.translate( - 'kbn.common.tutorials.functionbeatInstructions.config.windowsTextPre', + 'home.tutorials.common.functionbeatInstructions.config.windowsTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { @@ -164,7 +168,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', getSpaceIdForBeatsTutorial(context), ], textPost: i18n.translate( - 'kbn.common.tutorials.functionbeatInstructions.config.windowsTextPost', + 'home.tutorials.common.functionbeatInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ @@ -183,11 +187,11 @@ and {kibanaUrlTemplate} is the URL of Kibana.', export const createFunctionbeatCloudInstructions = () => ({ CONFIG: { OSX_LINUX: { - title: i18n.translate('kbn.common.tutorials.functionbeatCloudInstructions.config.osxTitle', { + title: i18n.translate('home.tutorials.common.functionbeatCloudInstructions.config.osxTitle', { defaultMessage: 'Edit the configuration', }), textPre: i18n.translate( - 'kbn.common.tutorials.functionbeatCloudInstructions.config.osxTextPre', + 'home.tutorials.common.functionbeatCloudInstructions.config.osxTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { @@ -197,7 +201,7 @@ export const createFunctionbeatCloudInstructions = () => ({ ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.functionbeatCloudInstructions.config.osxTextPost', + 'home.tutorials.common.functionbeatCloudInstructions.config.osxTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -206,13 +210,13 @@ export const createFunctionbeatCloudInstructions = () => ({ }, WINDOWS: { title: i18n.translate( - 'kbn.common.tutorials.functionbeatCloudInstructions.config.windowsTitle', + 'home.tutorials.common.functionbeatCloudInstructions.config.windowsTitle', { defaultMessage: 'Edit the configuration', } ), textPre: i18n.translate( - 'kbn.common.tutorials.functionbeatCloudInstructions.config.windowsTextPre', + 'home.tutorials.common.functionbeatCloudInstructions.config.windowsTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { @@ -222,7 +226,7 @@ export const createFunctionbeatCloudInstructions = () => ({ ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.functionbeatCloudInstructions.config.windowsTextPost', + 'home.tutorials.common.functionbeatCloudInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -234,7 +238,7 @@ export const createFunctionbeatCloudInstructions = () => ({ export function functionbeatEnableInstructions() { const defaultTitle = i18n.translate( - 'kbn.common.tutorials.functionbeatEnableOnPremInstructions.defaultTitle', + 'home.tutorials.common.functionbeatEnableOnPremInstructions.defaultTitle', { defaultMessage: 'Configure the Cloudwatch log group', } @@ -249,7 +253,7 @@ export function functionbeatEnableInstructions() { 'functionbeat.provider.aws.deploy_bucket: ', ]; const defaultTextPost = i18n.translate( - 'kbn.common.tutorials.functionbeatEnableOnPremInstructions.defaultTextPost', + 'home.tutorials.common.functionbeatEnableOnPremInstructions.defaultTextPost', { defaultMessage: 'Where `` is the name of the log group you want to ingest, \ @@ -261,7 +265,7 @@ Functionbeat deploy.', OSX_LINUX: { title: defaultTitle, textPre: i18n.translate( - 'kbn.common.tutorials.functionbeatEnableOnPremInstructionsOSXLinux.textPre', + 'home.tutorials.common.functionbeatEnableOnPremInstructionsOSXLinux.textPre', { defaultMessage: 'Modify the settings in the `functionbeat.yml` file.', } @@ -272,7 +276,7 @@ Functionbeat deploy.', WINDOWS: { title: defaultTitle, textPre: i18n.translate( - 'kbn.common.tutorials.functionbeatEnableOnPremInstructionsWindows.textPre', + 'home.tutorials.common.functionbeatEnableOnPremInstructionsWindows.textPre', { defaultMessage: 'Modify the settings in the {path} file.', values: { @@ -287,13 +291,13 @@ Functionbeat deploy.', } export function functionbeatAWSInstructions() { - const defaultTitle = i18n.translate('kbn.common.tutorials.functionbeatAWSInstructions.title', { + const defaultTitle = i18n.translate('home.tutorials.common.functionbeatAWSInstructions.title', { defaultMessage: 'Set AWS credentials', }); - const defaultPre = i18n.translate('kbn.common.tutorials.functionbeatAWSInstructions.textPre', { + const defaultPre = i18n.translate('home.tutorials.common.functionbeatAWSInstructions.textPre', { defaultMessage: 'Set your AWS account credentials in the environment:', }); - const defaultPost = i18n.translate('kbn.common.tutorials.functionbeatAWSInstructions.textPost', { + const defaultPost = i18n.translate('home.tutorials.common.functionbeatAWSInstructions.textPost', { defaultMessage: 'Where `` and `` are your account credentials and \ `us-east-1` is the desired region.', @@ -325,19 +329,19 @@ export function functionbeatAWSInstructions() { export function functionbeatStatusCheck() { return { - title: i18n.translate('kbn.common.tutorials.functionbeatStatusCheck.title', { + title: i18n.translate('home.tutorials.common.functionbeatStatusCheck.title', { defaultMessage: 'Functionbeat status', }), - text: i18n.translate('kbn.common.tutorials.functionbeatStatusCheck.text', { + text: i18n.translate('home.tutorials.common.functionbeatStatusCheck.text', { defaultMessage: 'Check that data is received from Functionbeat', }), - btnLabel: i18n.translate('kbn.common.tutorials.functionbeatStatusCheck.buttonLabel', { + btnLabel: i18n.translate('home.tutorials.common.functionbeatStatusCheck.buttonLabel', { defaultMessage: 'Check data', }), - success: i18n.translate('kbn.common.tutorials.functionbeatStatusCheck.successText', { + success: i18n.translate('home.tutorials.common.functionbeatStatusCheck.successText', { defaultMessage: 'Data successfully received from Functionbeat', }), - error: i18n.translate('kbn.common.tutorials.functionbeatStatusCheck.errorText', { + error: i18n.translate('home.tutorials.common.functionbeatStatusCheck.errorText', { defaultMessage: 'No data has been received from Functionbeat yet', }), esHitsCheck: { @@ -349,14 +353,14 @@ export function functionbeatStatusCheck() { }; } -export function onPremInstructions(platforms, context) { +export function onPremInstructions(platforms: Platform[], context?: TutorialContext) { const FUNCTIONBEAT_INSTRUCTIONS = createFunctionbeatInstructions(context); return { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.functionbeat.premInstructions.gettingStarted.title', + 'home.tutorials.common.functionbeat.premInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -408,7 +412,7 @@ export function onPremCloudInstructions() { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.functionbeat.premCloudInstructions.gettingStarted.title', + 'home.tutorials.common.functionbeat.premCloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -465,7 +469,7 @@ export function cloudInstructions() { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.functionbeat.cloudInstructions.gettingStarted.title', + 'home.tutorials.common.functionbeat.cloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } diff --git a/src/legacy/core_plugins/kibana/common/lib/get_space_id_for_beats_tutorial.js b/src/plugins/home/server/tutorials/instructions/get_space_id_for_beats_tutorial.ts similarity index 87% rename from src/legacy/core_plugins/kibana/common/lib/get_space_id_for_beats_tutorial.js rename to src/plugins/home/server/tutorials/instructions/get_space_id_for_beats_tutorial.ts index f7da589526003..894ffc6b126d6 100644 --- a/src/legacy/core_plugins/kibana/common/lib/get_space_id_for_beats_tutorial.js +++ b/src/plugins/home/server/tutorials/instructions/get_space_id_for_beats_tutorial.ts @@ -17,13 +17,15 @@ * under the License. */ +import { TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types'; + /** * Returns valid configuration for a beat.yml file for adding the space id * if there is an active space and that space is not the default one. * * @param {object} context - Context object generated from tutorial factory (see #22760) */ -export function getSpaceIdForBeatsTutorial(context) { +export function getSpaceIdForBeatsTutorial(context?: TutorialContext) { if (!context || !context.spaceId || context.isInDefaultSpace) { return ''; } diff --git a/src/legacy/core_plugins/kibana/common/tutorials/heartbeat_instructions.js b/src/plugins/home/server/tutorials/instructions/heartbeat_instructions.ts similarity index 71% rename from src/legacy/core_plugins/kibana/common/tutorials/heartbeat_instructions.js rename to src/plugins/home/server/tutorials/instructions/heartbeat_instructions.ts index d9af2126174f7..406bf55da4321 100644 --- a/src/legacy/core_plugins/kibana/common/tutorials/heartbeat_instructions.js +++ b/src/plugins/home/server/tutorials/instructions/heartbeat_instructions.ts @@ -20,15 +20,16 @@ import { i18n } from '@kbn/i18n'; import { INSTRUCTION_VARIANT } from './instruction_variant'; import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions'; -import { getSpaceIdForBeatsTutorial } from '../lib/get_space_id_for_beats_tutorial'; +import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial'; +import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types'; -export const createHeartbeatInstructions = context => ({ +export const createHeartbeatInstructions = (context?: TutorialContext) => ({ INSTALL: { OSX: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.install.osxTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.osxTitle', { defaultMessage: 'Download and install Heartbeat', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.install.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.install.osxTextPre', { defaultMessage: 'First time using Heartbeat? See the [Getting Started Guide]({link}).', values: { link: '{config.docs.beats.heartbeat}/heartbeat-getting-started.html' }, }), @@ -39,10 +40,10 @@ export const createHeartbeatInstructions = context => ({ ], }, DEB: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.install.debTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.debTitle', { defaultMessage: 'Download and install Heartbeat', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.install.debTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.install.debTextPre', { defaultMessage: 'First time using Heartbeat? See the [Getting Started Guide]({link}).', values: { link: '{config.docs.beats.heartbeat}/heartbeat-getting-started.html' }, }), @@ -50,16 +51,16 @@ export const createHeartbeatInstructions = context => ({ 'curl -L -O https://artifacts.elastic.co/downloads/beats/heartbeat/heartbeat-{config.kibana.version}-amd64.deb', 'sudo dpkg -i heartbeat-{config.kibana.version}-amd64.deb', ], - textPost: i18n.translate('kbn.common.tutorials.heartbeatInstructions.install.debTextPost', { + textPost: i18n.translate('home.tutorials.common.heartbeatInstructions.install.debTextPost', { defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).', values: { link: 'https://www.elastic.co/downloads/beats/heartbeat' }, }), }, RPM: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.install.rpmTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.rpmTitle', { defaultMessage: 'Download and install Heartbeat', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.install.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.install.rpmTextPre', { defaultMessage: 'First time using Heartbeat? See the [Getting Started Guide]({link}).', values: { link: '{config.docs.beats.heartbeat}/heartbeat-getting-started.html' }, }), @@ -67,67 +68,70 @@ export const createHeartbeatInstructions = context => ({ 'curl -L -O https://artifacts.elastic.co/downloads/beats/heartbeat/heartbeat-{config.kibana.version}-x86_64.rpm', 'sudo rpm -vi heartbeat-{config.kibana.version}-x86_64.rpm', ], - textPost: i18n.translate('kbn.common.tutorials.heartbeatInstructions.install.debTextPost', { + textPost: i18n.translate('home.tutorials.common.heartbeatInstructions.install.debTextPost', { defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).', values: { link: 'https://www.elastic.co/downloads/beats/heartbeat' }, }), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.install.windowsTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.windowsTitle', { defaultMessage: 'Download and install Heartbeat', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.install.windowsTextPre', { - defaultMessage: - 'First time using Heartbeat? See the [Getting Started Guide]({heartbeatLink}).\n\ + textPre: i18n.translate( + 'home.tutorials.common.heartbeatInstructions.install.windowsTextPre', + { + defaultMessage: + 'First time using Heartbeat? See the [Getting Started Guide]({heartbeatLink}).\n\ 1. Download the Heartbeat Windows zip file from the [Download]({elasticLink}) page.\n\ 2. Extract the contents of the zip file into {folderPath}.\n\ 3. Rename the {directoryName} directory to `Heartbeat`.\n\ 4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select \ **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n\ 5. From the PowerShell prompt, run the following commands to install Heartbeat as a Windows service.', - values: { - directoryName: '`heartbeat-{config.kibana.version}-windows`', - folderPath: '`C:\\Program Files`', - heartbeatLink: '{config.docs.beats.heartbeat}/heartbeat-getting-started.html', - elasticLink: 'https://www.elastic.co/downloads/beats/heartbeat', - }, - }), + values: { + directoryName: '`heartbeat-{config.kibana.version}-windows`', + folderPath: '`C:\\Program Files`', + heartbeatLink: '{config.docs.beats.heartbeat}/heartbeat-getting-started.html', + elasticLink: 'https://www.elastic.co/downloads/beats/heartbeat', + }, + } + ), commands: ['cd "C:\\Program Files\\Heartbeat"', '.\\install-service-heartbeat.ps1'], }, }, START: { OSX: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.start.osxTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.osxTitle', { defaultMessage: 'Start Heartbeat', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.start.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.osxTextPre', { defaultMessage: 'The `setup` command loads the Kibana index pattern.', }), commands: ['./heartbeat setup', './heartbeat -e'], }, DEB: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.start.debTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.debTitle', { defaultMessage: 'Start Heartbeat', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.start.debTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.debTextPre', { defaultMessage: 'The `setup` command loads the Kibana index pattern.', }), commands: ['sudo heartbeat setup', 'sudo service heartbeat-elastic start'], }, RPM: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.start.rpmTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.rpmTitle', { defaultMessage: 'Start Heartbeat', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.start.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.rpmTextPre', { defaultMessage: 'The `setup` command loads the Kibana index pattern.', }), commands: ['sudo heartbeat setup', 'sudo service heartbeat-elastic start'], }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.start.windowsTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.windowsTitle', { defaultMessage: 'Start Heartbeat', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.start.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.windowsTextPre', { defaultMessage: 'The `setup` command loads the Kibana index pattern.', }), commands: ['.\\heartbeat.exe setup', 'Start-Service heartbeat'], @@ -135,10 +139,10 @@ export const createHeartbeatInstructions = context => ({ }, CONFIG: { OSX: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.osxTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.osxTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.osxTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`heartbeat.yml`', @@ -153,7 +157,7 @@ export const createHeartbeatInstructions = context => ({ ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.osxTextPost', { + textPost: i18n.translate('home.tutorials.common.heartbeatInstructions.config.osxTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -165,10 +169,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, DEB: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.debTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.debTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.debTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.debTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`/etc/heartbeat/heartbeat.yml`', @@ -183,7 +187,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.debTextPost', { + textPost: i18n.translate('home.tutorials.common.heartbeatInstructions.config.debTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -195,10 +199,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, RPM: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.rpmTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.rpmTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.rpmTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`/etc/heartbeat/heartbeat.yml`', @@ -213,7 +217,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.rpmTextPost', { + textPost: i18n.translate('home.tutorials.common.heartbeatInstructions.config.rpmTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -225,10 +229,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.windowsTitle', { + title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.windowsTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatInstructions.config.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.windowsTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`C:\\Program Files\\Heartbeat\\heartbeat.yml`', @@ -244,7 +248,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', getSpaceIdForBeatsTutorial(context), ], textPost: i18n.translate( - 'kbn.common.tutorials.heartbeatInstructions.config.windowsTextPost', + 'home.tutorials.common.heartbeatInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ @@ -263,18 +267,21 @@ and {kibanaUrlTemplate} is the URL of Kibana.', export const createHeartbeatCloudInstructions = () => ({ CONFIG: { OSX: { - title: i18n.translate('kbn.common.tutorials.heartbeatCloudInstructions.config.osxTitle', { + title: i18n.translate('home.tutorials.common.heartbeatCloudInstructions.config.osxTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatCloudInstructions.config.osxTextPre', { - defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', - values: { - path: '`heartbeat.yml`', - }, - }), + textPre: i18n.translate( + 'home.tutorials.common.heartbeatCloudInstructions.config.osxTextPre', + { + defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', + values: { + path: '`heartbeat.yml`', + }, + } + ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.heartbeatCloudInstructions.config.osxTextPost', + 'home.tutorials.common.heartbeatCloudInstructions.config.osxTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -282,18 +289,21 @@ export const createHeartbeatCloudInstructions = () => ({ ), }, DEB: { - title: i18n.translate('kbn.common.tutorials.heartbeatCloudInstructions.config.debTitle', { + title: i18n.translate('home.tutorials.common.heartbeatCloudInstructions.config.debTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatCloudInstructions.config.debTextPre', { - defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', - values: { - path: '`/etc/heartbeat/heartbeat.yml`', - }, - }), + textPre: i18n.translate( + 'home.tutorials.common.heartbeatCloudInstructions.config.debTextPre', + { + defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', + values: { + path: '`/etc/heartbeat/heartbeat.yml`', + }, + } + ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.heartbeatCloudInstructions.config.debTextPost', + 'home.tutorials.common.heartbeatCloudInstructions.config.debTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -301,18 +311,21 @@ export const createHeartbeatCloudInstructions = () => ({ ), }, RPM: { - title: i18n.translate('kbn.common.tutorials.heartbeatCloudInstructions.config.rpmTitle', { + title: i18n.translate('home.tutorials.common.heartbeatCloudInstructions.config.rpmTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.heartbeatCloudInstructions.config.rpmTextPre', { - defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', - values: { - path: '`/etc/heartbeat/heartbeat.yml`', - }, - }), + textPre: i18n.translate( + 'home.tutorials.common.heartbeatCloudInstructions.config.rpmTextPre', + { + defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', + values: { + path: '`/etc/heartbeat/heartbeat.yml`', + }, + } + ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.heartbeatCloudInstructions.config.rpmTextPost', + 'home.tutorials.common.heartbeatCloudInstructions.config.rpmTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -320,11 +333,14 @@ export const createHeartbeatCloudInstructions = () => ({ ), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.heartbeatCloudInstructions.config.windowsTitle', { - defaultMessage: 'Edit the configuration', - }), + title: i18n.translate( + 'home.tutorials.common.heartbeatCloudInstructions.config.windowsTitle', + { + defaultMessage: 'Edit the configuration', + } + ), textPre: i18n.translate( - 'kbn.common.tutorials.heartbeatCloudInstructions.config.windowsTextPre', + 'home.tutorials.common.heartbeatCloudInstructions.config.windowsTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { @@ -334,7 +350,7 @@ export const createHeartbeatCloudInstructions = () => ({ ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.heartbeatCloudInstructions.config.windowsTextPost', + 'home.tutorials.common.heartbeatCloudInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -346,7 +362,7 @@ export const createHeartbeatCloudInstructions = () => ({ export function heartbeatEnableInstructionsOnPrem() { const defaultTitle = i18n.translate( - 'kbn.common.tutorials.heartbeatEnableOnPremInstructions.defaultTitle', + 'home.tutorials.common.heartbeatEnableOnPremInstructions.defaultTitle', { defaultMessage: 'Edit the configuration - Add monitors', } @@ -358,7 +374,7 @@ export function heartbeatEnableInstructionsOnPrem() { ' schedule: "@every 10s"', ]; const defaultTextPost = i18n.translate( - 'kbn.common.tutorials.heartbeatEnableOnPremInstructions.defaultTextPost', + 'home.tutorials.common.heartbeatEnableOnPremInstructions.defaultTextPost', { defaultMessage: 'Where {hostTemplate} is your monitored URL, For more details on how to configure Monitors in \ @@ -372,32 +388,41 @@ export function heartbeatEnableInstructionsOnPrem() { return { OSX: { title: defaultTitle, - textPre: i18n.translate('kbn.common.tutorials.heartbeatEnableOnPremInstructions.osxTextPre', { - defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', - }), + textPre: i18n.translate( + 'home.tutorials.common.heartbeatEnableOnPremInstructions.osxTextPre', + { + defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', + } + ), commands: defaultCommands, textPost: defaultTextPost, }, DEB: { title: defaultTitle, - textPre: i18n.translate('kbn.common.tutorials.heartbeatEnableOnPremInstructions.debTextPre', { - defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', - }), + textPre: i18n.translate( + 'home.tutorials.common.heartbeatEnableOnPremInstructions.debTextPre', + { + defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', + } + ), commands: defaultCommands, textPost: defaultTextPost, }, RPM: { title: defaultTitle, - textPre: i18n.translate('kbn.common.tutorials.heartbeatEnableOnPremInstructions.rpmTextPre', { - defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', - }), + textPre: i18n.translate( + 'home.tutorials.common.heartbeatEnableOnPremInstructions.rpmTextPre', + { + defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', + } + ), commands: defaultCommands, textPost: defaultTextPost, }, WINDOWS: { title: defaultTitle, textPre: i18n.translate( - 'kbn.common.tutorials.heartbeatEnableOnPremInstructions.windowsTextPre', + 'home.tutorials.common.heartbeatEnableOnPremInstructions.windowsTextPre', { defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', } @@ -410,7 +435,7 @@ export function heartbeatEnableInstructionsOnPrem() { export function heartbeatEnableInstructionsCloud() { const defaultTitle = i18n.translate( - 'kbn.common.tutorials.heartbeatEnableCloudInstructions.defaultTitle', + 'home.tutorials.common.heartbeatEnableCloudInstructions.defaultTitle', { defaultMessage: 'Edit the configuration - Add monitors', } @@ -422,7 +447,7 @@ export function heartbeatEnableInstructionsCloud() { ' schedule: "@every 10s"', ]; const defaultTextPost = i18n.translate( - 'kbn.common.tutorials.heartbeatEnableCloudInstructions.defaultTextPost', + 'home.tutorials.common.heartbeatEnableCloudInstructions.defaultTextPost', { defaultMessage: 'For more details on how to configure Monitors in Heartbeat, read the [Heartbeat configuration docs.]({configureLink})', @@ -432,7 +457,7 @@ export function heartbeatEnableInstructionsCloud() { return { OSX: { title: defaultTitle, - textPre: i18n.translate('kbn.common.tutorials.heartbeatEnableCloudInstructions.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatEnableCloudInstructions.osxTextPre', { defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', }), commands: defaultCommands, @@ -440,7 +465,7 @@ export function heartbeatEnableInstructionsCloud() { }, DEB: { title: defaultTitle, - textPre: i18n.translate('kbn.common.tutorials.heartbeatEnableCloudInstructions.debTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatEnableCloudInstructions.debTextPre', { defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', }), commands: defaultCommands, @@ -448,7 +473,7 @@ export function heartbeatEnableInstructionsCloud() { }, RPM: { title: defaultTitle, - textPre: i18n.translate('kbn.common.tutorials.heartbeatEnableCloudInstructions.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.heartbeatEnableCloudInstructions.rpmTextPre', { defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', }), commands: defaultCommands, @@ -457,7 +482,7 @@ export function heartbeatEnableInstructionsCloud() { WINDOWS: { title: defaultTitle, textPre: i18n.translate( - 'kbn.common.tutorials.heartbeatEnableCloudInstructions.windowsTextPre', + 'home.tutorials.common.heartbeatEnableCloudInstructions.windowsTextPre', { defaultMessage: 'Edit the `heartbeat.monitors` setting in the `heartbeat.yml` file.', } @@ -470,19 +495,19 @@ export function heartbeatEnableInstructionsCloud() { export function heartbeatStatusCheck() { return { - title: i18n.translate('kbn.common.tutorials.heartbeatStatusCheck.title', { + title: i18n.translate('home.tutorials.common.heartbeatStatusCheck.title', { defaultMessage: 'Heartbeat status', }), - text: i18n.translate('kbn.common.tutorials.heartbeatStatusCheck.text', { + text: i18n.translate('home.tutorials.common.heartbeatStatusCheck.text', { defaultMessage: 'Check that data is received from Heartbeat', }), - btnLabel: i18n.translate('kbn.common.tutorials.heartbeatStatusCheck.buttonLabel', { + btnLabel: i18n.translate('home.tutorials.common.heartbeatStatusCheck.buttonLabel', { defaultMessage: 'Check data', }), - success: i18n.translate('kbn.common.tutorials.heartbeatStatusCheck.successText', { + success: i18n.translate('home.tutorials.common.heartbeatStatusCheck.successText', { defaultMessage: 'Data successfully received from Heartbeat', }), - error: i18n.translate('kbn.common.tutorials.heartbeatStatusCheck.errorText', { + error: i18n.translate('home.tutorials.common.heartbeatStatusCheck.errorText', { defaultMessage: 'No data has been received from Heartbeat yet', }), esHitsCheck: { @@ -494,14 +519,14 @@ export function heartbeatStatusCheck() { }; } -export function onPremInstructions(platforms, context) { +export function onPremInstructions(platforms: Platform[], context?: TutorialContext) { const HEARTBEAT_INSTRUCTIONS = createHeartbeatInstructions(context); return { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.heartbeat.premInstructions.gettingStarted.title', + 'home.tutorials.common.heartbeat.premInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -559,7 +584,7 @@ export function onPremCloudInstructions() { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.heartbeat.premCloudInstructions.gettingStarted.title', + 'home.tutorials.common.heartbeat.premCloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -624,7 +649,7 @@ export function cloudInstructions() { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.heartbeat.cloudInstructions.gettingStarted.title', + 'home.tutorials.common.heartbeat.cloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } diff --git a/src/legacy/core_plugins/kibana/common/tutorials/instruction_variant.js b/src/plugins/home/server/tutorials/instructions/instruction_variant.ts similarity index 96% rename from src/legacy/core_plugins/kibana/common/tutorials/instruction_variant.js rename to src/plugins/home/server/tutorials/instructions/instruction_variant.ts index 0c3be21044241..d026a3bdf2208 100644 --- a/src/legacy/core_plugins/kibana/common/tutorials/instruction_variant.js +++ b/src/plugins/home/server/tutorials/instructions/instruction_variant.ts @@ -61,7 +61,7 @@ const DISPLAY_MAP = { * @params {String} id - instruction variant id as defined from INSTRUCTION_VARIANT * @return {String} display name */ -export function getDisplayText(id) { +export function getDisplayText(id: keyof typeof INSTRUCTION_VARIANT) { if (id in DISPLAY_MAP) { return DISPLAY_MAP[id]; } diff --git a/src/legacy/core_plugins/kibana/common/tutorials/logstash_instructions.js b/src/plugins/home/server/tutorials/instructions/logstash_instructions.ts similarity index 82% rename from src/legacy/core_plugins/kibana/common/tutorials/logstash_instructions.js rename to src/plugins/home/server/tutorials/instructions/logstash_instructions.ts index 9e25402abe183..3e5345565a753 100644 --- a/src/legacy/core_plugins/kibana/common/tutorials/logstash_instructions.js +++ b/src/plugins/home/server/tutorials/instructions/logstash_instructions.ts @@ -23,11 +23,11 @@ export const createLogstashInstructions = () => ({ INSTALL: { OSX: [ { - title: i18n.translate('kbn.common.tutorials.logstashInstructions.install.java.osxTitle', { + title: i18n.translate('home.tutorials.common.logstashInstructions.install.java.osxTitle', { defaultMessage: 'Download and install the Java Runtime Environment', }), textPre: i18n.translate( - 'kbn.common.tutorials.logstashInstructions.install.java.osxTextPre', + 'home.tutorials.common.logstashInstructions.install.java.osxTextPre', { defaultMessage: 'Follow the installation instructions [here]({link}).', values: { @@ -38,13 +38,13 @@ export const createLogstashInstructions = () => ({ }, { title: i18n.translate( - 'kbn.common.tutorials.logstashInstructions.install.logstash.osxTitle', + 'home.tutorials.common.logstashInstructions.install.logstash.osxTitle', { defaultMessage: 'Download and install Logstash', } ), textPre: i18n.translate( - 'kbn.common.tutorials.logstashInstructions.install.logstash.osxTextPre', + 'home.tutorials.common.logstashInstructions.install.logstash.osxTextPre', { defaultMessage: 'First time using Logstash? See the [Getting Started Guide]({link}).', values: { @@ -62,13 +62,13 @@ export const createLogstashInstructions = () => ({ WINDOWS: [ { title: i18n.translate( - 'kbn.common.tutorials.logstashInstructions.install.java.windowsTitle', + 'home.tutorials.common.logstashInstructions.install.java.windowsTitle', { defaultMessage: 'Download and install the Java Runtime Environment', } ), textPre: i18n.translate( - 'kbn.common.tutorials.logstashInstructions.install.java.windowsTextPre', + 'home.tutorials.common.logstashInstructions.install.java.windowsTextPre', { defaultMessage: 'Follow the installation instructions [here]({link}).', values: { @@ -80,13 +80,13 @@ export const createLogstashInstructions = () => ({ }, { title: i18n.translate( - 'kbn.common.tutorials.logstashInstructions.install.logstash.windowsTitle', + 'home.tutorials.common.logstashInstructions.install.logstash.windowsTitle', { defaultMessage: 'Download and install Logstash', } ), textPre: i18n.translate( - 'kbn.common.tutorials.logstashInstructions.install.logstash.windowsTextPre', + 'home.tutorials.common.logstashInstructions.install.logstash.windowsTextPre', { defaultMessage: 'First time using Logstash? See the [Getting Started Guide]({logstashLink}).\n\ diff --git a/src/legacy/core_plugins/kibana/common/tutorials/metricbeat_instructions.js b/src/plugins/home/server/tutorials/instructions/metricbeat_instructions.ts similarity index 75% rename from src/legacy/core_plugins/kibana/common/tutorials/metricbeat_instructions.js rename to src/plugins/home/server/tutorials/instructions/metricbeat_instructions.ts index b7b1bec851e94..77efe0958a615 100644 --- a/src/legacy/core_plugins/kibana/common/tutorials/metricbeat_instructions.js +++ b/src/plugins/home/server/tutorials/instructions/metricbeat_instructions.ts @@ -20,15 +20,16 @@ import { i18n } from '@kbn/i18n'; import { INSTRUCTION_VARIANT } from './instruction_variant'; import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions'; -import { getSpaceIdForBeatsTutorial } from '../lib/get_space_id_for_beats_tutorial'; +import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial'; +import { TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types'; -export const createMetricbeatInstructions = context => ({ +export const createMetricbeatInstructions = (context?: TutorialContext) => ({ INSTALL: { OSX: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.install.osxTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.osxTitle', { defaultMessage: 'Download and install Metricbeat', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.install.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.install.osxTextPre', { defaultMessage: 'First time using Metricbeat? See the [Getting Started Guide]({link}).', values: { link: '{config.docs.beats.metricbeat}/metricbeat-getting-started.html' }, }), @@ -39,10 +40,10 @@ export const createMetricbeatInstructions = context => ({ ], }, DEB: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.install.debTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.debTitle', { defaultMessage: 'Download and install Metricbeat', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.install.debTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.install.debTextPre', { defaultMessage: 'First time using Metricbeat? See the [Getting Started Guide]({link}).', values: { link: '{config.docs.beats.metricbeat}/metricbeat-getting-started.html' }, }), @@ -50,16 +51,16 @@ export const createMetricbeatInstructions = context => ({ 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-amd64.deb', 'sudo dpkg -i metricbeat-{config.kibana.version}-amd64.deb', ], - textPost: i18n.translate('kbn.common.tutorials.metricbeatInstructions.install.debTextPost', { + textPost: i18n.translate('home.tutorials.common.metricbeatInstructions.install.debTextPost', { defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).', values: { link: 'https://www.elastic.co/downloads/beats/metricbeat' }, }), }, RPM: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.install.rpmTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.rpmTitle', { defaultMessage: 'Download and install Metricbeat', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.install.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.install.rpmTextPre', { defaultMessage: 'First time using Metricbeat? See the [Getting Started Guide]({link}).', values: { link: '{config.docs.beats.metricbeat}/metricbeat-getting-started.html' }, }), @@ -67,17 +68,17 @@ export const createMetricbeatInstructions = context => ({ 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-x86_64.rpm', 'sudo rpm -vi metricbeat-{config.kibana.version}-x86_64.rpm', ], - textPost: i18n.translate('kbn.common.tutorials.metricbeatInstructions.install.debTextPost', { + textPost: i18n.translate('home.tutorials.common.metricbeatInstructions.install.debTextPost', { defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).', values: { link: 'https://www.elastic.co/downloads/beats/metricbeat' }, }), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.install.windowsTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.windowsTitle', { defaultMessage: 'Download and install Metricbeat', }), textPre: i18n.translate( - 'kbn.common.tutorials.metricbeatInstructions.install.windowsTextPre', + 'home.tutorials.common.metricbeatInstructions.install.windowsTextPre', { defaultMessage: 'First time using Metricbeat? See the [Getting Started Guide]({metricbeatLink}).\n\ @@ -97,7 +98,7 @@ export const createMetricbeatInstructions = context => ({ ), commands: ['cd "C:\\Program Files\\Metricbeat"', '.\\install-service-metricbeat.ps1'], textPost: i18n.translate( - 'kbn.common.tutorials.metricbeatInstructions.install.windowsTextPost', + 'home.tutorials.common.metricbeatInstructions.install.windowsTextPost', { defaultMessage: 'Modify the settings under `output.elasticsearch` in the {path} file to point to your Elasticsearch installation.', @@ -108,40 +109,40 @@ export const createMetricbeatInstructions = context => ({ }, START: { OSX: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.start.osxTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.start.osxTitle', { defaultMessage: 'Start Metricbeat', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.start.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.start.osxTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), commands: ['./metricbeat setup', './metricbeat -e'], }, DEB: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.start.debTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.start.debTitle', { defaultMessage: 'Start Metricbeat', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.start.debTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.start.debTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), commands: ['sudo metricbeat setup', 'sudo service metricbeat start'], }, RPM: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.start.rpmTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.start.rpmTitle', { defaultMessage: 'Start Metricbeat', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.start.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.start.rpmTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), commands: ['sudo metricbeat setup', 'sudo service metricbeat start'], }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.start.windowsTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.start.windowsTitle', { defaultMessage: 'Start Metricbeat', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.start.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.start.windowsTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), @@ -150,10 +151,10 @@ export const createMetricbeatInstructions = context => ({ }, CONFIG: { OSX: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.osxTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.config.osxTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.config.osxTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`metricbeat.yml`', @@ -168,7 +169,7 @@ export const createMetricbeatInstructions = context => ({ ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.osxTextPost', { + textPost: i18n.translate('home.tutorials.common.metricbeatInstructions.config.osxTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -180,10 +181,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, DEB: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.debTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.config.debTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.debTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.config.debTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`/etc/metricbeat/metricbeat.yml`', @@ -198,7 +199,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.debTextPost', { + textPost: i18n.translate('home.tutorials.common.metricbeatInstructions.config.debTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -210,10 +211,10 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, RPM: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.rpmTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.config.rpmTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.rpmTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.config.rpmTextPre', { defaultMessage: 'Modify {path} to set the connection information:', values: { path: '`/etc/metricbeat/metricbeat.yml`', @@ -228,7 +229,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', ' host: ""', getSpaceIdForBeatsTutorial(context), ], - textPost: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.rpmTextPost', { + textPost: i18n.translate('home.tutorials.common.metricbeatInstructions.config.rpmTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ and {kibanaUrlTemplate} is the URL of Kibana.', @@ -240,15 +241,18 @@ and {kibanaUrlTemplate} is the URL of Kibana.', }), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.windowsTitle', { + title: i18n.translate('home.tutorials.common.metricbeatInstructions.config.windowsTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.windowsTextPre', { - defaultMessage: 'Modify {path} to set the connection information:', - values: { - path: '`C:\\Program Files\\Metricbeat\\metricbeat.yml`', - }, - }), + textPre: i18n.translate( + 'home.tutorials.common.metricbeatInstructions.config.windowsTextPre', + { + defaultMessage: 'Modify {path} to set the connection information:', + values: { + path: '`C:\\Program Files\\Metricbeat\\metricbeat.yml`', + }, + } + ), commands: [ 'output.elasticsearch:', ' hosts: [""]', @@ -259,7 +263,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.', getSpaceIdForBeatsTutorial(context), ], textPost: i18n.translate( - 'kbn.common.tutorials.metricbeatInstructions.config.windowsTextPost', + 'home.tutorials.common.metricbeatInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ @@ -278,11 +282,11 @@ and {kibanaUrlTemplate} is the URL of Kibana.', export const createMetricbeatCloudInstructions = () => ({ CONFIG: { OSX: { - title: i18n.translate('kbn.common.tutorials.metricbeatCloudInstructions.config.osxTitle', { + title: i18n.translate('home.tutorials.common.metricbeatCloudInstructions.config.osxTitle', { defaultMessage: 'Edit the configuration', }), textPre: i18n.translate( - 'kbn.common.tutorials.metricbeatCloudInstructions.config.osxTextPre', + 'home.tutorials.common.metricbeatCloudInstructions.config.osxTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { @@ -292,7 +296,7 @@ export const createMetricbeatCloudInstructions = () => ({ ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.metricbeatCloudInstructions.config.osxTextPost', + 'home.tutorials.common.metricbeatCloudInstructions.config.osxTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -300,11 +304,11 @@ export const createMetricbeatCloudInstructions = () => ({ ), }, DEB: { - title: i18n.translate('kbn.common.tutorials.metricbeatCloudInstructions.config.debTitle', { + title: i18n.translate('home.tutorials.common.metricbeatCloudInstructions.config.debTitle', { defaultMessage: 'Edit the configuration', }), textPre: i18n.translate( - 'kbn.common.tutorials.metricbeatCloudInstructions.config.debTextPre', + 'home.tutorials.common.metricbeatCloudInstructions.config.debTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { @@ -314,7 +318,7 @@ export const createMetricbeatCloudInstructions = () => ({ ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.metricbeatCloudInstructions.config.debTextPost', + 'home.tutorials.common.metricbeatCloudInstructions.config.debTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -322,11 +326,11 @@ export const createMetricbeatCloudInstructions = () => ({ ), }, RPM: { - title: i18n.translate('kbn.common.tutorials.metricbeatCloudInstructions.config.rpmTitle', { + title: i18n.translate('home.tutorials.common.metricbeatCloudInstructions.config.rpmTitle', { defaultMessage: 'Edit the configuration', }), textPre: i18n.translate( - 'kbn.common.tutorials.metricbeatCloudInstructions.config.rpmTextPre', + 'home.tutorials.common.metricbeatCloudInstructions.config.rpmTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { @@ -336,7 +340,7 @@ export const createMetricbeatCloudInstructions = () => ({ ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.metricbeatCloudInstructions.config.rpmTextPost', + 'home.tutorials.common.metricbeatCloudInstructions.config.rpmTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -345,13 +349,13 @@ export const createMetricbeatCloudInstructions = () => ({ }, WINDOWS: { title: i18n.translate( - 'kbn.common.tutorials.metricbeatCloudInstructions.config.windowsTitle', + 'home.tutorials.common.metricbeatCloudInstructions.config.windowsTitle', { defaultMessage: 'Edit the configuration', } ), textPre: i18n.translate( - 'kbn.common.tutorials.metricbeatCloudInstructions.config.windowsTextPre', + 'home.tutorials.common.metricbeatCloudInstructions.config.windowsTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { @@ -361,7 +365,7 @@ export const createMetricbeatCloudInstructions = () => ({ ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.metricbeatCloudInstructions.config.windowsTextPost', + 'home.tutorials.common.metricbeatCloudInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -371,58 +375,58 @@ export const createMetricbeatCloudInstructions = () => ({ }, }); -export function metricbeatEnableInstructions(moduleName) { +export function metricbeatEnableInstructions(moduleName: string) { return { OSX: { - title: i18n.translate('kbn.common.tutorials.metricbeatEnableInstructions.osxTitle', { + title: i18n.translate('home.tutorials.common.metricbeatEnableInstructions.osxTitle', { defaultMessage: 'Enable and configure the {moduleName} module', values: { moduleName }, }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatEnableInstructions.osxTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatEnableInstructions.osxTextPre', { defaultMessage: 'From the installation directory, run:', }), commands: ['./metricbeat modules enable ' + moduleName], - textPost: i18n.translate('kbn.common.tutorials.metricbeatEnableInstructions.osxTextPost', { + textPost: i18n.translate('home.tutorials.common.metricbeatEnableInstructions.osxTextPost', { defaultMessage: 'Modify the settings in the `modules.d/{moduleName}.yml` file.', values: { moduleName }, }), }, DEB: { - title: i18n.translate('kbn.common.tutorials.metricbeatEnableInstructions.debTitle', { + title: i18n.translate('home.tutorials.common.metricbeatEnableInstructions.debTitle', { defaultMessage: 'Enable and configure the {moduleName} module', values: { moduleName }, }), commands: ['sudo metricbeat modules enable ' + moduleName], - textPost: i18n.translate('kbn.common.tutorials.metricbeatEnableInstructions.debTextPost', { + textPost: i18n.translate('home.tutorials.common.metricbeatEnableInstructions.debTextPost', { defaultMessage: 'Modify the settings in the `/etc/metricbeat/modules.d/{moduleName}.yml` file.', values: { moduleName }, }), }, RPM: { - title: i18n.translate('kbn.common.tutorials.metricbeatEnableInstructions.rpmTitle', { + title: i18n.translate('home.tutorials.common.metricbeatEnableInstructions.rpmTitle', { defaultMessage: 'Enable and configure the {moduleName} module', values: { moduleName }, }), commands: ['sudo metricbeat modules enable ' + moduleName], - textPost: i18n.translate('kbn.common.tutorials.metricbeatEnableInstructions.rpmTextPost', { + textPost: i18n.translate('home.tutorials.common.metricbeatEnableInstructions.rpmTextPost', { defaultMessage: 'Modify the settings in the `/etc/metricbeat/modules.d/{moduleName}.yml` file.', values: { moduleName }, }), }, WINDOWS: { - title: i18n.translate('kbn.common.tutorials.metricbeatEnableInstructions.windowsTitle', { + title: i18n.translate('home.tutorials.common.metricbeatEnableInstructions.windowsTitle', { defaultMessage: 'Enable and configure the {moduleName} module', values: { moduleName }, }), - textPre: i18n.translate('kbn.common.tutorials.metricbeatEnableInstructions.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.metricbeatEnableInstructions.windowsTextPre', { defaultMessage: 'From the {path} folder, run:', values: { path: `C:\\Program Files\\Metricbeat` }, }), commands: ['.\\metricbeat.exe modules enable ' + moduleName], textPost: i18n.translate( - 'kbn.common.tutorials.metricbeatEnableInstructions.windowsTextPost', + 'home.tutorials.common.metricbeatEnableInstructions.windowsTextPost', { defaultMessage: 'Modify the settings in the `modules.d/{moduleName}.yml` file.', values: { moduleName }, @@ -432,22 +436,22 @@ export function metricbeatEnableInstructions(moduleName) { }; } -export function metricbeatStatusCheck(moduleName) { +export function metricbeatStatusCheck(moduleName: string) { return { - title: i18n.translate('kbn.common.tutorials.metricbeatStatusCheck.title', { + title: i18n.translate('home.tutorials.common.metricbeatStatusCheck.title', { defaultMessage: 'Module status', }), - text: i18n.translate('kbn.common.tutorials.metricbeatStatusCheck.text', { + text: i18n.translate('home.tutorials.common.metricbeatStatusCheck.text', { defaultMessage: 'Check that data is received from the Metricbeat `{moduleName}` module', values: { moduleName }, }), - btnLabel: i18n.translate('kbn.common.tutorials.metricbeatStatusCheck.buttonLabel', { + btnLabel: i18n.translate('home.tutorials.common.metricbeatStatusCheck.buttonLabel', { defaultMessage: 'Check data', }), - success: i18n.translate('kbn.common.tutorials.metricbeatStatusCheck.successText', { + success: i18n.translate('home.tutorials.common.metricbeatStatusCheck.successText', { defaultMessage: 'Data successfully received from this module', }), - error: i18n.translate('kbn.common.tutorials.metricbeatStatusCheck.errorText', { + error: i18n.translate('home.tutorials.common.metricbeatStatusCheck.errorText', { defaultMessage: 'No data has been received from this module yet', }), esHitsCheck: { @@ -465,14 +469,14 @@ export function metricbeatStatusCheck(moduleName) { }; } -export function onPremInstructions(moduleName, platforms, context) { +export function onPremInstructions(moduleName: string, context?: TutorialContext) { const METRICBEAT_INSTRUCTIONS = createMetricbeatInstructions(context); return { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.metricbeat.premInstructions.gettingStarted.title', + 'home.tutorials.common.metricbeat.premInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -521,7 +525,7 @@ export function onPremInstructions(moduleName, platforms, context) { }; } -export function onPremCloudInstructions(moduleName) { +export function onPremCloudInstructions(moduleName: string) { const TRYCLOUD_OPTION1 = createTrycloudOption1(); const TRYCLOUD_OPTION2 = createTrycloudOption2(); const METRICBEAT_INSTRUCTIONS = createMetricbeatInstructions(); @@ -530,7 +534,7 @@ export function onPremCloudInstructions(moduleName) { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.metricbeat.premCloudInstructions.gettingStarted.title', + 'home.tutorials.common.metricbeat.premCloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -587,7 +591,7 @@ export function onPremCloudInstructions(moduleName) { }; } -export function cloudInstructions(moduleName) { +export function cloudInstructions(moduleName: string) { const METRICBEAT_INSTRUCTIONS = createMetricbeatInstructions(); const METRICBEAT_CLOUD_INSTRUCTIONS = createMetricbeatCloudInstructions(); @@ -595,7 +599,7 @@ export function cloudInstructions(moduleName) { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.metricbeat.cloudInstructions.gettingStarted.title', + 'home.tutorials.common.metricbeat.cloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } diff --git a/src/legacy/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js b/src/plugins/home/server/tutorials/instructions/onprem_cloud_instructions.ts similarity index 85% rename from src/legacy/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js rename to src/plugins/home/server/tutorials/instructions/onprem_cloud_instructions.ts index ec66d9037eaee..d3b17410c4ffa 100644 --- a/src/legacy/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js +++ b/src/plugins/home/server/tutorials/instructions/onprem_cloud_instructions.ts @@ -20,10 +20,10 @@ import { i18n } from '@kbn/i18n'; export const createTrycloudOption1 = () => ({ - title: i18n.translate('kbn.common.tutorials.premCloudInstructions.option1.title', { + title: i18n.translate('home.tutorials.common.premCloudInstructions.option1.title', { defaultMessage: 'Option 1: Try in Elastic Cloud', }), - textPre: i18n.translate('kbn.common.tutorials.premCloudInstructions.option1.textPre', { + textPre: i18n.translate('home.tutorials.common.premCloudInstructions.option1.textPre', { defaultMessage: 'Go to [Elastic Cloud]({link}). Register if you \ do not already have an account. Free 14-day trial available.\n\n\ @@ -41,10 +41,10 @@ To create a cluster, in Elastic Cloud console:\n\ }); export const createTrycloudOption2 = () => ({ - title: i18n.translate('kbn.common.tutorials.premCloudInstructions.option2.title', { + title: i18n.translate('home.tutorials.common.premCloudInstructions.option2.title', { defaultMessage: 'Option 2: Connect local Kibana to a Cloud instance', }), - textPre: i18n.translate('kbn.common.tutorials.premCloudInstructions.option2.textPre', { + textPre: i18n.translate('home.tutorials.common.premCloudInstructions.option2.textPre', { defaultMessage: 'If you are running this Kibana instance against a hosted Elasticsearch instance, \ proceed with manual setup.\n\n\ diff --git a/src/legacy/core_plugins/kibana/common/tutorials/param_types.js b/src/plugins/home/server/tutorials/instructions/param_types.ts similarity index 100% rename from src/legacy/core_plugins/kibana/common/tutorials/param_types.js rename to src/plugins/home/server/tutorials/instructions/param_types.ts diff --git a/src/legacy/core_plugins/kibana/common/tutorials/winlogbeat_instructions.js b/src/plugins/home/server/tutorials/instructions/winlogbeat_instructions.ts similarity index 77% rename from src/legacy/core_plugins/kibana/common/tutorials/winlogbeat_instructions.js rename to src/plugins/home/server/tutorials/instructions/winlogbeat_instructions.ts index 509ab0e6aba2d..cc18f2ce9705d 100644 --- a/src/legacy/core_plugins/kibana/common/tutorials/winlogbeat_instructions.js +++ b/src/plugins/home/server/tutorials/instructions/winlogbeat_instructions.ts @@ -20,16 +20,17 @@ import { i18n } from '@kbn/i18n'; import { INSTRUCTION_VARIANT } from './instruction_variant'; import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions'; -import { getSpaceIdForBeatsTutorial } from '../lib/get_space_id_for_beats_tutorial'; +import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial'; +import { TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types'; -export const createWinlogbeatInstructions = context => ({ +export const createWinlogbeatInstructions = (context?: TutorialContext) => ({ INSTALL: { WINDOWS: { - title: i18n.translate('kbn.common.tutorials.winlogbeatInstructions.install.windowsTitle', { + title: i18n.translate('home.tutorials.common.winlogbeatInstructions.install.windowsTitle', { defaultMessage: 'Download and install Winlogbeat', }), textPre: i18n.translate( - 'kbn.common.tutorials.winlogbeatInstructions.install.windowsTextPre', + 'home.tutorials.common.winlogbeatInstructions.install.windowsTextPre', { defaultMessage: 'First time using Winlogbeat? See the [Getting Started Guide]({winlogbeatLink}).\n\ @@ -49,7 +50,7 @@ export const createWinlogbeatInstructions = context => ({ ), commands: ['cd "C:\\Program Files\\Winlogbeat"', '.\\install-service-winlogbeat.ps1'], textPost: i18n.translate( - 'kbn.common.tutorials.winlogbeatInstructions.install.windowsTextPost', + 'home.tutorials.common.winlogbeatInstructions.install.windowsTextPost', { defaultMessage: 'Modify the settings under `output.elasticsearch` in the {path} file to point to your Elasticsearch installation.', @@ -60,10 +61,10 @@ export const createWinlogbeatInstructions = context => ({ }, START: { WINDOWS: { - title: i18n.translate('kbn.common.tutorials.winlogbeatInstructions.start.windowsTitle', { + title: i18n.translate('home.tutorials.common.winlogbeatInstructions.start.windowsTitle', { defaultMessage: 'Start Winlogbeat', }), - textPre: i18n.translate('kbn.common.tutorials.winlogbeatInstructions.start.windowsTextPre', { + textPre: i18n.translate('home.tutorials.common.winlogbeatInstructions.start.windowsTextPre', { defaultMessage: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.', }), @@ -72,15 +73,18 @@ export const createWinlogbeatInstructions = context => ({ }, CONFIG: { WINDOWS: { - title: i18n.translate('kbn.common.tutorials.winlogbeatInstructions.config.windowsTitle', { + title: i18n.translate('home.tutorials.common.winlogbeatInstructions.config.windowsTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate('kbn.common.tutorials.winlogbeatInstructions.config.windowsTextPre', { - defaultMessage: 'Modify {path} to set the connection information:', - values: { - path: '`C:\\Program Files\\Winlogbeat\\winlogbeat.yml`', - }, - }), + textPre: i18n.translate( + 'home.tutorials.common.winlogbeatInstructions.config.windowsTextPre', + { + defaultMessage: 'Modify {path} to set the connection information:', + values: { + path: '`C:\\Program Files\\Winlogbeat\\winlogbeat.yml`', + }, + } + ), commands: [ 'output.elasticsearch:', ' hosts: [""]', @@ -91,7 +95,7 @@ export const createWinlogbeatInstructions = context => ({ getSpaceIdForBeatsTutorial(context), ], textPost: i18n.translate( - 'kbn.common.tutorials.winlogbeatInstructions.config.windowsTextPost', + 'home.tutorials.common.winlogbeatInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \ @@ -111,13 +115,13 @@ export const createWinlogbeatCloudInstructions = () => ({ CONFIG: { WINDOWS: { title: i18n.translate( - 'kbn.common.tutorials.winlogbeatCloudInstructions.config.windowsTitle', + 'home.tutorials.common.winlogbeatCloudInstructions.config.windowsTitle', { defaultMessage: 'Edit the configuration', } ), textPre: i18n.translate( - 'kbn.common.tutorials.winlogbeatCloudInstructions.config.windowsTextPre', + 'home.tutorials.common.winlogbeatCloudInstructions.config.windowsTextPre', { defaultMessage: 'Modify {path} to set the connection information for Elastic Cloud:', values: { @@ -127,7 +131,7 @@ export const createWinlogbeatCloudInstructions = () => ({ ), commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], textPost: i18n.translate( - 'kbn.common.tutorials.winlogbeatCloudInstructions.config.windowsTextPost', + 'home.tutorials.common.winlogbeatCloudInstructions.config.windowsTextPost', { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.', values: { passwordTemplate: '``' }, @@ -139,19 +143,19 @@ export const createWinlogbeatCloudInstructions = () => ({ export function winlogbeatStatusCheck() { return { - title: i18n.translate('kbn.common.tutorials.winlogbeatStatusCheck.title', { + title: i18n.translate('home.tutorials.common.winlogbeatStatusCheck.title', { defaultMessage: 'Module status', }), - text: i18n.translate('kbn.common.tutorials.winlogbeatStatusCheck.text', { + text: i18n.translate('home.tutorials.common.winlogbeatStatusCheck.text', { defaultMessage: 'Check that data is received from Winlogbeat', }), - btnLabel: i18n.translate('kbn.common.tutorials.winlogbeatStatusCheck.buttonLabel', { + btnLabel: i18n.translate('home.tutorials.common.winlogbeatStatusCheck.buttonLabel', { defaultMessage: 'Check data', }), - success: i18n.translate('kbn.common.tutorials.winlogbeatStatusCheck.successText', { + success: i18n.translate('home.tutorials.common.winlogbeatStatusCheck.successText', { defaultMessage: 'Data successfully received', }), - error: i18n.translate('kbn.common.tutorials.winlogbeatStatusCheck.errorText', { + error: i18n.translate('home.tutorials.common.winlogbeatStatusCheck.errorText', { defaultMessage: 'No data has been received yet', }), esHitsCheck: { @@ -169,14 +173,14 @@ export function winlogbeatStatusCheck() { }; } -export function onPremInstructions(platforms, context) { +export function onPremInstructions(context?: TutorialContext) { const WINLOGBEAT_INSTRUCTIONS = createWinlogbeatInstructions(context); return { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.winlogbeat.premInstructions.gettingStarted.title', + 'home.tutorials.common.winlogbeat.premInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -206,7 +210,7 @@ export function onPremCloudInstructions() { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.winlogbeat.premCloudInstructions.gettingStarted.title', + 'home.tutorials.common.winlogbeat.premCloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } @@ -237,7 +241,7 @@ export function cloudInstructions() { instructionSets: [ { title: i18n.translate( - 'kbn.common.tutorials.winlogbeat.cloudInstructions.gettingStarted.title', + 'home.tutorials.common.winlogbeat.cloudInstructions.gettingStarted.title', { defaultMessage: 'Getting Started', } diff --git a/src/legacy/core_plugins/kibana/server/tutorials/iptables_logs/index.js b/src/plugins/home/server/tutorials/iptables_logs/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/iptables_logs/index.js rename to src/plugins/home/server/tutorials/iptables_logs/index.ts index 63246e44d2d0d..e3f2124347b6b 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/iptables_logs/index.js +++ b/src/plugins/home/server/tutorials/iptables_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function iptablesLogsSpecProvider(context) { +export function iptablesLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'iptables'; - const platforms = ['DEB', 'RPM']; + const platforms = ['DEB', 'RPM'] as const; return { id: 'iptablesLogs', - name: i18n.translate('kbn.server.tutorials.iptablesLogs.nameTitle', { + name: i18n.translate('home.tutorials.iptablesLogs.nameTitle', { defaultMessage: 'Iptables / Ubiquiti', }), - category: TUTORIAL_CATEGORY.SIEM, - shortDescription: i18n.translate('kbn.server.tutorials.iptablesLogs.shortDescription', { + category: TutorialsCategory.SIEM, + shortDescription: i18n.translate('home.tutorials.iptablesLogs.shortDescription', { defaultMessage: 'Collect and parse iptables and ip6tables logs or from Ubiqiti firewalls.', }), - longDescription: i18n.translate('kbn.server.tutorials.iptablesLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.iptablesLogs.longDescription', { defaultMessage: 'This is a module for iptables and ip6tables logs. It parses logs \ received over the network via syslog or from a file. Also, it understands the \ @@ -48,12 +52,12 @@ number and the action performed on the traffic (allow/deny).. \ learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-iptables.html', }, }), - //euiIconType: 'logoUbiquiti', + // euiIconType: 'logoUbiquiti', artifacts: { dashboards: [], application: { path: '/app/siem', - label: i18n.translate('kbn.server.tutorials.iptablesLogs.artifacts.dashboards.linkLabel', { + label: i18n.translate('home.tutorials.iptablesLogs.artifacts.dashboards.linkLabel', { defaultMessage: 'SIEM App', }), }, diff --git a/src/legacy/core_plugins/kibana/server/tutorials/kafka_logs/index.js b/src/plugins/home/server/tutorials/kafka_logs/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/kafka_logs/index.js rename to src/plugins/home/server/tutorials/kafka_logs/index.ts index 0d98aaa8a8ccf..74aa1ef772c85 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/kafka_logs/index.js +++ b/src/plugins/home/server/tutorials/kafka_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function kafkaLogsSpecProvider(context) { +export function kafkaLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'kafka'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'kafkaLogs', - name: i18n.translate('kbn.server.tutorials.kafkaLogs.nameTitle', { + name: i18n.translate('home.tutorials.kafkaLogs.nameTitle', { defaultMessage: 'Kafka logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.kafkaLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.kafkaLogs.shortDescription', { defaultMessage: 'Collect and parse logs created by Kafka.', }), - longDescription: i18n.translate('kbn.server.tutorials.kafkaLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.kafkaLogs.longDescription', { defaultMessage: 'The `kafka` Filebeat module parses logs created by Kafka. \ [Learn more]({learnMoreLink}).', @@ -50,12 +54,9 @@ export function kafkaLogsSpecProvider(context) { dashboards: [ { id: '943caca0-87ee-11e7-ad9c-db80de0bf8d3-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.kafkaLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Kafka logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.kafkaLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Kafka logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/kafka_metrics/index.js b/src/plugins/home/server/tutorials/kafka_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/kafka_metrics/index.js rename to src/plugins/home/server/tutorials/kafka_metrics/index.ts index 088ee876661bb..98be309ca89cd 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/kafka_metrics/index.js +++ b/src/plugins/home/server/tutorials/kafka_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function kafkaMetricsSpecProvider(context) { +export function kafkaMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'kafka'; return { id: 'kafkaMetrics', - name: i18n.translate('kbn.server.tutorials.kafkaMetrics.nameTitle', { + name: i18n.translate('home.tutorials.kafkaMetrics.nameTitle', { defaultMessage: 'Kafka metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.kafkaMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.kafkaMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the Kafka server.', }), - longDescription: i18n.translate('kbn.server.tutorials.kafkaMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.kafkaMetrics.longDescription', { defaultMessage: 'The `kafka` Metricbeat module fetches internal metrics from Kafka. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function kafkaMetricsSpecProvider(context) { euiIconType: 'logoKafka', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.kafkaMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.kafkaMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function kafkaMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/kibana_metrics/index.js b/src/plugins/home/server/tutorials/kibana_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/kibana_metrics/index.js rename to src/plugins/home/server/tutorials/kibana_metrics/index.ts index 64e07a87fe402..c087212c46f78 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/kibana_metrics/index.js +++ b/src/plugins/home/server/tutorials/kibana_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function kibanaMetricsSpecProvider(context) { +export function kibanaMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'kibana'; return { id: 'kibanaMetrics', - name: i18n.translate('kbn.server.tutorials.kibanaMetrics.nameTitle', { + name: i18n.translate('home.tutorials.kibanaMetrics.nameTitle', { defaultMessage: 'Kibana metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.kibanaMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.kibanaMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from Kibana.', }), - longDescription: i18n.translate('kbn.server.tutorials.kibanaMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.kibanaMetrics.longDescription', { defaultMessage: 'The `kibana` Metricbeat module fetches internal metrics from Kibana. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function kibanaMetricsSpecProvider(context) { euiIconType: 'logoKibana', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.kibanaMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.kibanaMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function kibanaMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/kubernetes_metrics/index.js b/src/plugins/home/server/tutorials/kubernetes_metrics/index.ts similarity index 73% rename from src/legacy/core_plugins/kibana/server/tutorials/kubernetes_metrics/index.js rename to src/plugins/home/server/tutorials/kubernetes_metrics/index.ts index 4f59816282538..466f713d35e06 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/kubernetes_metrics/index.js +++ b/src/plugins/home/server/tutorials/kubernetes_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function kubernetesMetricsSpecProvider(context) { +export function kubernetesMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'kubernetes'; return { id: 'kubernetesMetrics', - name: i18n.translate('kbn.server.tutorials.kubernetesMetrics.nameTitle', { + name: i18n.translate('home.tutorials.kubernetesMetrics.nameTitle', { defaultMessage: 'Kubernetes metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.kubernetesMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.kubernetesMetrics.shortDescription', { defaultMessage: 'Fetch metrics from your Kubernetes installation.', }), - longDescription: i18n.translate('kbn.server.tutorials.kubernetesMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.kubernetesMetrics.longDescription', { defaultMessage: 'The `kubernetes` Metricbeat module fetches metrics from the Kubernetes APIs. \ [Learn more]({learnMoreLink}).', @@ -50,7 +54,7 @@ export function kubernetesMetricsSpecProvider(context) { { id: 'AV4RGUqo5NkDleZmzKuZ-ecs', linkLabel: i18n.translate( - 'kbn.server.tutorials.kubernetesMetrics.artifacts.dashboards.linkLabel', + 'home.tutorials.kubernetesMetrics.artifacts.dashboards.linkLabel', { defaultMessage: 'Kubernetes metrics dashboard', } @@ -64,7 +68,7 @@ export function kubernetesMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/kubernetes_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/logstash_logs/index.js b/src/plugins/home/server/tutorials/logstash_logs/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/logstash_logs/index.js rename to src/plugins/home/server/tutorials/logstash_logs/index.ts index df0da000bc37a..276ceedbbcc68 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/logstash_logs/index.js +++ b/src/plugins/home/server/tutorials/logstash_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function logstashLogsSpecProvider(context) { +export function logstashLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'logstash'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'logstashLogs', - name: i18n.translate('kbn.server.tutorials.logstashLogs.nameTitle', { + name: i18n.translate('home.tutorials.logstashLogs.nameTitle', { defaultMessage: 'Logstash logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.logstashLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.logstashLogs.shortDescription', { defaultMessage: 'Collect and parse debug and slow logs created by Logstash itself.', }), - longDescription: i18n.translate('kbn.server.tutorials.logstashLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.logstashLogs.longDescription', { defaultMessage: 'The `logstash` Filebeat module parses debug and slow logs created by Logstash itself. \ [Learn more]({learnMoreLink}).', @@ -50,12 +54,9 @@ export function logstashLogsSpecProvider(context) { dashboards: [ { id: 'Filebeat-Logstash-Log-Dashboard-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.logstashLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Logstash logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.logstashLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Logstash logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/logstash_metrics/index.js b/src/plugins/home/server/tutorials/logstash_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/logstash_metrics/index.js rename to src/plugins/home/server/tutorials/logstash_metrics/index.ts index 1ccafa4762e65..122f143e4b834 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/logstash_metrics/index.js +++ b/src/plugins/home/server/tutorials/logstash_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function logstashMetricsSpecProvider(context) { +export function logstashMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'logstash'; return { id: moduleName + 'Metrics', - name: i18n.translate('kbn.server.tutorials.logstashMetrics.nameTitle', { + name: i18n.translate('home.tutorials.logstashMetrics.nameTitle', { defaultMessage: 'Logstash metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.logstashMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.logstashMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from a Logstash server.', }), - longDescription: i18n.translate('kbn.server.tutorials.logstashMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.logstashMetrics.longDescription', { defaultMessage: 'The `{moduleName}` Metricbeat module fetches internal metrics from a Logstash server. \ [Learn more]({learnMoreLink}).', @@ -49,7 +53,7 @@ export function logstashMetricsSpecProvider(context) { euiIconType: 'logoLogstash', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.logstashMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.logstashMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -60,7 +64,7 @@ export function logstashMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/memcached_metrics/index.js b/src/plugins/home/server/tutorials/memcached_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/memcached_metrics/index.js rename to src/plugins/home/server/tutorials/memcached_metrics/index.ts index 8a9f6bfe8b439..1c9c9d975e4b8 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/memcached_metrics/index.js +++ b/src/plugins/home/server/tutorials/memcached_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function memcachedMetricsSpecProvider(context) { +export function memcachedMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'memcached'; return { id: 'memcachedMetrics', - name: i18n.translate('kbn.server.tutorials.memcachedMetrics.nameTitle', { + name: i18n.translate('home.tutorials.memcachedMetrics.nameTitle', { defaultMessage: 'Memcached metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.memcachedMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.memcachedMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the Memcached server.', }), - longDescription: i18n.translate('kbn.server.tutorials.memcachedMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.memcachedMetrics.longDescription', { defaultMessage: 'The `memcached` Metricbeat module fetches internal metrics from Memcached. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function memcachedMetricsSpecProvider(context) { euiIconType: 'logoMemcached', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.memcachedMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.memcachedMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function memcachedMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/mongodb_metrics/index.js b/src/plugins/home/server/tutorials/mongodb_metrics/index.ts similarity index 73% rename from src/legacy/core_plugins/kibana/server/tutorials/mongodb_metrics/index.js rename to src/plugins/home/server/tutorials/mongodb_metrics/index.ts index 1e19650af73fd..1a10dc3849471 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/mongodb_metrics/index.js +++ b/src/plugins/home/server/tutorials/mongodb_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function mongodbMetricsSpecProvider(context) { +export function mongodbMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'mongodb'; return { id: 'mongodbMetrics', - name: i18n.translate('kbn.server.tutorials.mongodbMetrics.nameTitle', { + name: i18n.translate('home.tutorials.mongodbMetrics.nameTitle', { defaultMessage: 'MongoDB metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.mongodbMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.mongodbMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from MongoDB.', }), - longDescription: i18n.translate('kbn.server.tutorials.mongodbMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.mongodbMetrics.longDescription', { defaultMessage: 'The `mongodb` Metricbeat module fetches internal metrics from the MongoDB server. \ [Learn more]({learnMoreLink}).', @@ -50,7 +54,7 @@ export function mongodbMetricsSpecProvider(context) { { id: 'Metricbeat-MongoDB-ecs', linkLabel: i18n.translate( - 'kbn.server.tutorials.mongodbMetrics.artifacts.dashboards.linkLabel', + 'home.tutorials.mongodbMetrics.artifacts.dashboards.linkLabel', { defaultMessage: 'MongoDB metrics dashboard', } @@ -64,7 +68,7 @@ export function mongodbMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/mongodb_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/mssql_metrics/index.js b/src/plugins/home/server/tutorials/mssql_metrics/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/mssql_metrics/index.js rename to src/plugins/home/server/tutorials/mssql_metrics/index.ts index d12964e122bc6..cea46c3220d5a 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/mssql_metrics/index.js +++ b/src/plugins/home/server/tutorials/mssql_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function mssqlMetricsSpecProvider(context) { +export function mssqlMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'mssql'; return { id: 'mssqlMetrics', - name: i18n.translate('kbn.server.tutorials.mssqlMetrics.nameTitle', { + name: i18n.translate('home.tutorials.mssqlMetrics.nameTitle', { defaultMessage: 'Microsoft SQL Server Metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.mssqlMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.mssqlMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from a Microsoft SQL Server instance', }), - longDescription: i18n.translate('kbn.server.tutorials.mssqlMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.mssqlMetrics.longDescription', { defaultMessage: 'The `mssql` Metricbeat module fetches monitoring, log and performance metrics from a Microsoft SQL Server instance. \ [Learn more]({learnMoreLink}).', @@ -50,12 +54,9 @@ export function mssqlMetricsSpecProvider(context) { dashboards: [ { id: 'a2ead240-18bb-11e9-9836-f37dedd3b411-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.mssqlMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Microsoft SQL Server metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.mssqlMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'Microsoft SQL Server metrics dashboard', + }), isOverview: true, }, ], @@ -65,7 +66,7 @@ export function mssqlMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/mssql_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/munin_metrics/index.js b/src/plugins/home/server/tutorials/munin_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/munin_metrics/index.js rename to src/plugins/home/server/tutorials/munin_metrics/index.ts index 627c2ddd7dc5b..e438d3015c77c 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/munin_metrics/index.js +++ b/src/plugins/home/server/tutorials/munin_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function muninMetricsSpecProvider(context) { +export function muninMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'munin'; return { id: 'muninMetrics', - name: i18n.translate('kbn.server.tutorials.muninMetrics.nameTitle', { + name: i18n.translate('home.tutorials.muninMetrics.nameTitle', { defaultMessage: 'Munin metrics', }), isBeta: true, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.muninMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.muninMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the Munin server.', }), - longDescription: i18n.translate('kbn.server.tutorials.muninMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.muninMetrics.longDescription', { defaultMessage: 'The `munin` Metricbeat module fetches internal metrics from Munin. \ [Learn more]({learnMoreLink}).', @@ -47,7 +51,7 @@ export function muninMetricsSpecProvider(context) { }), artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.muninMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.muninMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -58,7 +62,7 @@ export function muninMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/mysql_logs/index.js b/src/plugins/home/server/tutorials/mysql_logs/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/mysql_logs/index.js rename to src/plugins/home/server/tutorials/mysql_logs/index.ts index 796c03c9b19e2..e003f4dfd47e4 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/mysql_logs/index.js +++ b/src/plugins/home/server/tutorials/mysql_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function mysqlLogsSpecProvider(context) { +export function mysqlLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'mysql'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'mysqlLogs', - name: i18n.translate('kbn.server.tutorials.mysqlLogs.nameTitle', { + name: i18n.translate('home.tutorials.mysqlLogs.nameTitle', { defaultMessage: 'MySQL logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.mysqlLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.mysqlLogs.shortDescription', { defaultMessage: 'Collect and parse error and slow logs created by MySQL.', }), - longDescription: i18n.translate('kbn.server.tutorials.mysqlLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.mysqlLogs.longDescription', { defaultMessage: 'The `mysql` Filebeat module parses error and slow logs created by MySQL. \ [Learn more]({learnMoreLink}).', @@ -50,12 +54,9 @@ export function mysqlLogsSpecProvider(context) { dashboards: [ { id: 'Filebeat-MySQL-Dashboard-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.mysqlLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'MySQL logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.mysqlLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'MySQL logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/mysql_metrics/index.js b/src/plugins/home/server/tutorials/mysql_metrics/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/mysql_metrics/index.js rename to src/plugins/home/server/tutorials/mysql_metrics/index.ts index 55087d03237d8..d18cc31512e71 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/mysql_metrics/index.js +++ b/src/plugins/home/server/tutorials/mysql_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function mysqlMetricsSpecProvider(context) { +export function mysqlMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'mysql'; return { id: 'mysqlMetrics', - name: i18n.translate('kbn.server.tutorials.mysqlMetrics.nameTitle', { + name: i18n.translate('home.tutorials.mysqlMetrics.nameTitle', { defaultMessage: 'MySQL metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.mysqlMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.mysqlMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from MySQL.', }), - longDescription: i18n.translate('kbn.server.tutorials.mysqlMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.mysqlMetrics.longDescription', { defaultMessage: 'The `mysql` Metricbeat module fetches internal metrics from the MySQL server. \ [Learn more]({learnMoreLink}).', @@ -49,12 +53,9 @@ export function mysqlMetricsSpecProvider(context) { dashboards: [ { id: '66881e90-0006-11e7-bf7f-c9acc3d3e306-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.mysqlMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'MySQL metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.mysqlMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'MySQL metrics dashboard', + }), isOverview: true, }, ], @@ -64,7 +65,7 @@ export function mysqlMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/mysql_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/nats_logs/index.js b/src/plugins/home/server/tutorials/nats_logs/index.ts similarity index 69% rename from src/legacy/core_plugins/kibana/server/tutorials/nats_logs/index.js rename to src/plugins/home/server/tutorials/nats_logs/index.ts index bbf221c91d5e2..3f6cb36d8d49e 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/nats_logs/index.js +++ b/src/plugins/home/server/tutorials/nats_logs/index.ts @@ -18,29 +18,31 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function natsLogsSpecProvider(context) { +export function natsLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'nats'; - const geoipRequired = false; - const uaRequired = false; - const platforms = ['DEB', 'RPM']; + const platforms = ['DEB', 'RPM'] as const; return { id: 'natsLogs', - name: i18n.translate('kbn.server.tutorials.natsLogs.nameTitle', { + name: i18n.translate('home.tutorials.natsLogs.nameTitle', { defaultMessage: 'NATS logs', }), - category: TUTORIAL_CATEGORY.LOGGING, + category: TutorialsCategory.LOGGING, isBeta: true, - shortDescription: i18n.translate('kbn.server.tutorials.natsLogs.shortDescription', { + shortDescription: i18n.translate('home.tutorials.natsLogs.shortDescription', { defaultMessage: 'Collect and parse logs created by Nats.', }), - longDescription: i18n.translate('kbn.server.tutorials.natsLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.natsLogs.longDescription', { defaultMessage: 'The `nats` Filebeat module parses logs created by Nats. \ [Learn more]({learnMoreLink}).', @@ -53,12 +55,9 @@ export function natsLogsSpecProvider(context) { dashboards: [ { id: 'Filebeat-nats-overview-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.natsLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'NATS logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.natsLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'NATS logs dashboard', + }), isOverview: true, }, ], @@ -68,7 +67,7 @@ export function natsLogsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/nats_logs/screenshot.png', - onPrem: onPremInstructions(moduleName, platforms, geoipRequired, uaRequired, context), + onPrem: onPremInstructions(moduleName, platforms, context), elasticCloud: cloudInstructions(moduleName, platforms), onPremElasticCloud: onPremCloudInstructions(moduleName, platforms), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/nats_metrics/index.js b/src/plugins/home/server/tutorials/nats_metrics/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/nats_metrics/index.js rename to src/plugins/home/server/tutorials/nats_metrics/index.ts index 54f01b70e2d15..27b5507ff6672 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/nats_metrics/index.js +++ b/src/plugins/home/server/tutorials/nats_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function natsMetricsSpecProvider(context) { +export function natsMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'nats'; return { id: 'natsMetrics', - name: i18n.translate('kbn.server.tutorials.natsMetrics.nameTitle', { + name: i18n.translate('home.tutorials.natsMetrics.nameTitle', { defaultMessage: 'NATS metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.natsMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.natsMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from the Nats server.', }), - longDescription: i18n.translate('kbn.server.tutorials.natsMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.natsMetrics.longDescription', { defaultMessage: 'The `nats` Metricbeat module fetches monitoring metrics from Nats. \ [Learn more]({learnMoreLink}).', @@ -49,12 +53,9 @@ export function natsMetricsSpecProvider(context) { dashboards: [ { id: 'Metricbeat-Nats-Dashboard-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.natsMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'NATS metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.natsMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'NATS metrics dashboard', + }), isOverview: true, }, ], @@ -64,7 +65,7 @@ export function natsMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/nats_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/netflow/common_instructions.js b/src/plugins/home/server/tutorials/netflow/common_instructions.ts similarity index 72% rename from src/legacy/core_plugins/kibana/server/tutorials/netflow/common_instructions.js rename to src/plugins/home/server/tutorials/netflow/common_instructions.ts index 194e315d92ed7..8fe24ba9c7994 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/netflow/common_instructions.js +++ b/src/plugins/home/server/tutorials/netflow/common_instructions.ts @@ -25,51 +25,39 @@ export function createCommonNetflowInstructions() { ON_PREM: { OSX: [ { - title: i18n.translate('kbn.server.tutorials.netflow.common.config.onPrem.osxTitle', { + title: i18n.translate('home.tutorials.netflow.common.config.onPrem.osxTitle', { defaultMessage: 'Edit the configuration', }), - textPre: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPrem.osxTextPre', - { - defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', - values: { - logstashConfigPath: '`config/logstash.yml`', - }, - } - ), + textPre: i18n.translate('home.tutorials.netflow.common.config.onPrem.osxTextPre', { + defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', + values: { + logstashConfigPath: '`config/logstash.yml`', + }, + }), commands: ['modules:', ' - name: netflow', ' var.input.udp.port: '], - textPost: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPrem.osxTextPost', - { - defaultMessage: - 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data.', - values: { - udpPort: '``', - }, - } - ), + textPost: i18n.translate('home.tutorials.netflow.common.config.onPrem.osxTextPost', { + defaultMessage: + 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data.', + values: { + udpPort: '``', + }, + }), }, ], WINDOWS: [ { - title: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPrem.windowsTitle', - { - defaultMessage: 'Edit the configuration', - } - ), - textPre: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPrem.windowsTextPre', - { - defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', - values: { - logstashConfigPath: '`config\\logstash.yml`', - }, - } - ), + title: i18n.translate('home.tutorials.netflow.common.config.onPrem.windowsTitle', { + defaultMessage: 'Edit the configuration', + }), + textPre: i18n.translate('home.tutorials.netflow.common.config.onPrem.windowsTextPre', { + defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', + values: { + logstashConfigPath: '`config\\logstash.yml`', + }, + }), commands: ['modules:', ' - name: netflow', ' var.input.udp.port: '], textPost: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPrem.windowsTextPost', + 'home.tutorials.netflow.common.config.onPrem.windowsTextPost', { defaultMessage: 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data.', @@ -85,13 +73,13 @@ export function createCommonNetflowInstructions() { OSX: [ { title: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.osxTitle', + 'home.tutorials.netflow.common.config.onPremElasticCloud.osxTitle', { defaultMessage: 'Edit the configuration', } ), textPre: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.osxTextPre', + 'home.tutorials.netflow.common.config.onPremElasticCloud.osxTextPre', { defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', values: { @@ -108,7 +96,7 @@ export function createCommonNetflowInstructions() { ' var.elasticsearch.password: ', ], textPost: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.osxTextPost', + 'home.tutorials.netflow.common.config.onPremElasticCloud.osxTextPost', { defaultMessage: 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data, \ @@ -127,13 +115,13 @@ export function createCommonNetflowInstructions() { WINDOWS: [ { title: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.windowsTitle', + 'home.tutorials.netflow.common.config.onPremElasticCloud.windowsTitle', { defaultMessage: 'Edit the configuration', } ), textPre: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.windowsTextPre', + 'home.tutorials.netflow.common.config.onPremElasticCloud.windowsTextPre', { defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', values: { @@ -150,7 +138,7 @@ export function createCommonNetflowInstructions() { ' var.elasticsearch.password: ', ], textPost: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.windowsTextPost', + 'home.tutorials.netflow.common.config.onPremElasticCloud.windowsTextPost', { defaultMessage: 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data, \ @@ -170,14 +158,11 @@ export function createCommonNetflowInstructions() { ELASTIC_CLOUD: { OSX: [ { - title: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.elasticCloud.osxTitle', - { - defaultMessage: 'Edit the configuration', - } - ), + title: i18n.translate('home.tutorials.netflow.common.config.elasticCloud.osxTitle', { + defaultMessage: 'Edit the configuration', + }), textPre: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.elasticCloud.osxTextPre', + 'home.tutorials.netflow.common.config.elasticCloud.osxTextPre', { defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', values: { @@ -194,7 +179,7 @@ export function createCommonNetflowInstructions() { ' var.input.udp.port: ', ], textPost: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.elasticCloud.osxTextPost', + 'home.tutorials.netflow.common.config.elasticCloud.osxTextPost', { defaultMessage: 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data and \ @@ -211,13 +196,13 @@ export function createCommonNetflowInstructions() { WINDOWS: [ { title: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.elasticCloud.windowsTitle', + 'home.tutorials.netflow.common.config.elasticCloud.windowsTitle', { defaultMessage: 'Edit the configuration', } ), textPre: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.elasticCloud.windowsTextPre', + 'home.tutorials.netflow.common.config.elasticCloud.windowsTextPre', { defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', values: { @@ -234,7 +219,7 @@ export function createCommonNetflowInstructions() { ' var.input.udp.port: ', ], textPost: i18n.translate( - 'kbn.server.tutorials.netflow.common.config.elasticCloud.windowsTextPost', + 'home.tutorials.netflow.common.config.elasticCloud.windowsTextPost', { defaultMessage: 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data and \ @@ -253,14 +238,14 @@ export function createCommonNetflowInstructions() { SETUP: { OSX: [ { - title: i18n.translate('kbn.server.tutorials.netflow.common.setup.osxTitle', { + title: i18n.translate('home.tutorials.netflow.common.setup.osxTitle', { defaultMessage: 'Run the Netflow module', }), - textPre: i18n.translate('kbn.server.tutorials.netflow.common.setup.osxTextPre', { + textPre: i18n.translate('home.tutorials.netflow.common.setup.osxTextPre', { defaultMessage: 'Run:', }), commands: ['./bin/logstash --modules netflow --setup'], - textPost: i18n.translate('kbn.server.tutorials.netflow.common.setup.osxTextPost', { + textPost: i18n.translate('home.tutorials.netflow.common.setup.osxTextPost', { defaultMessage: 'The {setupOption} option creates a {netflowPrefix} index pattern in Elasticsearch and imports \ Kibana dashboards and visualizations. Omit this option for subsequent runs to avoid overwriting existing dashboards.', @@ -273,14 +258,14 @@ export function createCommonNetflowInstructions() { ], WINDOWS: [ { - title: i18n.translate('kbn.server.tutorials.netflow.common.setup.windowsTitle', { + title: i18n.translate('home.tutorials.netflow.common.setup.windowsTitle', { defaultMessage: 'Run the Netflow module', }), - textPre: i18n.translate('kbn.server.tutorials.netflow.common.setup.windowsTextPre', { + textPre: i18n.translate('home.tutorials.netflow.common.setup.windowsTextPre', { defaultMessage: 'Run:', }), commands: ['bin\\logstash --modules netflow --setup'], - textPost: i18n.translate('kbn.server.tutorials.netflow.common.setup.windowsTextPost', { + textPost: i18n.translate('home.tutorials.netflow.common.setup.windowsTextPost', { defaultMessage: 'The {setupOption} option creates a {netflowPrefix} index pattern in Elasticsearch and imports \ Kibana dashboards and visualizations. Omit this option for subsequent runs to avoid overwriting existing dashboards.', diff --git a/src/legacy/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js b/src/plugins/home/server/tutorials/netflow/elastic_cloud.ts similarity index 87% rename from src/legacy/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js rename to src/plugins/home/server/tutorials/netflow/elastic_cloud.ts index 6ba76c2b5fa9c..ac64aef730004 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js +++ b/src/plugins/home/server/tutorials/netflow/elastic_cloud.ts @@ -19,8 +19,8 @@ import { i18n } from '@kbn/i18n'; -import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; -import { createLogstashInstructions } from '../../../common/tutorials/logstash_instructions'; +import { INSTRUCTION_VARIANT } from '../instructions/instruction_variant'; +import { createLogstashInstructions } from '../instructions/logstash_instructions'; import { createCommonNetflowInstructions } from './common_instructions'; // TODO: compare with onPremElasticCloud and onPrem scenarios and extract out common bits @@ -31,7 +31,7 @@ export function createElasticCloudInstructions() { return { instructionSets: [ { - title: i18n.translate('kbn.server.tutorials.netflow.elasticCloudInstructions.title', { + title: i18n.translate('home.tutorials.netflow.elasticCloudInstructions.title', { defaultMessage: 'Getting Started', }), instructionVariants: [ diff --git a/src/legacy/core_plugins/kibana/server/tutorials/netflow/index.js b/src/plugins/home/server/tutorials/netflow/index.ts similarity index 83% rename from src/legacy/core_plugins/kibana/server/tutorials/netflow/index.js rename to src/plugins/home/server/tutorials/netflow/index.ts index 10a57fc291d59..7c6fcadcff625 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/netflow/index.js +++ b/src/plugins/home/server/tutorials/netflow/index.ts @@ -19,7 +19,7 @@ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { createOnPremInstructions } from './on_prem'; import { createElasticCloudInstructions } from './elastic_cloud'; import { createOnPremElasticCloudInstructions } from './on_prem_elastic_cloud'; @@ -28,11 +28,11 @@ export function netflowSpecProvider() { return { id: 'netflow', name: 'Netflow', - category: TUTORIAL_CATEGORY.SIEM, - shortDescription: i18n.translate('kbn.server.tutorials.netflow.tutorialShortDescription', { + category: TutorialsCategory.SIEM, + shortDescription: i18n.translate('home.tutorials.netflow.tutorialShortDescription', { defaultMessage: 'Collect Netflow records sent by a Netflow exporter.', }), - longDescription: i18n.translate('kbn.server.tutorials.netflow.tutorialLongDescription', { + longDescription: i18n.translate('home.tutorials.netflow.tutorialLongDescription', { defaultMessage: 'The Logstash Netflow module collects and parses network flow data, \ indexes the events into Elasticsearch, and installs a suite of Kibana dashboards. \ @@ -42,7 +42,7 @@ This module support Netflow Version 5 and 9. [Learn more]({linkUrl}).', }, }), completionTimeMinutes: 10, - //previewImagePath: 'kibana-apache.png', TODO + // previewImagePath: 'kibana-apache.png', TODO onPrem: createOnPremInstructions(), elasticCloud: createElasticCloudInstructions(), onPremElasticCloud: createOnPremElasticCloudInstructions(), diff --git a/src/legacy/core_plugins/kibana/server/tutorials/netflow/on_prem.js b/src/plugins/home/server/tutorials/netflow/on_prem.ts similarity index 87% rename from src/legacy/core_plugins/kibana/server/tutorials/netflow/on_prem.js rename to src/plugins/home/server/tutorials/netflow/on_prem.ts index cc060611361bd..c7cd36d073632 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/netflow/on_prem.js +++ b/src/plugins/home/server/tutorials/netflow/on_prem.ts @@ -19,8 +19,8 @@ import { i18n } from '@kbn/i18n'; -import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; -import { createLogstashInstructions } from '../../../common/tutorials/logstash_instructions'; +import { INSTRUCTION_VARIANT } from '../instructions/instruction_variant'; +import { createLogstashInstructions } from '../instructions/logstash_instructions'; import { createCommonNetflowInstructions } from './common_instructions'; // TODO: compare with onPremElasticCloud and elasticCloud scenarios and extract out common bits @@ -31,7 +31,7 @@ export function createOnPremInstructions() { return { instructionSets: [ { - title: i18n.translate('kbn.server.tutorials.netflow.onPremInstructions.title', { + title: i18n.translate('home.tutorials.netflow.onPremInstructions.title', { defaultMessage: 'Getting Started', }), instructionVariants: [ diff --git a/src/legacy/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js b/src/plugins/home/server/tutorials/netflow/on_prem_elastic_cloud.ts similarity index 86% rename from src/legacy/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js rename to src/plugins/home/server/tutorials/netflow/on_prem_elastic_cloud.ts index 49674621b70be..c01a9a5382f88 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js +++ b/src/plugins/home/server/tutorials/netflow/on_prem_elastic_cloud.ts @@ -19,12 +19,12 @@ import { i18n } from '@kbn/i18n'; -import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; -import { createLogstashInstructions } from '../../../common/tutorials/logstash_instructions'; +import { INSTRUCTION_VARIANT } from '../instructions/instruction_variant'; +import { createLogstashInstructions } from '../instructions/logstash_instructions'; import { createTrycloudOption1, createTrycloudOption2, -} from '../../../common/tutorials/onprem_cloud_instructions'; +} from '../instructions/onprem_cloud_instructions'; import { createCommonNetflowInstructions } from './common_instructions'; // TODO: compare with onPrem and elasticCloud scenarios and extract out common bits @@ -37,7 +37,7 @@ export function createOnPremElasticCloudInstructions() { return { instructionSets: [ { - title: i18n.translate('kbn.server.tutorials.netflow.onPremElasticCloudInstructions.title', { + title: i18n.translate('home.tutorials.netflow.onPremElasticCloudInstructions.title', { defaultMessage: 'Getting Started', }), instructionVariants: [ diff --git a/src/legacy/core_plugins/kibana/server/tutorials/nginx_logs/index.js b/src/plugins/home/server/tutorials/nginx_logs/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/nginx_logs/index.js rename to src/plugins/home/server/tutorials/nginx_logs/index.ts index ef4dae582790e..756d4a171d858 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/nginx_logs/index.js +++ b/src/plugins/home/server/tutorials/nginx_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function nginxLogsSpecProvider(context) { +export function nginxLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'nginx'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'nginxLogs', - name: i18n.translate('kbn.server.tutorials.nginxLogs.nameTitle', { + name: i18n.translate('home.tutorials.nginxLogs.nameTitle', { defaultMessage: 'Nginx logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.nginxLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.nginxLogs.shortDescription', { defaultMessage: 'Collect and parse access and error logs created by the Nginx HTTP server.', }), - longDescription: i18n.translate('kbn.server.tutorials.nginxLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.nginxLogs.longDescription', { defaultMessage: 'The `nginx` Filebeat module parses access and error logs created by the Nginx HTTP server. \ [Learn more]({learnMoreLink}).', @@ -50,12 +54,9 @@ export function nginxLogsSpecProvider(context) { dashboards: [ { id: '55a9e6e0-a29e-11e7-928f-5dbe6f6f5519-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.nginxLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Nginx logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.nginxLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Nginx logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/nginx_metrics/index.js b/src/plugins/home/server/tutorials/nginx_metrics/index.ts similarity index 73% rename from src/legacy/core_plugins/kibana/server/tutorials/nginx_metrics/index.js rename to src/plugins/home/server/tutorials/nginx_metrics/index.ts index 2acb72b01eca9..82af4d6c42dd8 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/nginx_metrics/index.js +++ b/src/plugins/home/server/tutorials/nginx_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function nginxMetricsSpecProvider(context) { +export function nginxMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'nginx'; return { id: 'nginxMetrics', - name: i18n.translate('kbn.server.tutorials.nginxMetrics.nameTitle', { + name: i18n.translate('home.tutorials.nginxMetrics.nameTitle', { defaultMessage: 'Nginx metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.nginxMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.nginxMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the Nginx HTTP server.', }), - longDescription: i18n.translate('kbn.server.tutorials.nginxMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.nginxMetrics.longDescription', { defaultMessage: 'The `nginx` Metricbeat module fetches internal metrics from the Nginx HTTP server. \ The module scrapes the server status data from the web page generated by the \ @@ -54,12 +58,9 @@ which must be enabled in your Nginx installation. \ dashboards: [ { id: '023d2930-f1a5-11e7-a9ef-93c69af7b129-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.nginxMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Nginx metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.nginxMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'Nginx metrics dashboard', + }), isOverview: true, }, ], @@ -69,7 +70,7 @@ which must be enabled in your Nginx installation. \ }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/nginx_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/osquery_logs/index.js b/src/plugins/home/server/tutorials/osquery_logs/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/osquery_logs/index.js rename to src/plugins/home/server/tutorials/osquery_logs/index.ts index eddb81a9762e3..bce928519f66d 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/osquery_logs/index.js +++ b/src/plugins/home/server/tutorials/osquery_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function osqueryLogsSpecProvider(context) { +export function osqueryLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'osquery'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'osqueryLogs', - name: i18n.translate('kbn.server.tutorials.osqueryLogs.nameTitle', { + name: i18n.translate('home.tutorials.osqueryLogs.nameTitle', { defaultMessage: 'Osquery logs', }), - category: TUTORIAL_CATEGORY.SIEM, - shortDescription: i18n.translate('kbn.server.tutorials.osqueryLogs.shortDescription', { + category: TutorialsCategory.SIEM, + shortDescription: i18n.translate('home.tutorials.osqueryLogs.shortDescription', { defaultMessage: 'Collect the result logs created by osqueryd.', }), - longDescription: i18n.translate('kbn.server.tutorials.osqueryLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.osqueryLogs.longDescription', { defaultMessage: 'The `osquery` Filebeat module collects the JSON result logs collected by `osqueryd`. \ [Learn more]({learnMoreLink}).', @@ -50,12 +54,9 @@ export function osqueryLogsSpecProvider(context) { dashboards: [ { id: '69f5ae20-eb02-11e7-8f04-51231daa5b05-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.osqueryLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Osquery logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.osqueryLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Osquery logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/php_fpm_metrics/index.js b/src/plugins/home/server/tutorials/php_fpm_metrics/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/php_fpm_metrics/index.js rename to src/plugins/home/server/tutorials/php_fpm_metrics/index.ts index c62cdfa0917ef..a6c98fb16671f 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/php_fpm_metrics/index.js +++ b/src/plugins/home/server/tutorials/php_fpm_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function phpfpmMetricsSpecProvider(context) { +export function phpfpmMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'php_fpm'; return { id: 'phpfpmMetrics', - name: i18n.translate('kbn.server.tutorials.phpFpmMetrics.nameTitle', { + name: i18n.translate('home.tutorials.phpFpmMetrics.nameTitle', { defaultMessage: 'PHP-FPM metrics', }), - category: TUTORIAL_CATEGORY.METRICS, + category: TutorialsCategory.METRICS, isBeta: false, - shortDescription: i18n.translate('kbn.server.tutorials.phpFpmMetrics.shortDescription', { + shortDescription: i18n.translate('home.tutorials.phpFpmMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from PHP-FPM.', }), - longDescription: i18n.translate('kbn.server.tutorials.phpFpmMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.phpFpmMetrics.longDescription', { defaultMessage: 'The `php_fpm` Metricbeat module fetches internal metrics from the PHP-FPM server. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function phpfpmMetricsSpecProvider(context) { euiIconType: 'logoPhp', artifacts: { dashboards: [ - /*{ + /* { id: 'TODO', linkLabel: 'PHP-FPM metrics dashboard', isOverview: true @@ -59,8 +63,8 @@ export function phpfpmMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - //previewImagePath: '/plugins/kibana/home/tutorial_resources/php_fpm_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + // previewImagePath: '/plugins/kibana/home/tutorial_resources/php_fpm_metrics/screenshot.png', + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/postgresql_logs/index.js b/src/plugins/home/server/tutorials/postgresql_logs/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/postgresql_logs/index.js rename to src/plugins/home/server/tutorials/postgresql_logs/index.ts index 810af1cb025e4..def9f71c9d2df 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/postgresql_logs/index.js +++ b/src/plugins/home/server/tutorials/postgresql_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function postgresqlLogsSpecProvider(context) { +export function postgresqlLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'postgresql'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'postgresqlLogs', - name: i18n.translate('kbn.server.tutorials.postgresqlLogs.nameTitle', { + name: i18n.translate('home.tutorials.postgresqlLogs.nameTitle', { defaultMessage: 'PostgreSQL logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.postgresqlLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.postgresqlLogs.shortDescription', { defaultMessage: 'Collect and parse error and slow logs created by PostgreSQL.', }), - longDescription: i18n.translate('kbn.server.tutorials.postgresqlLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.postgresqlLogs.longDescription', { defaultMessage: 'The `postgresql` Filebeat module parses error and slow logs created by PostgreSQL. \ [Learn more]({learnMoreLink}).', @@ -51,7 +55,7 @@ export function postgresqlLogsSpecProvider(context) { { id: '158be870-87f4-11e7-ad9c-db80de0bf8d3-ecs', linkLabel: i18n.translate( - 'kbn.server.tutorials.postgresqlLogs.artifacts.dashboards.linkLabel', + 'home.tutorials.postgresqlLogs.artifacts.dashboards.linkLabel', { defaultMessage: 'PostgreSQL logs dashboard', } diff --git a/src/legacy/core_plugins/kibana/server/tutorials/postgresql_metrics/index.js b/src/plugins/home/server/tutorials/postgresql_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/postgresql_metrics/index.js rename to src/plugins/home/server/tutorials/postgresql_metrics/index.ts index 62203d7f13d33..b16267aeb0de6 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/postgresql_metrics/index.js +++ b/src/plugins/home/server/tutorials/postgresql_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function postgresqlMetricsSpecProvider(context) { +export function postgresqlMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'postgresql'; return { id: 'postgresqlMetrics', - name: i18n.translate('kbn.server.tutorials.postgresqlMetrics.nameTitle', { + name: i18n.translate('home.tutorials.postgresqlMetrics.nameTitle', { defaultMessage: 'PostgreSQL metrics', }), - category: TUTORIAL_CATEGORY.METRICS, + category: TutorialsCategory.METRICS, isBeta: false, - shortDescription: i18n.translate('kbn.server.tutorials.postgresqlMetrics.shortDescription', { + shortDescription: i18n.translate('home.tutorials.postgresqlMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from PostgreSQL.', }), - longDescription: i18n.translate('kbn.server.tutorials.postgresqlMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.postgresqlMetrics.longDescription', { defaultMessage: 'The `postgresql` Metricbeat module fetches internal metrics from the PostgreSQL server. \ [Learn more]({learnMoreLink}).', @@ -61,8 +65,8 @@ export function postgresqlMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - //previewImagePath: '/plugins/kibana/home/tutorial_resources/postgresql_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + // previewImagePath: '/plugins/kibana/home/tutorial_resources/postgresql_metrics/screenshot.png', + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/prometheus_metrics/index.js b/src/plugins/home/server/tutorials/prometheus_metrics/index.ts similarity index 69% rename from src/legacy/core_plugins/kibana/server/tutorials/prometheus_metrics/index.js rename to src/plugins/home/server/tutorials/prometheus_metrics/index.ts index 20a66418042d6..d79ce652db0d0 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/prometheus_metrics/index.js +++ b/src/plugins/home/server/tutorials/prometheus_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function prometheusMetricsSpecProvider(context) { +export function prometheusMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'prometheus'; return { id: moduleName + 'Metrics', - name: i18n.translate('kbn.server.tutorials.prometheusMetrics.nameTitle', { + name: i18n.translate('home.tutorials.prometheusMetrics.nameTitle', { defaultMessage: 'Prometheus metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.prometheusMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.prometheusMetrics.shortDescription', { defaultMessage: 'Fetch metrics from a Prometheus exporter.', }), - longDescription: i18n.translate('kbn.server.tutorials.prometheusMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.prometheusMetrics.longDescription', { defaultMessage: 'The `{moduleName}` Metricbeat module fetches metrics from Prometheus endpoint. \ [Learn more]({learnMoreLink}).', @@ -49,12 +53,9 @@ export function prometheusMetricsSpecProvider(context) { euiIconType: 'logoPrometheus', artifacts: { application: { - label: i18n.translate( - 'kbn.server.tutorials.prometheusMetrics.artifacts.application.label', - { - defaultMessage: 'Discover', - } - ), + label: i18n.translate('home.tutorials.prometheusMetrics.artifacts.application.label', { + defaultMessage: 'Discover', + }), path: '/app/kibana#/discover', }, dashboards: [], @@ -63,7 +64,7 @@ export function prometheusMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/rabbitmq_metrics/index.js b/src/plugins/home/server/tutorials/rabbitmq_metrics/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/rabbitmq_metrics/index.js rename to src/plugins/home/server/tutorials/rabbitmq_metrics/index.ts index 34c2c28541d3f..b62a7ff731420 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/rabbitmq_metrics/index.js +++ b/src/plugins/home/server/tutorials/rabbitmq_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function rabbitmqMetricsSpecProvider(context) { +export function rabbitmqMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'rabbitmq'; return { id: 'rabbitmqMetrics', - name: i18n.translate('kbn.server.tutorials.rabbitmqMetrics.nameTitle', { + name: i18n.translate('home.tutorials.rabbitmqMetrics.nameTitle', { defaultMessage: 'RabbitMQ metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.rabbitmqMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.rabbitmqMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the RabbitMQ server.', }), - longDescription: i18n.translate('kbn.server.tutorials.rabbitmqMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.rabbitmqMetrics.longDescription', { defaultMessage: 'The `rabbitmq` Metricbeat module fetches internal metrics from the RabbitMQ server. \ [Learn more]({learnMoreLink}).', @@ -51,7 +55,7 @@ export function rabbitmqMetricsSpecProvider(context) { { id: 'AV4YobKIge1VCbKU_qVo-ecs', linkLabel: i18n.translate( - 'kbn.server.tutorials.rabbitmqMetrics.artifacts.dashboards.linkLabel', + 'home.tutorials.rabbitmqMetrics.artifacts.dashboards.linkLabel', { defaultMessage: 'RabbitMQ metrics dashboard', } @@ -65,7 +69,7 @@ export function rabbitmqMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/rabbitmq_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/redis_logs/index.js b/src/plugins/home/server/tutorials/redis_logs/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/redis_logs/index.js rename to src/plugins/home/server/tutorials/redis_logs/index.ts index 4d4b5dabad3da..27c288ce9c381 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/redis_logs/index.js +++ b/src/plugins/home/server/tutorials/redis_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function redisLogsSpecProvider(context) { +export function redisLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'redis'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'redisLogs', - name: i18n.translate('kbn.server.tutorials.redisLogs.nameTitle', { + name: i18n.translate('home.tutorials.redisLogs.nameTitle', { defaultMessage: 'Redis logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.redisLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.redisLogs.shortDescription', { defaultMessage: 'Collect and parse error and slow logs created by Redis.', }), - longDescription: i18n.translate('kbn.server.tutorials.redisLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.redisLogs.longDescription', { defaultMessage: 'The `redis` Filebeat module parses error and slow logs created by Redis. \ For Redis to write error logs, make sure the `logfile` option, from the \ @@ -56,12 +60,9 @@ Note that the `slowlog` fileset is experimental. \ dashboards: [ { id: '7fea2930-478e-11e7-b1f0-cb29bac6bf8b-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.redisLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Redis logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.redisLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Redis logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/redis_metrics/index.js b/src/plugins/home/server/tutorials/redis_metrics/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/redis_metrics/index.js rename to src/plugins/home/server/tutorials/redis_metrics/index.ts index 708c16e041acb..27c7780653168 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/redis_metrics/index.js +++ b/src/plugins/home/server/tutorials/redis_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function redisMetricsSpecProvider(context) { +export function redisMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'redis'; return { id: 'redisMetrics', - name: i18n.translate('kbn.server.tutorials.redisMetrics.nameTitle', { + name: i18n.translate('home.tutorials.redisMetrics.nameTitle', { defaultMessage: 'Redis metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.redisMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.redisMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from Redis.', }), - longDescription: i18n.translate('kbn.server.tutorials.redisMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.redisMetrics.longDescription', { defaultMessage: 'The `redis` Metricbeat module fetches internal metrics from the Redis server. \ [Learn more]({learnMoreLink}).', @@ -49,12 +53,9 @@ export function redisMetricsSpecProvider(context) { dashboards: [ { id: 'AV4YjZ5pux-M-tCAunxK-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.redisMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Redis metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.redisMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'Redis metrics dashboard', + }), isOverview: true, }, ], @@ -64,7 +65,7 @@ export function redisMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/redis_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/plugins/home/server/tutorials/register.ts b/src/plugins/home/server/tutorials/register.ts new file mode 100644 index 0000000000000..ae84f1e7ee1d5 --- /dev/null +++ b/src/plugins/home/server/tutorials/register.ts @@ -0,0 +1,159 @@ +/* + * 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 { systemLogsSpecProvider } from './system_logs'; +import { systemMetricsSpecProvider } from './system_metrics'; +import { apacheLogsSpecProvider } from './apache_logs'; +import { apacheMetricsSpecProvider } from './apache_metrics'; +import { elasticsearchLogsSpecProvider } from './elasticsearch_logs'; +import { iisLogsSpecProvider } from './iis_logs'; +import { kafkaLogsSpecProvider } from './kafka_logs'; +import { logstashLogsSpecProvider } from './logstash_logs'; +import { nginxLogsSpecProvider } from './nginx_logs'; +import { nginxMetricsSpecProvider } from './nginx_metrics'; +import { mysqlLogsSpecProvider } from './mysql_logs'; +import { mysqlMetricsSpecProvider } from './mysql_metrics'; +import { mongodbMetricsSpecProvider } from './mongodb_metrics'; +import { osqueryLogsSpecProvider } from './osquery_logs'; +import { phpfpmMetricsSpecProvider } from './php_fpm_metrics'; +import { postgresqlMetricsSpecProvider } from './postgresql_metrics'; +import { postgresqlLogsSpecProvider } from './postgresql_logs'; +import { rabbitmqMetricsSpecProvider } from './rabbitmq_metrics'; +import { redisLogsSpecProvider } from './redis_logs'; +import { redisMetricsSpecProvider } from './redis_metrics'; +import { suricataLogsSpecProvider } from './suricata_logs'; +import { dockerMetricsSpecProvider } from './docker_metrics'; +import { kubernetesMetricsSpecProvider } from './kubernetes_metrics'; +import { uwsgiMetricsSpecProvider } from './uwsgi_metrics'; +import { netflowSpecProvider } from './netflow'; +import { traefikLogsSpecProvider } from './traefik_logs'; +import { cephMetricsSpecProvider } from './ceph_metrics'; +import { aerospikeMetricsSpecProvider } from './aerospike_metrics'; +import { couchbaseMetricsSpecProvider } from './couchbase_metrics'; +import { dropwizardMetricsSpecProvider } from './dropwizard_metrics'; +import { elasticsearchMetricsSpecProvider } from './elasticsearch_metrics'; +import { etcdMetricsSpecProvider } from './etcd_metrics'; +import { haproxyMetricsSpecProvider } from './haproxy_metrics'; +import { kafkaMetricsSpecProvider } from './kafka_metrics'; +import { kibanaMetricsSpecProvider } from './kibana_metrics'; +import { memcachedMetricsSpecProvider } from './memcached_metrics'; +import { muninMetricsSpecProvider } from './munin_metrics'; +import { vSphereMetricsSpecProvider } from './vsphere_metrics'; +import { windowsMetricsSpecProvider } from './windows_metrics'; +import { windowsEventLogsSpecProvider } from './windows_event_logs'; +import { golangMetricsSpecProvider } from './golang_metrics'; +import { logstashMetricsSpecProvider } from './logstash_metrics'; +import { prometheusMetricsSpecProvider } from './prometheus_metrics'; +import { zookeeperMetricsSpecProvider } from './zookeeper_metrics'; +import { uptimeMonitorsSpecProvider } from './uptime_monitors'; +import { cloudwatchLogsSpecProvider } from './cloudwatch_logs'; +import { awsMetricsSpecProvider } from './aws_metrics'; +import { mssqlMetricsSpecProvider } from './mssql_metrics'; +import { natsMetricsSpecProvider } from './nats_metrics'; +import { natsLogsSpecProvider } from './nats_logs'; +import { zeekLogsSpecProvider } from './zeek_logs'; +import { corednsMetricsSpecProvider } from './coredns_metrics'; +import { corednsLogsSpecProvider } from './coredns_logs'; +import { auditbeatSpecProvider } from './auditbeat'; +import { iptablesLogsSpecProvider } from './iptables_logs'; +import { ciscoLogsSpecProvider } from './cisco_logs'; +import { envoyproxyLogsSpecProvider } from './envoyproxy_logs'; +import { couchdbMetricsSpecProvider } from './couchdb_metrics'; +import { consulMetricsSpecProvider } from './consul_metrics'; +import { cockroachdbMetricsSpecProvider } from './cockroachdb_metrics'; +import { traefikMetricsSpecProvider } from './traefik_metrics'; +import { awsLogsSpecProvider } from './aws_logs'; +import { activemqLogsSpecProvider } from './activemq_logs'; +import { activemqMetricsSpecProvider } from './activemq_metrics'; +import { azureMetricsSpecProvider } from './azure_metrics'; +import { ibmmqLogsSpecProvider } from './ibmmq_logs'; +import { stanMetricsSpecProvider } from './stan_metrics'; +import { envoyproxyMetricsSpecProvider } from './envoyproxy_metrics'; +import { ibmmqMetricsSpecProvider } from './ibmmq_metrics'; + +export const builtInTutorials = [ + systemLogsSpecProvider, + systemMetricsSpecProvider, + apacheLogsSpecProvider, + apacheMetricsSpecProvider, + elasticsearchLogsSpecProvider, + iisLogsSpecProvider, + kafkaLogsSpecProvider, + logstashLogsSpecProvider, + nginxLogsSpecProvider, + nginxMetricsSpecProvider, + mysqlLogsSpecProvider, + mysqlMetricsSpecProvider, + mongodbMetricsSpecProvider, + osqueryLogsSpecProvider, + phpfpmMetricsSpecProvider, + postgresqlMetricsSpecProvider, + postgresqlLogsSpecProvider, + rabbitmqMetricsSpecProvider, + redisLogsSpecProvider, + redisMetricsSpecProvider, + suricataLogsSpecProvider, + dockerMetricsSpecProvider, + kubernetesMetricsSpecProvider, + uwsgiMetricsSpecProvider, + netflowSpecProvider, + traefikLogsSpecProvider, + cephMetricsSpecProvider, + aerospikeMetricsSpecProvider, + couchbaseMetricsSpecProvider, + dropwizardMetricsSpecProvider, + elasticsearchMetricsSpecProvider, + etcdMetricsSpecProvider, + haproxyMetricsSpecProvider, + kafkaMetricsSpecProvider, + kibanaMetricsSpecProvider, + memcachedMetricsSpecProvider, + muninMetricsSpecProvider, + vSphereMetricsSpecProvider, + windowsMetricsSpecProvider, + windowsEventLogsSpecProvider, + golangMetricsSpecProvider, + logstashMetricsSpecProvider, + prometheusMetricsSpecProvider, + zookeeperMetricsSpecProvider, + uptimeMonitorsSpecProvider, + cloudwatchLogsSpecProvider, + awsMetricsSpecProvider, + mssqlMetricsSpecProvider, + natsMetricsSpecProvider, + natsLogsSpecProvider, + zeekLogsSpecProvider, + corednsMetricsSpecProvider, + corednsLogsSpecProvider, + auditbeatSpecProvider, + iptablesLogsSpecProvider, + ciscoLogsSpecProvider, + envoyproxyLogsSpecProvider, + couchdbMetricsSpecProvider, + consulMetricsSpecProvider, + cockroachdbMetricsSpecProvider, + traefikMetricsSpecProvider, + awsLogsSpecProvider, + activemqLogsSpecProvider, + activemqMetricsSpecProvider, + azureMetricsSpecProvider, + ibmmqLogsSpecProvider, + ibmmqMetricsSpecProvider, + stanMetricsSpecProvider, + envoyproxyMetricsSpecProvider, +]; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/stan_metrics/index.js b/src/plugins/home/server/tutorials/stan_metrics/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/stan_metrics/index.js rename to src/plugins/home/server/tutorials/stan_metrics/index.ts index 3f5817ce2890b..9f536e68acf72 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/stan_metrics/index.js +++ b/src/plugins/home/server/tutorials/stan_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function stanMetricsSpecProvider(context) { +export function stanMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'stan'; return { id: 'stanMetrics', - name: i18n.translate('kbn.server.tutorials.stanMetrics.nameTitle', { + name: i18n.translate('home.tutorials.stanMetrics.nameTitle', { defaultMessage: 'STAN metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.stanMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.stanMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from the STAN server.', }), - longDescription: i18n.translate('kbn.server.tutorials.stanMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.stanMetrics.longDescription', { defaultMessage: 'The `stan` Metricbeat module fetches monitoring metrics from STAN. \ [Learn more]({learnMoreLink}).', @@ -53,7 +57,7 @@ export function stanMetricsSpecProvider(context) { }, completionTimeMinutes: 10, // previewImagePath: '/plugins/kibana/home/tutorial_resources/stan_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/suricata_logs/index.js b/src/plugins/home/server/tutorials/suricata_logs/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/suricata_logs/index.js rename to src/plugins/home/server/tutorials/suricata_logs/index.ts index 3f2ecfa78d3b2..ac19cf0987b84 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/suricata_logs/index.js +++ b/src/plugins/home/server/tutorials/suricata_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function suricataLogsSpecProvider(context) { +export function suricataLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'suricata'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'suricataLogs', - name: i18n.translate('kbn.server.tutorials.suricataLogs.nameTitle', { + name: i18n.translate('home.tutorials.suricataLogs.nameTitle', { defaultMessage: 'Suricata logs', }), - category: TUTORIAL_CATEGORY.SIEM, - shortDescription: i18n.translate('kbn.server.tutorials.suricataLogs.shortDescription', { + category: TutorialsCategory.SIEM, + shortDescription: i18n.translate('home.tutorials.suricataLogs.shortDescription', { defaultMessage: 'Collect the result logs created by Suricata IDS/IPS/NSM.', }), - longDescription: i18n.translate('kbn.server.tutorials.suricataLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.suricataLogs.longDescription', { defaultMessage: 'The `suricata` Filebeat module collects the logs from the \ [Suricata Eve JSON output](https://suricata.readthedocs.io/en/latest/output/eve/eve-json-format.html). \ @@ -46,17 +50,14 @@ export function suricataLogsSpecProvider(context) { learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-suricata.html', }, }), - //euiIconType: 'logoSuricata', + // euiIconType: 'logoSuricata', artifacts: { dashboards: [ { id: '69f5ae20-eb02-11e7-8f04-51231daa5b05', - linkLabel: i18n.translate( - 'kbn.server.tutorials.suricataLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Suricata logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.suricataLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Suricata logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/system_logs/index.js b/src/plugins/home/server/tutorials/system_logs/index.ts similarity index 72% rename from src/legacy/core_plugins/kibana/server/tutorials/system_logs/index.js rename to src/plugins/home/server/tutorials/system_logs/index.ts index ec9792c3c4356..fc2fa4f49fd5f 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/system_logs/index.js +++ b/src/plugins/home/server/tutorials/system_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function systemLogsSpecProvider(context) { +export function systemLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'system'; - const platforms = ['OSX', 'DEB', 'RPM']; + const platforms = ['OSX', 'DEB', 'RPM'] as const; return { id: 'systemLogs', - name: i18n.translate('kbn.server.tutorials.systemLogs.nameTitle', { + name: i18n.translate('home.tutorials.systemLogs.nameTitle', { defaultMessage: 'System logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.systemLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.systemLogs.shortDescription', { defaultMessage: 'Collect and parse logs written by the local Syslog server.', }), - longDescription: i18n.translate('kbn.server.tutorials.systemLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.systemLogs.longDescription', { defaultMessage: 'The `system` Filebeat module collects and parses logs created by the system logging service of common \ Unix/Linux based distributions. This module is not available on Windows. \ @@ -50,12 +54,9 @@ Unix/Linux based distributions. This module is not available on Windows. \ dashboards: [ { id: 'Filebeat-syslog-dashboard-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.systemLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'System logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.systemLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'System logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/system_metrics/index.js b/src/plugins/home/server/tutorials/system_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/system_metrics/index.js rename to src/plugins/home/server/tutorials/system_metrics/index.ts index 1bebc78146f83..b0355e1118a96 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/system_metrics/index.js +++ b/src/plugins/home/server/tutorials/system_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function systemMetricsSpecProvider(context) { +export function systemMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'system'; return { id: 'systemMetrics', - name: i18n.translate('kbn.server.tutorials.systemMetrics.nameTitle', { + name: i18n.translate('home.tutorials.systemMetrics.nameTitle', { defaultMessage: 'System metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.systemMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.systemMetrics.shortDescription', { defaultMessage: 'Collect CPU, memory, network, and disk statistics from the host.', }), - longDescription: i18n.translate('kbn.server.tutorials.systemMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.systemMetrics.longDescription', { defaultMessage: 'The `system` Metricbeat module collects CPU, memory, network, and disk statistics from the host. \ It collects system wide statistics and statistics per process and filesystem. \ @@ -49,12 +53,9 @@ It collects system wide statistics and statistics per process and filesystem. \ dashboards: [ { id: 'Metricbeat-system-overview-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.systemMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'System metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.systemMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'System metrics dashboard', + }), isOverview: true, }, ], @@ -64,7 +65,7 @@ It collects system wide statistics and statistics per process and filesystem. \ }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/system_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/traefik_logs/index.js b/src/plugins/home/server/tutorials/traefik_logs/index.ts similarity index 69% rename from src/legacy/core_plugins/kibana/server/tutorials/traefik_logs/index.js rename to src/plugins/home/server/tutorials/traefik_logs/index.ts index 65f697a59ee82..423023a3902e5 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/traefik_logs/index.js +++ b/src/plugins/home/server/tutorials/traefik_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function traefikLogsSpecProvider(context) { +export function traefikLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'traefik'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS']; + const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { id: 'traefikLogs', - name: i18n.translate('kbn.server.tutorials.traefikLogs.nameTitle', { + name: i18n.translate('home.tutorials.traefikLogs.nameTitle', { defaultMessage: 'Traefik logs', }), - category: TUTORIAL_CATEGORY.LOGGING, - shortDescription: i18n.translate('kbn.server.tutorials.traefikLogs.shortDescription', { + category: TutorialsCategory.LOGGING, + shortDescription: i18n.translate('home.tutorials.traefikLogs.shortDescription', { defaultMessage: 'Collect and parse access logs created by the Traefik Proxy.', }), - longDescription: i18n.translate('kbn.server.tutorials.traefikLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.traefikLogs.longDescription', { defaultMessage: 'The `traefik` Filebeat module parses access logs created by Traefik. \ [Learn more]({learnMoreLink}).', @@ -45,17 +49,14 @@ export function traefikLogsSpecProvider(context) { learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-traefik.html', }, }), - //euiIconType: 'logoTraefik', + // euiIconType: 'logoTraefik', artifacts: { dashboards: [ { id: 'Filebeat-Traefik-Dashboard-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.traefikLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Traefik logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.traefikLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Traefik logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/traefik_metrics/index.js b/src/plugins/home/server/tutorials/traefik_metrics/index.ts similarity index 74% rename from src/legacy/core_plugins/kibana/server/tutorials/traefik_metrics/index.js rename to src/plugins/home/server/tutorials/traefik_metrics/index.ts index 1a4c043ebc706..8fe81eca4c601 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/traefik_metrics/index.js +++ b/src/plugins/home/server/tutorials/traefik_metrics/index.ts @@ -18,25 +18,26 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory, TutorialSchema } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types'; -export function traefikMetricsSpecProvider(server, context) { +export function traefikMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'traefik'; return { id: 'traefikMetrics', - name: i18n.translate('kbn.server.tutorials.traefikMetrics.nameTitle', { + name: i18n.translate('home.tutorials.traefikMetrics.nameTitle', { defaultMessage: 'Traefik metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.traefikMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.traefikMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from Traefik.', }), - longDescription: i18n.translate('kbn.server.tutorials.traefikMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.traefikMetrics.longDescription', { defaultMessage: 'The `traefik` Metricbeat module fetches monitoring metrics from Traefik. \ [Learn more]({learnMoreLink}).', @@ -53,7 +54,7 @@ export function traefikMetricsSpecProvider(server, context) { }, completionTimeMinutes: 10, // previewImagePath: '/plugins/kibana/home/tutorial_resources/traefik_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/uptime_monitors/index.js b/src/plugins/home/server/tutorials/uptime_monitors/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/uptime_monitors/index.js rename to src/plugins/home/server/tutorials/uptime_monitors/index.ts index 7cc90c740eb69..207bc0cb479be 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/uptime_monitors/index.js +++ b/src/plugins/home/server/tutorials/uptime_monitors/index.ts @@ -18,24 +18,28 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/heartbeat_instructions'; +} from '../instructions/heartbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function uptimeMonitorsSpecProvider(context) { +export function uptimeMonitorsSpecProvider(context: TutorialContext): TutorialSchema { return { id: 'uptimeMonitors', - name: i18n.translate('kbn.server.tutorials.uptimeMonitors.nameTitle', { + name: i18n.translate('home.tutorials.uptimeMonitors.nameTitle', { defaultMessage: 'Uptime Monitors', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.uptimeMonitors.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.uptimeMonitors.shortDescription', { defaultMessage: 'Monitor services for their availability', }), - longDescription: i18n.translate('kbn.server.tutorials.uptimeMonitors.longDescription', { + longDescription: i18n.translate('home.tutorials.uptimeMonitors.longDescription', { defaultMessage: 'Monitor services for their availability with active probing. \ Given a list of URLs, Heartbeat asks the simple question: Are you alive? \ @@ -49,12 +53,9 @@ export function uptimeMonitorsSpecProvider(context) { dashboards: [], application: { path: '/app/uptime', - label: i18n.translate( - 'kbn.server.tutorials.uptimeMonitors.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Uptime App', - } - ), + label: i18n.translate('home.tutorials.uptimeMonitors.artifacts.dashboards.linkLabel', { + defaultMessage: 'Uptime App', + }), }, exportedFields: { documentationUrl: '{config.docs.beats.heartbeat}/exported-fields.html', @@ -62,7 +63,7 @@ export function uptimeMonitorsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/uptime_monitors/screenshot.png', - onPrem: onPremInstructions(null, null, null, context), + onPrem: onPremInstructions([], context), elasticCloud: cloudInstructions(), onPremElasticCloud: onPremCloudInstructions(), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/uwsgi_metrics/index.js b/src/plugins/home/server/tutorials/uwsgi_metrics/index.ts similarity index 69% rename from src/legacy/core_plugins/kibana/server/tutorials/uwsgi_metrics/index.js rename to src/plugins/home/server/tutorials/uwsgi_metrics/index.ts index 8ec422f5b81d1..fc36cfe869867 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/uwsgi_metrics/index.js +++ b/src/plugins/home/server/tutorials/uwsgi_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function uwsgiMetricsSpecProvider(context) { +export function uwsgiMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'uwsgi'; return { id: 'uwsgiMetrics', - name: i18n.translate('kbn.server.tutorials.uwsgiMetrics.nameTitle', { + name: i18n.translate('home.tutorials.uwsgiMetrics.nameTitle', { defaultMessage: 'uWSGI metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.uwsgiMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.uwsgiMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from the uWSGI server.', }), - longDescription: i18n.translate('kbn.server.tutorials.uwsgiMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.uwsgiMetrics.longDescription', { defaultMessage: 'The `uwsgi` Metricbeat module fetches internal metrics from the uWSGI server. \ [Learn more]({learnMoreLink}).', @@ -44,18 +48,15 @@ export function uwsgiMetricsSpecProvider(context) { learnMoreLink: '{config.docs.beats.metricbeat}/metricbeat-module-uwsgi.html', }, }), - //euiIconType: 'logouWSGI', + // euiIconType: 'logouWSGI', isBeta: false, artifacts: { dashboards: [ { id: '32fca290-f0af-11e7-b9ff-9f96241065de-ecs', - linkLabel: i18n.translate( - 'kbn.server.tutorials.uwsgiMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'uWSGI metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.uwsgiMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'uWSGI metrics dashboard', + }), isOverview: true, }, ], @@ -65,7 +66,7 @@ export function uwsgiMetricsSpecProvider(context) { }, completionTimeMinutes: 10, previewImagePath: '/plugins/kibana/home/tutorial_resources/uwsgi_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/vsphere_metrics/index.js b/src/plugins/home/server/tutorials/vsphere_metrics/index.ts similarity index 67% rename from src/legacy/core_plugins/kibana/server/tutorials/vsphere_metrics/index.js rename to src/plugins/home/server/tutorials/vsphere_metrics/index.ts index dc3a13bde0c76..3ea57cdbc0e44 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/vsphere_metrics/index.js +++ b/src/plugins/home/server/tutorials/vsphere_metrics/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function vSphereMetricsSpecProvider(context) { +export function vSphereMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'vsphere'; return { id: 'vsphereMetrics', - name: i18n.translate('kbn.server.tutorials.vsphereMetrics.nameTitle', { + name: i18n.translate('home.tutorials.vsphereMetrics.nameTitle', { defaultMessage: 'vSphere metrics', }), - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.vsphereMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.vsphereMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from vSphere.', }), - longDescription: i18n.translate('kbn.server.tutorials.vsphereMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.vsphereMetrics.longDescription', { defaultMessage: 'The `vsphere` Metricbeat module fetches internal metrics from a vSphere cluster. \ [Learn more]({learnMoreLink}).', @@ -44,11 +48,11 @@ export function vSphereMetricsSpecProvider(context) { learnMoreLink: '{config.docs.beats.metricbeat}/metricbeat-module-vsphere.html', }, }), - //euiIconType: 'logoVSphere', + // euiIconType: 'logoVSphere', isBeta: true, artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.vsphereMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.vsphereMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,8 +63,8 @@ export function vSphereMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - //previewImagePath: '/plugins/kibana/home/tutorial_resources/vsphere_metrics/screenshot.png', - onPrem: onPremInstructions(moduleName, null, null, null, context), + // previewImagePath: '/plugins/kibana/home/tutorial_resources/vsphere_metrics/screenshot.png', + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/windows_event_logs/index.js b/src/plugins/home/server/tutorials/windows_event_logs/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/windows_event_logs/index.js rename to src/plugins/home/server/tutorials/windows_event_logs/index.ts index 272535ad3e4e1..5349bedb21279 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/windows_event_logs/index.js +++ b/src/plugins/home/server/tutorials/windows_event_logs/index.ts @@ -18,25 +18,29 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/winlogbeat_instructions'; +} from '../instructions/winlogbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function windowsEventLogsSpecProvider(context) { +export function windowsEventLogsSpecProvider(context: TutorialContext): TutorialSchema { return { id: 'windowsEventLogs', - name: i18n.translate('kbn.server.tutorials.windowsEventLogs.nameTitle', { + name: i18n.translate('home.tutorials.windowsEventLogs.nameTitle', { defaultMessage: 'Windows Event Log', }), isBeta: false, - category: TUTORIAL_CATEGORY.SIEM, - shortDescription: i18n.translate('kbn.server.tutorials.windowsEventLogs.shortDescription', { + category: TutorialsCategory.SIEM, + shortDescription: i18n.translate('home.tutorials.windowsEventLogs.shortDescription', { defaultMessage: 'Fetch logs from the Windows Event Log.', }), - longDescription: i18n.translate('kbn.server.tutorials.windowsEventLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.windowsEventLogs.longDescription', { defaultMessage: 'Use Winlogbeat to collect the logs from the Windows Event Log. \ [Learn more]({learnMoreLink}).', @@ -47,7 +51,7 @@ export function windowsEventLogsSpecProvider(context) { euiIconType: 'logoWindows', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.windowsEventLogs.artifacts.application.label', { + label: i18n.translate('home.tutorials.windowsEventLogs.artifacts.application.label', { defaultMessage: 'SIEM App', }), path: '/app/siem', @@ -58,7 +62,7 @@ export function windowsEventLogsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(null, null, null, context), + onPrem: onPremInstructions(context), elasticCloud: cloudInstructions(), onPremElasticCloud: onPremCloudInstructions(), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/windows_metrics/index.js b/src/plugins/home/server/tutorials/windows_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/windows_metrics/index.js rename to src/plugins/home/server/tutorials/windows_metrics/index.ts index 9f30c330f4ae1..fa855a82b3b77 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/windows_metrics/index.js +++ b/src/plugins/home/server/tutorials/windows_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function windowsMetricsSpecProvider(context) { +export function windowsMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'windows'; return { id: 'windowsMetrics', - name: i18n.translate('kbn.server.tutorials.windowsMetrics.nameTitle', { + name: i18n.translate('home.tutorials.windowsMetrics.nameTitle', { defaultMessage: 'Windows metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.windowsMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.windowsMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from Windows.', }), - longDescription: i18n.translate('kbn.server.tutorials.windowsMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.windowsMetrics.longDescription', { defaultMessage: 'The `windows` Metricbeat module fetches internal metrics from Windows. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function windowsMetricsSpecProvider(context) { euiIconType: 'logoWindows', artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.windowsMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.windowsMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function windowsMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/zeek_logs/index.js b/src/plugins/home/server/tutorials/zeek_logs/index.ts similarity index 70% rename from src/legacy/core_plugins/kibana/server/tutorials/zeek_logs/index.js rename to src/plugins/home/server/tutorials/zeek_logs/index.ts index 07d46c9c6ae84..c015545046c99 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/zeek_logs/index.js +++ b/src/plugins/home/server/tutorials/zeek_logs/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/filebeat_instructions'; +} from '../instructions/filebeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function zeekLogsSpecProvider(context) { +export function zeekLogsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'zeek'; - const platforms = ['OSX', 'DEB', 'RPM']; + const platforms = ['OSX', 'DEB', 'RPM'] as const; return { id: 'zeekLogs', - name: i18n.translate('kbn.server.tutorials.zeekLogs.nameTitle', { + name: i18n.translate('home.tutorials.zeekLogs.nameTitle', { defaultMessage: 'Zeek logs', }), - category: TUTORIAL_CATEGORY.SIEM, - shortDescription: i18n.translate('kbn.server.tutorials.zeekLogs.shortDescription', { + category: TutorialsCategory.SIEM, + shortDescription: i18n.translate('home.tutorials.zeekLogs.shortDescription', { defaultMessage: 'Collect the logs created by Zeek/Bro.', }), - longDescription: i18n.translate('kbn.server.tutorials.zeekLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.zeekLogs.longDescription', { defaultMessage: 'The `zeek` Filebeat module collects the logs from \ [Zeek](https://www.zeek.org//documentation/index.html). \ @@ -46,17 +50,14 @@ export function zeekLogsSpecProvider(context) { learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-zeek.html', }, }), - //TODO: euiIconType: 'logoZeek', + // TODO: euiIconType: 'logoZeek', artifacts: { dashboards: [ { id: '7cbb5410-3700-11e9-aa6d-ff445a78330c', - linkLabel: i18n.translate( - 'kbn.server.tutorials.zeekLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Zeek logs dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.zeekLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Zeek logs dashboard', + }), isOverview: true, }, ], diff --git a/src/legacy/core_plugins/kibana/server/tutorials/zookeeper_metrics/index.js b/src/plugins/home/server/tutorials/zookeeper_metrics/index.ts similarity index 71% rename from src/legacy/core_plugins/kibana/server/tutorials/zookeeper_metrics/index.js rename to src/plugins/home/server/tutorials/zookeeper_metrics/index.ts index 64b45759b3bca..dcecbb6d4a812 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/zookeeper_metrics/index.js +++ b/src/plugins/home/server/tutorials/zookeeper_metrics/index.ts @@ -18,26 +18,30 @@ */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../services/tutorials'; import { onPremInstructions, cloudInstructions, onPremCloudInstructions, -} from '../../../common/tutorials/metricbeat_instructions'; +} from '../instructions/metricbeat_instructions'; +import { + TutorialContext, + TutorialSchema, +} from '../../services/tutorials/lib/tutorials_registry_types'; -export function zookeeperMetricsSpecProvider(context) { +export function zookeeperMetricsSpecProvider(context: TutorialContext): TutorialSchema { const moduleName = 'zookeeper'; return { id: moduleName + 'Metrics', - name: i18n.translate('kbn.server.tutorials.zookeeperMetrics.nameTitle', { + name: i18n.translate('home.tutorials.zookeeperMetrics.nameTitle', { defaultMessage: 'Zookeeper metrics', }), isBeta: false, - category: TUTORIAL_CATEGORY.METRICS, - shortDescription: i18n.translate('kbn.server.tutorials.zookeeperMetrics.shortDescription', { + category: TutorialsCategory.METRICS, + shortDescription: i18n.translate('home.tutorials.zookeeperMetrics.shortDescription', { defaultMessage: 'Fetch internal metrics from a Zookeeper server.', }), - longDescription: i18n.translate('kbn.server.tutorials.zookeeperMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.zookeeperMetrics.longDescription', { defaultMessage: 'The `{moduleName}` Metricbeat module fetches internal metrics from a Zookeeper server. \ [Learn more]({learnMoreLink}).', @@ -48,7 +52,7 @@ export function zookeeperMetricsSpecProvider(context) { }), artifacts: { application: { - label: i18n.translate('kbn.server.tutorials.zookeeperMetrics.artifacts.application.label', { + label: i18n.translate('home.tutorials.zookeeperMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), path: '/app/kibana#/discover', @@ -59,7 +63,7 @@ export function zookeeperMetricsSpecProvider(context) { }, }, completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, null, null, null, context), + onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), }; diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 71e3bdd6c8c84..366d9408df793 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -5,7 +5,7 @@ "xpack.advancedUiActions": "plugins/advanced_ui_actions", "xpack.alerting": "legacy/plugins/alerting", "xpack.triggersActionsUI": "legacy/plugins/triggers_actions_ui", - "xpack.apm": "legacy/plugins/apm", + "xpack.apm": ["legacy/plugins/apm", "plugins/apm"], "xpack.beatsManagement": "legacy/plugins/beats_management", "xpack.canvas": "legacy/plugins/canvas", "xpack.crossClusterReplication": "legacy/plugins/cross_cluster_replication", diff --git a/x-pack/legacy/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts b/x-pack/legacy/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts index 562eb8850aa0c..fefaa30c8c36b 100644 --- a/x-pack/legacy/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts +++ b/x-pack/legacy/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ import { getInternalSavedObjectsClient } from '../helpers/saved_objects_client'; -import apmIndexPattern from '../../../../../../../src/legacy/core_plugins/kibana/server/tutorials/apm/index_pattern.json'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import apmIndexPattern from '../../../../../../plugins/apm/server/tutorial/index_pattern.json'; import { APM_STATIC_INDEX_PATTERN_ID } from '../../../common/index_pattern_constants'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SavedObjectsErrorHelpers } from '../../../../../../../src/core/server/saved_objects'; diff --git a/x-pack/legacy/plugins/maps/server/plugin.js b/x-pack/legacy/plugins/maps/server/plugin.js index 6009cea330ab0..d52a9f12ba631 100644 --- a/x-pack/legacy/plugins/maps/server/plugin.js +++ b/x-pack/legacy/plugins/maps/server/plugin.js @@ -10,6 +10,7 @@ import { getFlightsSavedObjects } from './sample_data/flights_saved_objects.js'; import { getWebLogsSavedObjects } from './sample_data/web_logs_saved_objects.js'; import { LICENSE_CHECK_STATE } from '../../../../plugins/licensing/server'; import { initRoutes } from './routes'; +import { emsBoundariesSpecProvider } from './tutorials/ems'; export class MapPlugin { setup(core, plugins, __LEGACY) { @@ -115,6 +116,13 @@ export class MapPlugin { isLayerTOCOpen: false, }, }); + + home.tutorials.registerTutorial( + emsBoundariesSpecProvider({ + prependBasePath: core.http.basePath.prepend, + emsLandingPageUrl: __LEGACY.mapConfig().emsLandingPageUrl, + }) + ); } __LEGACY.injectUiAppVars(APP_ID, async () => { diff --git a/src/legacy/core_plugins/kibana/server/tutorials/ems/index.js b/x-pack/legacy/plugins/maps/server/tutorials/ems/index.ts similarity index 51% rename from src/legacy/core_plugins/kibana/server/tutorials/ems/index.js rename to x-pack/legacy/plugins/maps/server/tutorials/ems/index.ts index 24293590299b1..88c22d01a527a 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/ems/index.js +++ b/x-pack/legacy/plugins/maps/server/tutorials/ems/index.ts @@ -1,41 +1,29 @@ /* - * 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. + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. */ import { i18n } from '@kbn/i18n'; -import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; +import { TutorialsCategory } from '../../../../../../../src/plugins/home/server'; -export function emsBoundariesSpecProvider(server) { - function addBasePath(url) { - const basePath = server.config().get('server.basePath'); - return `${basePath.length > 0 ? `${basePath}` : ''}${url}`; - } - - return { +export function emsBoundariesSpecProvider({ + emsLandingPageUrl, + prependBasePath, +}: { + emsLandingPageUrl: string; + prependBasePath: (path: string) => string; +}) { + return () => ({ id: 'emsBoundaries', - name: i18n.translate('kbn.server.tutorials.ems.nameTitle', { + name: i18n.translate('xpack.maps.tutorials.ems.nameTitle', { defaultMessage: 'EMS Boundaries', }), - category: TUTORIAL_CATEGORY.OTHER, - shortDescription: i18n.translate('kbn.server.tutorials.ems.shortDescription', { + category: TutorialsCategory.OTHER, + shortDescription: i18n.translate('xpack.maps.tutorials.ems.shortDescription', { defaultMessage: 'Administrative boundaries from Elastic Maps Service.', }), - longDescription: i18n.translate('kbn.server.tutorials.ems.longDescription', { + longDescription: i18n.translate('xpack.maps.tutorials.ems.longDescription', { defaultMessage: '[Elastic Maps Service (EMS)](https://www.elastic.co/elastic-maps-service) \ hosts tile layers and vector shapes of administrative boundaries. \ @@ -52,30 +40,30 @@ Indexing EMS administrative boundaries in Elasticsearch allows for search on bou id: 'EMS', instructions: [ { - title: i18n.translate('kbn.server.tutorials.ems.downloadStepTitle', { + title: i18n.translate('xpack.maps.tutorials.ems.downloadStepTitle', { defaultMessage: 'Download Elastic Maps Service boundaries', }), - textPre: i18n.translate('kbn.server.tutorials.ems.downloadStepText', { + textPre: i18n.translate('xpack.maps.tutorials.ems.downloadStepText', { defaultMessage: '1. Navigate to Elastic Maps Service [landing page]({emsLandingPageUrl}).\n\ 2. In the left sidebar, select an administrative boundary.\n\ 3. Click `Download GeoJSON` button.', values: { - emsLandingPageUrl: server.config().get('map.emsLandingPageUrl'), + emsLandingPageUrl, }, }), }, { - title: i18n.translate('kbn.server.tutorials.ems.uploadStepTitle', { + title: i18n.translate('xpack.maps.tutorials.ems.uploadStepTitle', { defaultMessage: 'Index Elastic Maps Service boundaries', }), - textPre: i18n.translate('kbn.server.tutorials.ems.uploadStepText', { + textPre: i18n.translate('xpack.maps.tutorials.ems.uploadStepText', { defaultMessage: '1. Open [Elastic Maps]({newMapUrl}).\n\ 2. Click `Add layer`, then select `Upload GeoJSON`.\n\ 3. Upload the GeoJSON file and click `Import file`.', values: { - newMapUrl: addBasePath('/app/maps#/map'), + newMapUrl: prependBasePath('/app/maps#/map'), }, }), }, @@ -85,5 +73,5 @@ Indexing EMS administrative boundaries in Elasticsearch allows for search on bou }, ], }, - }; + }); } diff --git a/x-pack/legacy/plugins/spaces/index.ts b/x-pack/legacy/plugins/spaces/index.ts index 934b44b4accaf..2e6b878794777 100644 --- a/x-pack/legacy/plugins/spaces/index.ts +++ b/x-pack/legacy/plugins/spaces/index.ts @@ -127,9 +127,6 @@ export const spaces = (kibana: Record) => kibanaIndex: config.get('kibana.index'), }, savedObjects: server.savedObjects, - tutorial: { - addScopedTutorialContextFactory: server.addScopedTutorialContextFactory, - }, auditLogger: { create: (pluginId: string) => new AuditLogger(server, pluginId, server.config(), server.plugins.xpack_main.info), diff --git a/x-pack/plugins/apm/kibana.json b/x-pack/plugins/apm/kibana.json index 40fee07742cf6..d60846131da74 100644 --- a/x-pack/plugins/apm/kibana.json +++ b/x-pack/plugins/apm/kibana.json @@ -5,5 +5,6 @@ "kibanaVersion": "kibana", "configPath": ["xpack", "apm"], "ui": false, - "requiredPlugins": ["apm_oss", "data", "home"] + "requiredPlugins": ["apm_oss", "data", "home"], + "optionalPlugins": ["cloud"] } diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index 11d91efdf6b01..83ece92aebe45 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -18,6 +18,9 @@ import { createApmAgentConfigurationIndex } from '../../../legacy/plugins/apm/se import { createApmApi } from '../../../legacy/plugins/apm/server/routes/create_apm_api'; import { getApmIndices } from '../../../legacy/plugins/apm/server/lib/settings/apm_indices/get_apm_indices'; import { APMConfig, mergeConfigs, APMXPackConfig } from '.'; +import { HomeServerPluginSetup } from '../../../../src/plugins/home/server'; +import { tutorialProvider } from './tutorial'; +import { CloudSetup } from '../../cloud/server'; export interface LegacySetup { server: Server; @@ -44,6 +47,8 @@ export class APMPlugin implements Plugin { core: CoreSetup, plugins: { apm_oss: APMOSSPlugin extends Plugin ? TSetup : never; + home: HomeServerPluginSetup; + cloud?: CloudSetup; } ) { const config$ = this.initContext.config.create(); @@ -68,6 +73,21 @@ export class APMPlugin implements Plugin { }); }); + plugins.home.tutorials.registerTutorial( + tutorialProvider({ + isEnabled: this.currentConfig['xpack.apm.ui.enabled'], + indexPatternTitle: this.currentConfig['apm_oss.indexPattern'], + cloud: plugins.cloud, + indices: { + errorIndices: this.currentConfig['apm_oss.errorIndices'], + metricsIndices: this.currentConfig['apm_oss.metricsIndices'], + onboardingIndices: this.currentConfig['apm_oss.onboardingIndices'], + sourcemapIndices: this.currentConfig['apm_oss.sourcemapIndices'], + transactionIndices: this.currentConfig['apm_oss.transactionIndices'], + }, + }) + ); + return { config$: mergedConfig$, registerLegacyAPI: once((__LEGACY: LegacySetup) => { diff --git a/src/legacy/core_plugins/kibana/server/tutorials/apm/envs/elastic_cloud.js b/x-pack/plugins/apm/server/tutorial/envs/elastic_cloud.ts similarity index 60% rename from src/legacy/core_plugins/kibana/server/tutorials/apm/envs/elastic_cloud.js rename to x-pack/plugins/apm/server/tutorial/envs/elastic_cloud.ts index 64698a54eed3c..9c66dd299b2a5 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/apm/envs/elastic_cloud.js +++ b/x-pack/plugins/apm/server/tutorial/envs/elastic_cloud.ts @@ -1,25 +1,11 @@ /* - * 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. + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. */ -import { get, has } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { INSTRUCTION_VARIANT } from '../../../../common/tutorials/instruction_variant'; +import { INSTRUCTION_VARIANT } from '../../../../../../src/plugins/home/server'; import { createNodeAgentInstructions, @@ -32,13 +18,10 @@ import { createJavaAgentInstructions, createDotNetAgentInstructions, } from '../instructions/apm_agent_instructions'; +import { CloudSetup } from '../../../../cloud/server'; -function getIfExists(obj, key) { - return has(obj, key) && get(obj, key); -} - -export function createElasticCloudInstructions(cloudSetup) { - const apmServerUrl = getIfExists(cloudSetup, 'apm.url'); +export function createElasticCloudInstructions(cloudSetup?: CloudSetup) { + const apmServerUrl = cloudSetup?.apm.url; const instructionSets = []; if (!apmServerUrl) { @@ -52,10 +35,10 @@ export function createElasticCloudInstructions(cloudSetup) { }; } -function getApmServerInstructionSet(cloudSetup) { - const cloudId = getIfExists(cloudSetup, 'cloudId'); +function getApmServerInstructionSet(cloudSetup?: CloudSetup) { + const cloudId = cloudSetup?.cloudId; return { - title: i18n.translate('kbn.server.tutorials.apm.apmServer.title', { + title: i18n.translate('xpack.apm.tutorial.apmServer.title', { defaultMessage: 'APM Server', }), instructionVariants: [ @@ -64,7 +47,7 @@ function getApmServerInstructionSet(cloudSetup) { instructions: [ { title: 'Enable the APM Server in the ESS console', - textPre: i18n.translate('kbn.server.tutorials.apm.elasticCloud.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.elasticCloud.textPre', { defaultMessage: 'To enable the APM Server go to [the Elastic Cloud console](https://cloud.elastic.co/deployments?q={cloudId}) and enable APM in the deployment settings. Once enabled, refresh this page.', values: { cloudId }, @@ -76,12 +59,12 @@ function getApmServerInstructionSet(cloudSetup) { }; } -function getApmAgentInstructionSet(cloudSetup) { - const apmServerUrl = getIfExists(cloudSetup, 'apm.url'); - const secretToken = getIfExists(cloudSetup, 'apm.secretToken'); +function getApmAgentInstructionSet(cloudSetup?: CloudSetup) { + const apmServerUrl = cloudSetup?.apm.url; + const secretToken = cloudSetup?.apm.secretToken; return { - title: i18n.translate('kbn.server.tutorials.apm.elasticCloudInstructions.title', { + title: i18n.translate('xpack.apm.tutorial.elasticCloudInstructions.title', { defaultMessage: 'APM Agents', }), instructionVariants: [ diff --git a/src/legacy/core_plugins/kibana/server/tutorials/apm/envs/on_prem.js b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts similarity index 65% rename from src/legacy/core_plugins/kibana/server/tutorials/apm/envs/on_prem.js rename to x-pack/plugins/apm/server/tutorial/envs/on_prem.ts index 4cbbbf89bf122..03cd21119b30b 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/apm/envs/on_prem.js +++ b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts @@ -1,24 +1,11 @@ /* - * 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. + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. */ import { i18n } from '@kbn/i18n'; -import { INSTRUCTION_VARIANT } from '../../../../common/tutorials/instruction_variant'; +import { INSTRUCTION_VARIANT } from '../../../../../../src/plugins/home/server'; import { createWindowsServerInstructions, createEditConfig, @@ -40,7 +27,19 @@ import { createDotNetAgentInstructions, } from '../instructions/apm_agent_instructions'; -export function onPremInstructions(config) { +export function onPremInstructions({ + errorIndices, + transactionIndices, + metricsIndices, + sourcemapIndices, + onboardingIndices, +}: { + errorIndices: string; + transactionIndices: string; + metricsIndices: string; + sourcemapIndices: string; + onboardingIndices: string; +}) { const EDIT_CONFIG = createEditConfig(); const START_SERVER_UNIX = createStartServerUnix(); const START_SERVER_UNIX_SYSV = createStartServerUnixSysv(); @@ -48,14 +47,14 @@ export function onPremInstructions(config) { return { instructionSets: [ { - title: i18n.translate('kbn.server.tutorials.apm.apmServer.title', { + title: i18n.translate('xpack.apm.tutorial.apmServer.title', { defaultMessage: 'APM Server', }), callOut: { - title: i18n.translate('kbn.server.tutorials.apm.apmServer.callOut.title', { + title: i18n.translate('xpack.apm.tutorial.apmServer.callOut.title', { defaultMessage: 'Important: Updating to 7.0 or higher', }), - message: i18n.translate('kbn.server.tutorials.apm.apmServer.callOut.message', { + message: i18n.translate('xpack.apm.tutorial.apmServer.callOut.message', { defaultMessage: `Please make sure your APM Server is updated to 7.0 or higher. \ You can also migrate your 6.x data with the migration assistant found in Kibana's management section.`, }), @@ -80,25 +79,25 @@ export function onPremInstructions(config) { }, ], statusCheck: { - title: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.title', { + title: i18n.translate('xpack.apm.tutorial.apmServer.statusCheck.title', { defaultMessage: 'APM Server status', }), - text: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.text', { + text: i18n.translate('xpack.apm.tutorial.apmServer.statusCheck.text', { defaultMessage: 'Make sure APM Server is running before you start implementing the APM agents.', }), - btnLabel: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.btnLabel', { + btnLabel: i18n.translate('xpack.apm.tutorial.apmServer.statusCheck.btnLabel', { defaultMessage: 'Check APM Server status', }), - success: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.successMessage', { + success: i18n.translate('xpack.apm.tutorial.apmServer.statusCheck.successMessage', { defaultMessage: 'You have correctly setup APM Server', }), - error: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.errorMessage', { + error: i18n.translate('xpack.apm.tutorial.apmServer.statusCheck.errorMessage', { defaultMessage: 'No APM Server detected. Please make sure it is running and you have updated to 7.0 or higher.', }), esHitsCheck: { - index: config.get('apm_oss.onboardingIndices'), + index: onboardingIndices, query: { bool: { filter: [ @@ -111,7 +110,7 @@ export function onPremInstructions(config) { }, }, { - title: i18n.translate('kbn.server.tutorials.apm.apmAgents.title', { + title: i18n.translate('xpack.apm.tutorial.apmAgents.title', { defaultMessage: 'APM Agents', }), instructionVariants: [ @@ -153,29 +152,24 @@ export function onPremInstructions(config) { }, ], statusCheck: { - title: i18n.translate('kbn.server.tutorials.apm.apmAgents.statusCheck.title', { + title: i18n.translate('xpack.apm.tutorial.apmAgents.statusCheck.title', { defaultMessage: 'Agent status', }), - text: i18n.translate('kbn.server.tutorials.apm.apmAgents.statusCheck.text', { + text: i18n.translate('xpack.apm.tutorial.apmAgents.statusCheck.text', { defaultMessage: 'Make sure your application is running and the agents are sending data.', }), - btnLabel: i18n.translate('kbn.server.tutorials.apm.apmAgents.statusCheck.btnLabel', { + btnLabel: i18n.translate('xpack.apm.tutorial.apmAgents.statusCheck.btnLabel', { defaultMessage: 'Check agent status', }), - success: i18n.translate('kbn.server.tutorials.apm.apmAgents.statusCheck.successMessage', { + success: i18n.translate('xpack.apm.tutorial.apmAgents.statusCheck.successMessage', { defaultMessage: 'Data successfully received from one or more agents', }), - error: i18n.translate('kbn.server.tutorials.apm.apmAgents.statusCheck.errorMessage', { + error: i18n.translate('xpack.apm.tutorial.apmAgents.statusCheck.errorMessage', { defaultMessage: 'No data has been received from agents yet', }), esHitsCheck: { - index: [ - config.get('apm_oss.errorIndices'), - config.get('apm_oss.transactionIndices'), - config.get('apm_oss.metricsIndices'), - config.get('apm_oss.sourcemapIndices'), - ], + index: [errorIndices, transactionIndices, metricsIndices, sourcemapIndices], query: { bool: { filter: [ diff --git a/x-pack/plugins/apm/server/tutorial/index.ts b/x-pack/plugins/apm/server/tutorial/index.ts new file mode 100644 index 0000000000000..bb5d553b26b36 --- /dev/null +++ b/x-pack/plugins/apm/server/tutorial/index.ts @@ -0,0 +1,100 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; +import { onPremInstructions } from './envs/on_prem'; +import { createElasticCloudInstructions } from './envs/elastic_cloud'; +import apmIndexPattern from './index_pattern.json'; +import { CloudSetup } from '../../../cloud/server'; +import { ArtifactsSchema, TutorialsCategory } from '../../../../../src/plugins/home/server'; + +const apmIntro = i18n.translate('xpack.apm.tutorial.introduction', { + defaultMessage: 'Collect in-depth performance metrics and errors from inside your applications.', +}); + +export const tutorialProvider = ({ + isEnabled, + indexPatternTitle, + cloud, + indices, +}: { + isEnabled: boolean; + indexPatternTitle: string; + cloud?: CloudSetup; + indices: { + errorIndices: string; + transactionIndices: string; + metricsIndices: string; + sourcemapIndices: string; + onboardingIndices: string; + }; +}) => () => { + const savedObjects = [ + { + ...apmIndexPattern, + attributes: { + ...apmIndexPattern.attributes, + title: indexPatternTitle, + }, + }, + ]; + + const artifacts: ArtifactsSchema = { + dashboards: [ + { + id: '8d3ed660-7828-11e7-8c47-65b845b5cfb3', + linkLabel: i18n.translate( + 'xpack.apm.tutorial.specProvider.artifacts.dashboards.linkLabel', + { + defaultMessage: 'APM dashboard', + } + ), + isOverview: true, + }, + ], + }; + + if (isEnabled) { + artifacts.application = { + path: '/app/apm', + label: i18n.translate('xpack.apm.tutorial.specProvider.artifacts.application.label', { + defaultMessage: 'Launch APM', + }), + }; + } + + return { + id: 'apm', + name: i18n.translate('xpack.apm.tutorial.specProvider.name', { + defaultMessage: 'APM', + }), + category: TutorialsCategory.OTHER, + shortDescription: apmIntro, + longDescription: i18n.translate('xpack.apm.tutorial.specProvider.longDescription', { + defaultMessage: + 'Application Performance Monitoring (APM) collects in-depth \ +performance metrics and errors from inside your application. \ +It allows you to monitor the performance of thousands of applications in real time. \ +[Learn more]({learnMoreLink}).', + values: { + learnMoreLink: + '{config.docs.base_url}guide/en/apm/get-started/{config.docs.version}/index.html', + }, + }), + euiIconType: 'logoAPM', + artifacts, + onPrem: onPremInstructions(indices), + elasticCloud: createElasticCloudInstructions(cloud), + previewImagePath: '/plugins/kibana/home/tutorial_resources/apm/apm.png', + savedObjects, + savedObjectsInstallMsg: i18n.translate( + 'xpack.apm.tutorial.specProvider.savedObjectsInstallMsg', + { + defaultMessage: 'An APM index pattern is required for some features in the APM UI.', + } + ), + }; +}; diff --git a/src/legacy/core_plugins/kibana/server/tutorials/apm/index_pattern.json b/x-pack/plugins/apm/server/tutorial/index_pattern.json similarity index 100% rename from src/legacy/core_plugins/kibana/server/tutorials/apm/index_pattern.json rename to x-pack/plugins/apm/server/tutorial/index_pattern.json diff --git a/src/legacy/core_plugins/kibana/server/tutorials/apm/instructions/apm_agent_instructions.js b/x-pack/plugins/apm/server/tutorial/instructions/apm_agent_instructions.ts similarity index 65% rename from src/legacy/core_plugins/kibana/server/tutorials/apm/instructions/apm_agent_instructions.js rename to x-pack/plugins/apm/server/tutorial/instructions/apm_agent_instructions.ts index b47793a1610fd..d1ef92df20f6f 100644 --- a/src/legacy/core_plugins/kibana/server/tutorials/apm/instructions/apm_agent_instructions.js +++ b/x-pack/plugins/apm/server/tutorial/instructions/apm_agent_instructions.ts @@ -1,67 +1,51 @@ /* - * 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. + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. */ import { i18n } from '@kbn/i18n'; export const createNodeAgentInstructions = (apmServerUrl = '', secretToken = '') => [ { - title: i18n.translate('kbn.server.tutorials.apm.nodeClient.install.title', { + title: i18n.translate('xpack.apm.tutorial.nodeClient.install.title', { defaultMessage: 'Install the APM agent', }), - textPre: i18n.translate('kbn.server.tutorials.apm.nodeClient.install.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.nodeClient.install.textPre', { defaultMessage: 'Install the APM agent for Node.js as a dependency to your application.', }), commands: ['npm install elastic-apm-node --save'], }, { - title: i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.title', { + title: i18n.translate('xpack.apm.tutorial.nodeClient.configure.title', { defaultMessage: 'Configure the agent', }), - textPre: i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.nodeClient.configure.textPre', { defaultMessage: 'Agents are libraries that run inside of your application process. \ APM services are created programmatically based on the `serviceName`. \ This agent supports a vararity of frameworks but can also be used with your custom stack.', }), commands: `// ${i18n.translate( - 'kbn.server.tutorials.apm.nodeClient.configure.commands.addThisToTheFileTopComment', + 'xpack.apm.tutorial.nodeClient.configure.commands.addThisToTheFileTopComment', { defaultMessage: 'Add this to the VERY top of the first file loaded in your app', } )} var apm = require('elastic-apm-node').start({curlyOpen} // ${i18n.translate( - 'kbn.server.tutorials.apm.nodeClient.configure.commands.setRequiredServiceNameComment', + 'xpack.apm.tutorial.nodeClient.configure.commands.setRequiredServiceNameComment', { defaultMessage: 'Override service name from package.json', } )} - // ${i18n.translate( - 'kbn.server.tutorials.apm.nodeClient.configure.commands.allowedCharactersComment', - { - defaultMessage: 'Allowed characters: a-z, A-Z, 0-9, -, _, and space', - } - )} + // ${i18n.translate('xpack.apm.tutorial.nodeClient.configure.commands.allowedCharactersComment', { + defaultMessage: 'Allowed characters: a-z, A-Z, 0-9, -, _, and space', + })} serviceName: '', // ${i18n.translate( - 'kbn.server.tutorials.apm.nodeClient.configure.commands.useIfApmRequiresTokenComment', + 'xpack.apm.tutorial.nodeClient.configure.commands.useIfApmRequiresTokenComment', { defaultMessage: 'Use if APM Server requires a token', } @@ -69,7 +53,7 @@ var apm = require('elastic-apm-node').start({curlyOpen} secretToken: '${secretToken}', // ${i18n.translate( - 'kbn.server.tutorials.apm.nodeClient.configure.commands.setCustomApmServerUrlComment', + 'xpack.apm.tutorial.nodeClient.configure.commands.setCustomApmServerUrlComment', { defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', values: { defaultApmServerUrl: 'http://localhost:8200' }, @@ -77,7 +61,7 @@ var apm = require('elastic-apm-node').start({curlyOpen} )} serverUrl: '${apmServerUrl}' {curlyClose})`.split('\n'), - textPost: i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.textPost', { + textPost: i18n.translate('xpack.apm.tutorial.nodeClient.configure.textPost', { defaultMessage: 'See [the documentation]({documentationLink}) for advanced usage, including how to use with \ [Babel/ES Modules]({babelEsModulesLink}).', @@ -92,25 +76,25 @@ var apm = require('elastic-apm-node').start({curlyOpen} export const createDjangoAgentInstructions = (apmServerUrl = '', secretToken = '') => [ { - title: i18n.translate('kbn.server.tutorials.apm.djangoClient.install.title', { + title: i18n.translate('xpack.apm.tutorial.djangoClient.install.title', { defaultMessage: 'Install the APM agent', }), - textPre: i18n.translate('kbn.server.tutorials.apm.djangoClient.install.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.djangoClient.install.textPre', { defaultMessage: 'Install the APM agent for Python as a dependency.', }), commands: ['$ pip install elastic-apm'], }, { - title: i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.title', { + title: i18n.translate('xpack.apm.tutorial.djangoClient.configure.title', { defaultMessage: 'Configure the agent', }), - textPre: i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.djangoClient.configure.textPre', { defaultMessage: 'Agents are libraries that run inside of your application process. \ APM services are created programmatically based on the `SERVICE_NAME`.', }), commands: `# ${i18n.translate( - 'kbn.server.tutorials.apm.djangoClient.configure.commands.addAgentComment', + 'xpack.apm.tutorial.djangoClient.configure.commands.addAgentComment', { defaultMessage: 'Add the agent to the installed apps', } @@ -122,13 +106,13 @@ INSTALLED_APPS = ( ELASTIC_APM = {curlyOpen} # ${i18n.translate( - 'kbn.server.tutorials.apm.djangoClient.configure.commands.setRequiredServiceNameComment', + 'xpack.apm.tutorial.djangoClient.configure.commands.setRequiredServiceNameComment', { defaultMessage: 'Set required service name. Allowed characters:', } )} # ${i18n.translate( - 'kbn.server.tutorials.apm.djangoClient.configure.commands.allowedCharactersComment', + 'xpack.apm.tutorial.djangoClient.configure.commands.allowedCharactersComment', { defaultMessage: 'a-z, A-Z, 0-9, -, _, and space', } @@ -136,7 +120,7 @@ ELASTIC_APM = {curlyOpen} 'SERVICE_NAME': '', # ${i18n.translate( - 'kbn.server.tutorials.apm.djangoClient.configure.commands.useIfApmServerRequiresTokenComment', + 'xpack.apm.tutorial.djangoClient.configure.commands.useIfApmServerRequiresTokenComment', { defaultMessage: 'Use if APM Server requires a token', } @@ -144,7 +128,7 @@ ELASTIC_APM = {curlyOpen} 'SECRET_TOKEN': '${secretToken}', # ${i18n.translate( - 'kbn.server.tutorials.apm.djangoClient.configure.commands.setCustomApmServerUrlComment', + 'xpack.apm.tutorial.djangoClient.configure.commands.setCustomApmServerUrlComment', { defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', values: { defaultApmServerUrl: 'http://localhost:8200' }, @@ -154,7 +138,7 @@ ELASTIC_APM = {curlyOpen} {curlyClose} # ${i18n.translate( - 'kbn.server.tutorials.apm.djangoClient.configure.commands.addTracingMiddlewareComment', + 'xpack.apm.tutorial.djangoClient.configure.commands.addTracingMiddlewareComment', { defaultMessage: 'To send performance metrics, add our tracing middleware:', } @@ -163,7 +147,7 @@ MIDDLEWARE = ( 'elasticapm.contrib.django.middleware.TracingMiddleware', #... )`.split('\n'), - textPost: i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.textPost', { + textPost: i18n.translate('xpack.apm.tutorial.djangoClient.configure.textPost', { defaultMessage: 'See the [documentation]({documentationLink}) for advanced usage.', values: { documentationLink: @@ -175,25 +159,25 @@ MIDDLEWARE = ( export const createFlaskAgentInstructions = (apmServerUrl = '', secretToken = '') => [ { - title: i18n.translate('kbn.server.tutorials.apm.flaskClient.install.title', { + title: i18n.translate('xpack.apm.tutorial.flaskClient.install.title', { defaultMessage: 'Install the APM agent', }), - textPre: i18n.translate('kbn.server.tutorials.apm.flaskClient.install.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.flaskClient.install.textPre', { defaultMessage: 'Install the APM agent for Python as a dependency.', }), commands: ['$ pip install elastic-apm[flask]'], }, { - title: i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.title', { + title: i18n.translate('xpack.apm.tutorial.flaskClient.configure.title', { defaultMessage: 'Configure the agent', }), - textPre: i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.flaskClient.configure.textPre', { defaultMessage: 'Agents are libraries that run inside of your application process. \ APM services are created programmatically based on the `SERVICE_NAME`.', }), commands: `# ${i18n.translate( - 'kbn.server.tutorials.apm.flaskClient.configure.commands.initializeUsingEnvironmentVariablesComment', + 'xpack.apm.tutorial.flaskClient.configure.commands.initializeUsingEnvironmentVariablesComment', { defaultMessage: 'initialize using environment variables', } @@ -202,30 +186,24 @@ from elasticapm.contrib.flask import ElasticAPM app = Flask(__name__) apm = ElasticAPM(app) -# ${i18n.translate( - 'kbn.server.tutorials.apm.flaskClient.configure.commands.configureElasticApmComment', - { - defaultMessage: "or configure to use ELASTIC_APM in your application's settings", - } - )} +# ${i18n.translate('xpack.apm.tutorial.flaskClient.configure.commands.configureElasticApmComment', { + defaultMessage: "or configure to use ELASTIC_APM in your application's settings", + })} from elasticapm.contrib.flask import ElasticAPM app.config['ELASTIC_APM'] = {curlyOpen} # ${i18n.translate( - 'kbn.server.tutorials.apm.flaskClient.configure.commands.setRequiredServiceNameComment', + 'xpack.apm.tutorial.flaskClient.configure.commands.setRequiredServiceNameComment', { defaultMessage: 'Set required service name. Allowed characters:', } )} - # ${i18n.translate( - 'kbn.server.tutorials.apm.flaskClient.configure.commands.allowedCharactersComment', - { - defaultMessage: 'a-z, A-Z, 0-9, -, _, and space', - } - )} + # ${i18n.translate('xpack.apm.tutorial.flaskClient.configure.commands.allowedCharactersComment', { + defaultMessage: 'a-z, A-Z, 0-9, -, _, and space', + })} 'SERVICE_NAME': '', # ${i18n.translate( - 'kbn.server.tutorials.apm.flaskClient.configure.commands.useIfApmServerRequiresTokenComment', + 'xpack.apm.tutorial.flaskClient.configure.commands.useIfApmServerRequiresTokenComment', { defaultMessage: 'Use if APM Server requires a token', } @@ -233,7 +211,7 @@ app.config['ELASTIC_APM'] = {curlyOpen} 'SECRET_TOKEN': '${secretToken}', # ${i18n.translate( - 'kbn.server.tutorials.apm.flaskClient.configure.commands.setCustomApmServerUrlComment', + 'xpack.apm.tutorial.flaskClient.configure.commands.setCustomApmServerUrlComment', { defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', values: { defaultApmServerUrl: 'http://localhost:8200' }, @@ -243,7 +221,7 @@ app.config['ELASTIC_APM'] = {curlyOpen} {curlyClose} apm = ElasticAPM(app)`.split('\n'), - textPost: i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.textPost', { + textPost: i18n.translate('xpack.apm.tutorial.flaskClient.configure.textPost', { defaultMessage: 'See the [documentation]({documentationLink}) for advanced usage.', values: { documentationLink: @@ -255,19 +233,19 @@ apm = ElasticAPM(app)`.split('\n'), export const createRailsAgentInstructions = (apmServerUrl = '', secretToken = '') => [ { - title: i18n.translate('kbn.server.tutorials.apm.railsClient.install.title', { + title: i18n.translate('xpack.apm.tutorial.railsClient.install.title', { defaultMessage: 'Install the APM agent', }), - textPre: i18n.translate('kbn.server.tutorials.apm.railsClient.install.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.railsClient.install.textPre', { defaultMessage: 'Add the agent to your Gemfile.', }), commands: [`gem 'elastic-apm'`], }, { - title: i18n.translate('kbn.server.tutorials.apm.railsClient.configure.title', { + title: i18n.translate('xpack.apm.tutorial.railsClient.configure.title', { defaultMessage: 'Configure the agent', }), - textPre: i18n.translate('kbn.server.tutorials.apm.railsClient.configure.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.railsClient.configure.textPre', { defaultMessage: 'APM is automatically started when your app boots. Configure the agent, by creating the config file {configFile}', values: { configFile: '`config/elastic_apm.yml`' }, @@ -283,7 +261,7 @@ export const createRailsAgentInstructions = (apmServerUrl = '', secretToken = '' # Set custom APM Server URL (default: http://localhost:8200) # server_url: '${apmServerUrl || 'http://localhost:8200'}'`.split('\n'), - textPost: i18n.translate('kbn.server.tutorials.apm.railsClient.configure.textPost', { + textPost: i18n.translate('xpack.apm.tutorial.railsClient.configure.textPost', { defaultMessage: 'See the [documentation]({documentationLink}) for configuration options and advanced usage.\n\n', values: { @@ -295,19 +273,19 @@ export const createRailsAgentInstructions = (apmServerUrl = '', secretToken = '' export const createRackAgentInstructions = (apmServerUrl = '', secretToken = '') => [ { - title: i18n.translate('kbn.server.tutorials.apm.rackClient.install.title', { + title: i18n.translate('xpack.apm.tutorial.rackClient.install.title', { defaultMessage: 'Install the APM agent', }), - textPre: i18n.translate('kbn.server.tutorials.apm.rackClient.install.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.rackClient.install.textPre', { defaultMessage: 'Add the agent to your Gemfile.', }), commands: [`gem 'elastic-apm'`], }, { - title: i18n.translate('kbn.server.tutorials.apm.rackClient.configure.title', { + title: i18n.translate('xpack.apm.tutorial.rackClient.configure.title', { defaultMessage: 'Configure the agent', }), - textPre: i18n.translate('kbn.server.tutorials.apm.rackClient.configure.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.rackClient.configure.textPre', { defaultMessage: 'For Rack or a compatible framework (e.g. Sinatra), include the middleware in your app and start the agent.', }), @@ -322,13 +300,13 @@ export const createRackAgentInstructions = (apmServerUrl = '', secretToken = '') ElasticAPM.start( app: MySinatraApp, # ${i18n.translate( - 'kbn.server.tutorials.apm.rackClient.configure.commands.requiredComment', + 'xpack.apm.tutorial.rackClient.configure.commands.requiredComment', { defaultMessage: 'required', } )} config_file: '' # ${i18n.translate( - 'kbn.server.tutorials.apm.rackClient.configure.commands.optionalComment', + 'xpack.apm.tutorial.rackClient.configure.commands.optionalComment', { defaultMessage: 'optional, defaults to config/elastic_apm.yml', } @@ -340,23 +318,20 @@ export const createRackAgentInstructions = (apmServerUrl = '', secretToken = '') at_exit {curlyOpen} ElasticAPM.stop {curlyClose}`.split('\n'), }, { - title: i18n.translate('kbn.server.tutorials.apm.rackClient.createConfig.title', { + title: i18n.translate('xpack.apm.tutorial.rackClient.createConfig.title', { defaultMessage: 'Create config file', }), - textPre: i18n.translate('kbn.server.tutorials.apm.rackClient.createConfig.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.rackClient.createConfig.textPre', { defaultMessage: 'Create a config file {configFile}:', values: { configFile: '`config/elastic_apm.yml`' }, }), commands: `# config/elastic_apm.yml: +# ${i18n.translate('xpack.apm.tutorial.rackClient.createConfig.commands.setServiceNameComment', { + defaultMessage: 'Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space', + })} # ${i18n.translate( - 'kbn.server.tutorials.apm.rackClient.createConfig.commands.setServiceNameComment', - { - defaultMessage: 'Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space', - } - )} -# ${i18n.translate( - 'kbn.server.tutorials.apm.rackClient.createConfig.commands.defaultsToTheNameOfRackAppClassComment', + 'xpack.apm.tutorial.rackClient.createConfig.commands.defaultsToTheNameOfRackAppClassComment', { defaultMessage: "Defaults to the name of your Rack app's class.", } @@ -364,7 +339,7 @@ export const createRackAgentInstructions = (apmServerUrl = '', secretToken = '') # service_name: 'my-service' # ${i18n.translate( - 'kbn.server.tutorials.apm.rackClient.createConfig.commands.useIfApmServerRequiresTokenComment', + 'xpack.apm.tutorial.rackClient.createConfig.commands.useIfApmServerRequiresTokenComment', { defaultMessage: 'Use if APM Server requires a token', } @@ -372,14 +347,14 @@ export const createRackAgentInstructions = (apmServerUrl = '', secretToken = '') # secret_token: '${secretToken}' # ${i18n.translate( - 'kbn.server.tutorials.apm.rackClient.createConfig.commands.setCustomApmServerComment', + 'xpack.apm.tutorial.rackClient.createConfig.commands.setCustomApmServerComment', { defaultMessage: 'Set custom APM Server URL (default: {defaultServerUrl})', values: { defaultServerUrl: 'http://localhost:8200' }, } )} # server_url: '${apmServerUrl || 'http://localhost:8200'}'`.split('\n'), - textPost: i18n.translate('kbn.server.tutorials.apm.rackClient.createConfig.textPost', { + textPost: i18n.translate('xpack.apm.tutorial.rackClient.createConfig.textPost', { defaultMessage: 'See the [documentation]({documentationLink}) for configuration options and advanced usage.\n\n', values: { @@ -391,10 +366,10 @@ export const createRackAgentInstructions = (apmServerUrl = '', secretToken = '') export const createJsAgentInstructions = (apmServerUrl = '') => [ { - title: i18n.translate('kbn.server.tutorials.apm.jsClient.enableRealUserMonitoring.title', { + title: i18n.translate('xpack.apm.tutorial.jsClient.enableRealUserMonitoring.title', { defaultMessage: 'Enable Real User Monitoring support in APM server', }), - textPre: i18n.translate('kbn.server.tutorials.apm.jsClient.enableRealUserMonitoring.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.jsClient.enableRealUserMonitoring.textPre', { defaultMessage: 'APM Server disables RUM support by default. See the [documentation]({documentationLink}) \ for details on how to enable RUM support.', @@ -405,10 +380,10 @@ for details on how to enable RUM support.', }), }, { - title: i18n.translate('kbn.server.tutorials.apm.jsClient.installDependency.title', { + title: i18n.translate('xpack.apm.tutorial.jsClient.installDependency.title', { defaultMessage: 'Set up the Agent as a dependency', }), - textPre: i18n.translate('kbn.server.tutorials.apm.jsClient.installDependency.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.jsClient.installDependency.textPre', { defaultMessage: 'You can install the Agent as a dependency to your application with \ `npm install @elastic/apm-rum --save`.\n\n\ @@ -418,7 +393,7 @@ The Agent can then be initialized and configured in your application like this:' var apm = initApm({curlyOpen} // ${i18n.translate( - 'kbn.server.tutorials.apm.jsClient.installDependency.commands.setRequiredServiceNameComment', + 'xpack.apm.tutorial.jsClient.installDependency.commands.setRequiredServiceNameComment', { defaultMessage: 'Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)', @@ -427,7 +402,7 @@ var apm = initApm({curlyOpen} serviceName: 'your-app-name', // ${i18n.translate( - 'kbn.server.tutorials.apm.jsClient.installDependency.commands.setCustomApmServerUrlComment', + 'xpack.apm.tutorial.jsClient.installDependency.commands.setCustomApmServerUrlComment', { defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', values: { defaultApmServerUrl: 'http://localhost:8200' }, @@ -436,14 +411,14 @@ var apm = initApm({curlyOpen} serverUrl: '${apmServerUrl}', // ${i18n.translate( - 'kbn.server.tutorials.apm.jsClient.installDependency.commands.setServiceVersionComment', + 'xpack.apm.tutorial.jsClient.installDependency.commands.setServiceVersionComment', { defaultMessage: 'Set service version (required for source map feature)', } )} serviceVersion: '' {curlyClose})`.split('\n'), - textPost: i18n.translate('kbn.server.tutorials.apm.jsClient.installDependency.textPost', { + textPost: i18n.translate('xpack.apm.tutorial.jsClient.installDependency.textPost', { defaultMessage: 'Framework integrations, like React or Angular, have custom dependencies. \ See the [integration documentation]({docLink}) for more information.', @@ -454,10 +429,10 @@ See the [integration documentation]({docLink}) for more information.', }), }, { - title: i18n.translate('kbn.server.tutorials.apm.jsClient.scriptTags.title', { + title: i18n.translate('xpack.apm.tutorial.jsClient.scriptTags.title', { defaultMessage: 'Set up the Agent with Script Tags', }), - textPre: i18n.translate('kbn.server.tutorials.apm.jsClient.scriptTags.textPre', { + textPre: i18n.translate('xpack.apm.tutorial.jsClient.scriptTags.textPre', { defaultMessage: "Alternatively, you can use Script tags to set up and configure the Agent. \ Add a `