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

Add Data - Adding cloud reset password link to cloud instructions #62835

Merged
merged 10 commits into from
Apr 9, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { INSTRUCTION_VARIANT } from '../../../common/instruction_variant';
import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions';
import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';

export const createAuditbeatInstructions = (context?: TutorialContext) => ({
INSTALL: {
Expand Down Expand Up @@ -305,13 +306,7 @@ export const createAuditbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.auditbeatCloudInstructions.config.osxTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
DEB: {
title: i18n.translate('home.tutorials.common.auditbeatCloudInstructions.config.debTitle', {
Expand All @@ -327,13 +322,7 @@ export const createAuditbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.auditbeatCloudInstructions.config.debTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
RPM: {
title: i18n.translate('home.tutorials.common.auditbeatCloudInstructions.config.rpmTitle', {
Expand All @@ -349,13 +338,7 @@ export const createAuditbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.auditbeatCloudInstructions.config.rpmTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
WINDOWS: {
title: i18n.translate(
Expand All @@ -374,13 +357,7 @@ export const createAuditbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.auditbeatCloudInstructions.config.windowsTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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';

export const cloudPasswordAndResetLink = i18n.translate(
'home.tutorials.common.cloudInstructions.passwordAndResetLink',
{
defaultMessage:
'Where {passwordTemplate} is the password of the `elastic` user.' +
`\\{#config.cloud.resetPasswordUrl\\}
Forgot the password? [Reset in Elastic Cloud](\\{config.cloud.resetPasswordUrl\\}).
\\{/config.cloud.resetPasswordUrl\\}`,
values: { passwordTemplate: '`<password>`' },
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { INSTRUCTION_VARIANT } from '../../../common/instruction_variant';
import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions';
import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';

export const createFilebeatInstructions = (context?: TutorialContext) => ({
INSTALL: {
Expand Down Expand Up @@ -299,13 +300,7 @@ export const createFilebeatCloudInstructions = () => ({
},
}),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.filebeatCloudInstructions.config.osxTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
DEB: {
title: i18n.translate('home.tutorials.common.filebeatCloudInstructions.config.debTitle', {
Expand All @@ -318,13 +313,7 @@ export const createFilebeatCloudInstructions = () => ({
},
}),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.filebeatCloudInstructions.config.debTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
RPM: {
title: i18n.translate('home.tutorials.common.filebeatCloudInstructions.config.rpmTitle', {
Expand All @@ -337,13 +326,7 @@ export const createFilebeatCloudInstructions = () => ({
},
}),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.filebeatCloudInstructions.config.rpmTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
WINDOWS: {
title: i18n.translate('home.tutorials.common.filebeatCloudInstructions.config.windowsTitle', {
Expand All @@ -359,13 +342,7 @@ export const createFilebeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.filebeatCloudInstructions.config.windowsTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { INSTRUCTION_VARIANT } from '../../../common/instruction_variant';
import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions';
import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';

export const createFunctionbeatInstructions = (context?: TutorialContext) => ({
INSTALL: {
Expand Down Expand Up @@ -200,13 +201,7 @@ export const createFunctionbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.functionbeatCloudInstructions.config.osxTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
WINDOWS: {
title: i18n.translate(
Expand All @@ -225,13 +220,7 @@ export const createFunctionbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.functionbeatCloudInstructions.config.windowsTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { INSTRUCTION_VARIANT } from '../../../common/instruction_variant';
import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions';
import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';

export const createHeartbeatInstructions = (context?: TutorialContext) => ({
INSTALL: {
Expand Down Expand Up @@ -280,13 +281,7 @@ export const createHeartbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.heartbeatCloudInstructions.config.osxTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
DEB: {
title: i18n.translate('home.tutorials.common.heartbeatCloudInstructions.config.debTitle', {
Expand All @@ -302,13 +297,7 @@ export const createHeartbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.heartbeatCloudInstructions.config.debTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
RPM: {
title: i18n.translate('home.tutorials.common.heartbeatCloudInstructions.config.rpmTitle', {
Expand All @@ -324,13 +313,7 @@ export const createHeartbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.heartbeatCloudInstructions.config.rpmTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
WINDOWS: {
title: i18n.translate(
Expand All @@ -349,13 +332,7 @@ export const createHeartbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.heartbeatCloudInstructions.config.windowsTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { INSTRUCTION_VARIANT } from '../../../common/instruction_variant';
import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions';
import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';

export const createMetricbeatInstructions = (context?: TutorialContext) => ({
INSTALL: {
Expand Down Expand Up @@ -295,13 +296,7 @@ export const createMetricbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.metricbeatCloudInstructions.config.osxTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
DEB: {
title: i18n.translate('home.tutorials.common.metricbeatCloudInstructions.config.debTitle', {
Expand All @@ -317,13 +312,7 @@ export const createMetricbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.metricbeatCloudInstructions.config.debTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
RPM: {
title: i18n.translate('home.tutorials.common.metricbeatCloudInstructions.config.rpmTitle', {
Expand All @@ -339,13 +328,7 @@ export const createMetricbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.metricbeatCloudInstructions.config.rpmTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
WINDOWS: {
title: i18n.translate(
Expand All @@ -364,13 +347,7 @@ export const createMetricbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.metricbeatCloudInstructions.config.windowsTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { INSTRUCTION_VARIANT } from '../../../common/instruction_variant';
import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions';
import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';

export const createWinlogbeatInstructions = (context?: TutorialContext) => ({
INSTALL: {
Expand Down Expand Up @@ -130,13 +131,7 @@ export const createWinlogbeatCloudInstructions = () => ({
}
),
commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:<password>"'],
textPost: i18n.translate(
'home.tutorials.common.winlogbeatCloudInstructions.config.windowsTextPost',
{
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.',
values: { passwordTemplate: '`<password>`' },
}
),
textPost: cloudPasswordAndResetLink,
},
},
});
Expand Down
5 changes: 3 additions & 2 deletions x-pack/plugins/cloud/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { HomePublicPluginSetup } from '../../../../src/plugins/home/public';

interface CloudConfigType {
id?: string;
resetPasswordUrl?: string;
}

interface CloudSetupDependencies {
Expand All @@ -26,13 +27,13 @@ export class CloudPlugin implements Plugin<CloudSetup> {
constructor(private readonly initializerContext: PluginInitializerContext) {}

public async setup(core: CoreSetup, { home }: CloudSetupDependencies) {
const { id } = this.initializerContext.config.get<CloudConfigType>();
const { id, resetPasswordUrl } = this.initializerContext.config.get<CloudConfigType>();
const isCloudEnabled = getIsCloudEnabled(id);

if (home) {
home.environment.update({ cloud: isCloudEnabled });
if (isCloudEnabled) {
home.tutorials.setVariable('cloud', { id });
home.tutorials.setVariable('cloud', { id, resetPasswordUrl });
}
}

Expand Down
Loading