Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: [Kibana Platform Migrations: Home Plugin ] kibana server tutorials api #50442

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/legacy/core_plugins/kibana/public/home/load_tutorials.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,43 @@ import { getServices } from './kibana_services';
import { i18n } from '@kbn/i18n';

const baseUrl = getServices().addBasePath('/api/kibana/home/tutorials');
const baseUrlNP = getServices().addBasePath('/api/kibana/home/NP_tutorials');
const headers = new Headers();
headers.append('Accept', 'application/json');
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 response = await fetch(baseUrl, {
const responseLegacyPlatform = await fetch(baseUrl, {
method: 'get',
credentials: 'include',
headers: headers,
});
if (response.status >= 300) {
const responseNewPlatform = await fetch(baseUrlNP, {
method: 'get',
credentials: 'include',
headers: headers,
});
if (responseLegacyPlatform.status >= 300) {
throw new Error(i18n.translate('kbn.home.loadTutorials.requestFailedErrorMessage', {
defaultMessage: 'Request failed with status code: {status}', values: { status: responseLegacyPlatform.status } }
));
}
if (responseNewPlatform.status >= 300) {
throw new Error(i18n.translate('kbn.home.loadTutorials.requestFailedErrorMessage', {
defaultMessage: 'Request failed with status code: {status}', values: { status: response.status } }
defaultMessage: 'Request failed with status code: {status}', values: { status: responseNewPlatform.status } }
));
}

tutorials = await response.json();
tutorialsLegacyPlatform = await responseLegacyPlatform.json();
tutorialsNewPlatform = await responseNewPlatform.json();
tutorials = tutorialsLegacyPlatform.concat(tutorialsNewPlatform);
tutorialsLoaded = true;
} catch(err) {
getServices().toastNotifications.addDanger({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function aerospikeMetricsSpecProvider(server, context) {
export function aerospikeMetricsSpecProvider(context) {
const moduleName = 'aerospike';
return {
id: 'aerospikeMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/filebeat_instructions';

export function apacheLogsSpecProvider(server, context) {
export function apacheLogsSpecProvider(context) {
const moduleName = 'apache';
const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'];
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function apacheMetricsSpecProvider(server, context) {
export function apacheMetricsSpecProvider(context) {
const moduleName = 'apache';
return {
id: 'apacheMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
onPremCloudInstructions,
} from '../../../common/tutorials/auditbeat_instructions';

export function auditbeatSpecProvider(server, context) {
export function auditbeatSpecProvider(context) {
const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'];
return {
id: 'auditbeat',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function awsMetricsSpecProvider(server, context) {
export function awsMetricsSpecProvider(context) {
const moduleName = 'aws';
return {
id: 'awsMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function cephMetricsSpecProvider(server, context) {
export function cephMetricsSpecProvider(context) {
const moduleName = 'ceph';
return {
id: 'cephMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
onPremCloudInstructions,
} from '../../../common/tutorials/filebeat_instructions';

export function ciscoLogsSpecProvider(server, context) {
export function ciscoLogsSpecProvider(context) {
const moduleName = 'cisco';
const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'];
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/functionbeat_instructions';

export function cloudwatchLogsSpecProvider(server, context) {
export function cloudwatchLogsSpecProvider(context) {
return {
id: 'cloudwatchLogs',
name: i18n.translate('kbn.server.tutorials.cloudwatchLogs.nameTitle', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function cockroachdbMetricsSpecProvider(server, context) {
export function cockroachdbMetricsSpecProvider(context) {
const moduleName = 'cockroachdb';
return {
id: 'cockroachdbMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function consulMetricsSpecProvider(server, context) {
export function consulMetricsSpecProvider(context) {
const moduleName = 'consul';
return {
id: 'consulMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function corednsMetricsSpecProvider(server, context) {
export function corednsMetricsSpecProvider(context) {
const moduleName = 'coredns';
return {
id: 'corednsMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function couchbaseMetricsSpecProvider(server, context) {
export function couchbaseMetricsSpecProvider(context) {
const moduleName = 'couchbase';
return {
id: 'couchbaseMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function couchdbMetricsSpecProvider(server, context) {
export function couchdbMetricsSpecProvider(context) {
const moduleName = 'couchdb';
return {
id: 'couchdbMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function dockerMetricsSpecProvider(server, context) {
export function dockerMetricsSpecProvider(context) {
const moduleName = 'docker';
return {
id: 'dockerMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function dropwizardMetricsSpecProvider(server, context) {
export function dropwizardMetricsSpecProvider(context) {
const moduleName = 'dropwizard';
return {
id: 'dropwizardMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/filebeat_instructions';

export function elasticsearchLogsSpecProvider(server, context) {
export function elasticsearchLogsSpecProvider(context) {
const moduleName = 'elasticsearch';
const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'];
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function elasticsearchMetricsSpecProvider(server, context) {
export function elasticsearchMetricsSpecProvider(context) {
const moduleName = 'elasticsearch';
return {
id: 'elasticsearchMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
onPremCloudInstructions,
} from '../../../common/tutorials/filebeat_instructions';

export function envoyproxyLogsSpecProvider(server, context) {
export function envoyproxyLogsSpecProvider(context) {
const moduleName = 'envoyproxy';
const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'];
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function etcdMetricsSpecProvider(server, context) {
export function etcdMetricsSpecProvider(context) {
const moduleName = 'etcd';
return {
id: 'etcdMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function golangMetricsSpecProvider(server, context) {
export function golangMetricsSpecProvider(context) {
const moduleName = 'golang';
return {
id: moduleName + 'Metrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function haproxyMetricsSpecProvider(server, context) {
export function haproxyMetricsSpecProvider(context) {
const moduleName = 'haproxy';
return {
id: 'haproxyMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/filebeat_instructions';

export function iisLogsSpecProvider(server, context) {
export function iisLogsSpecProvider(context) {
const moduleName = 'iis';
const platforms = ['WINDOWS'];
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
onPremCloudInstructions,
} from '../../../common/tutorials/filebeat_instructions';

export function iptablesLogsSpecProvider(server, context) {
export function iptablesLogsSpecProvider(context) {
const moduleName = 'iptables';
const platforms = ['DEB', 'RPM'];
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/filebeat_instructions';

export function kafkaLogsSpecProvider(server, context) {
export function kafkaLogsSpecProvider(context) {
const moduleName = 'kafka';
const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'];
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function kafkaMetricsSpecProvider(server, context) {
export function kafkaMetricsSpecProvider(context) {
const moduleName = 'kafka';
return {
id: 'kafkaMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function kibanaMetricsSpecProvider(server, context) {
export function kibanaMetricsSpecProvider(context) {
const moduleName = 'kibana';
return {
id: 'kibanaMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function kubernetesMetricsSpecProvider(server, context) {
export function kubernetesMetricsSpecProvider(context) {
const moduleName = 'kubernetes';
return {
id: 'kubernetesMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/filebeat_instructions';

export function logstashLogsSpecProvider(server, context) {
export function logstashLogsSpecProvider(context) {
const moduleName = 'logstash';
const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'];
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function logstashMetricsSpecProvider(server, context) {
export function logstashMetricsSpecProvider(context) {
const moduleName = 'logstash';
return {
id: moduleName + 'Metrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function memcachedMetricsSpecProvider(server, context) {
export function memcachedMetricsSpecProvider(context) {
const moduleName = 'memcached';
return {
id: 'memcachedMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function mongodbMetricsSpecProvider(server, context) {
export function mongodbMetricsSpecProvider(context) {
const moduleName = 'mongodb';
return {
id: 'mongodbMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function mssqlMetricsSpecProvider(server, context) {
export function mssqlMetricsSpecProvider(context) {
const moduleName = 'mssql';
return {
id: 'mssqlMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function muninMetricsSpecProvider(server, context) {
export function muninMetricsSpecProvider(context) {
const moduleName = 'munin';
return {
id: 'muninMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/filebeat_instructions';

export function mysqlLogsSpecProvider(server, context) {
export function mysqlLogsSpecProvider(context) {
const moduleName = 'mysql';
const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'];
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function mysqlMetricsSpecProvider(server, context) {
export function mysqlMetricsSpecProvider(context) {
const moduleName = 'mysql';
return {
id: 'mysqlMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/filebeat_instructions';

export function natsLogsSpecProvider(server, context) {
export function natsLogsSpecProvider(context) {
const moduleName = 'nats';
const geoipRequired = false;
const uaRequired = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function natsMetricsSpecProvider(server, context) {
export function natsMetricsSpecProvider(context) {
const moduleName = 'nats';
return {
id: 'natsMetrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/filebeat_instructions';

export function nginxLogsSpecProvider(server, context) {
export function nginxLogsSpecProvider(context) {
const moduleName = 'nginx';
const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'];
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function nginxMetricsSpecProvider(server, context) {
export function nginxMetricsSpecProvider(context) {
const moduleName = 'nginx';
return {
id: 'nginxMetrics',
Expand Down
Loading