diff --git a/src/plugins/home/server/tutorials/instructions/cloud_instructions.ts b/src/plugins/home/server/tutorials/instructions/cloud_instructions.ts index a75d6f6c06a95f..ed9e588a999b42 100644 --- a/src/plugins/home/server/tutorials/instructions/cloud_instructions.ts +++ b/src/plugins/home/server/tutorials/instructions/cloud_instructions.ts @@ -7,15 +7,14 @@ */ 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\\}`, + `\\{#config.cloud.profileUrl\\} + Forgot the password? [Reset in Elastic Cloud](\\{config.cloud.baseUrl\\}\\{config.cloud.profileUrl\\}). + \\{/config.cloud.profileUrl\\}`, values: { passwordTemplate: '``' }, } ); diff --git a/x-pack/plugins/cloud/public/mocks.ts b/x-pack/plugins/cloud/public/mocks.ts index 8d9941073140f5..52a027e899d0d8 100644 --- a/x-pack/plugins/cloud/public/mocks.ts +++ b/x-pack/plugins/cloud/public/mocks.ts @@ -9,8 +9,11 @@ function createSetupMock() { return { cloudId: 'mock-cloud-id', isCloudEnabled: true, - resetPasswordUrl: 'reset-password-url', - accountUrl: 'account-url', + cname: 'cname', + baseUrl: 'base-url', + deploymentUrl: 'deployment-url', + profileUrl: 'profile-url', + organizationUrl: 'organization-url', }; } diff --git a/x-pack/plugins/cloud/public/plugin.ts b/x-pack/plugins/cloud/public/plugin.ts index 4c12aa3d92b47b..8ca4f7711811a8 100644 --- a/x-pack/plugins/cloud/public/plugin.ts +++ b/x-pack/plugins/cloud/public/plugin.ts @@ -12,12 +12,15 @@ import { getIsCloudEnabled } from '../common/is_cloud_enabled'; import { ELASTIC_SUPPORT_LINK } from '../common/constants'; import { HomePublicPluginSetup } from '../../../../src/plugins/home/public'; import { createUserMenuLinks } from './user_menu_links'; +import { getFullCloudUrl } from './utils'; export interface CloudConfigType { id?: string; - resetPasswordUrl?: string; - deploymentUrl?: string; - accountUrl?: string; + cname?: string; + base_url?: string; + profile_url?: string; + deployment_url?: string; + organization_url?: string; } interface CloudSetupDependencies { @@ -30,10 +33,12 @@ interface CloudStartDependencies { export interface CloudSetup { cloudId?: string; - cloudDeploymentUrl?: string; + cname?: string; + baseUrl?: string; + deploymentUrl?: string; + profileUrl?: string; + organizationUrl?: string; isCloudEnabled: boolean; - resetPasswordUrl?: string; - accountUrl?: string; } export class CloudPlugin implements Plugin { @@ -46,33 +51,44 @@ export class CloudPlugin implements Plugin { } public setup(core: CoreSetup, { home }: CloudSetupDependencies) { - const { id, resetPasswordUrl, deploymentUrl } = this.config; + const { + id, + cname, + profile_url: profileUrl, + organization_url: organizationUrl, + deployment_url: deploymentUrl, + base_url: baseUrl, + } = this.config; this.isCloudEnabled = getIsCloudEnabled(id); if (home) { home.environment.update({ cloud: this.isCloudEnabled }); if (this.isCloudEnabled) { - home.tutorials.setVariable('cloud', { id, resetPasswordUrl }); + home.tutorials.setVariable('cloud', { id, baseUrl, profileUrl }); } } return { cloudId: id, - cloudDeploymentUrl: deploymentUrl, + cname, + baseUrl, + deploymentUrl: getFullCloudUrl(baseUrl, deploymentUrl), + profileUrl: getFullCloudUrl(baseUrl, profileUrl), + organizationUrl: getFullCloudUrl(baseUrl, organizationUrl), isCloudEnabled: this.isCloudEnabled, }; } public start(coreStart: CoreStart, { security }: CloudStartDependencies) { - const { deploymentUrl } = this.config; + const { deployment_url: deploymentUrl, base_url: baseUrl } = this.config; coreStart.chrome.setHelpSupportUrl(ELASTIC_SUPPORT_LINK); - if (deploymentUrl) { + if (baseUrl && deploymentUrl) { coreStart.chrome.setCustomNavLink({ title: i18n.translate('xpack.cloud.deploymentLinkLabel', { defaultMessage: 'Manage this deployment', }), euiIconType: 'arrowLeft', - href: deploymentUrl, + href: getFullCloudUrl(baseUrl, deploymentUrl), }); } diff --git a/x-pack/plugins/cloud/public/user_menu_links.ts b/x-pack/plugins/cloud/public/user_menu_links.ts index e662d515003335..f00911d577c59c 100644 --- a/x-pack/plugins/cloud/public/user_menu_links.ts +++ b/x-pack/plugins/cloud/public/user_menu_links.ts @@ -8,30 +8,31 @@ import { i18n } from '@kbn/i18n'; import { UserMenuLink } from '../../security/public'; import { CloudConfigType } from '.'; +import { getFullCloudUrl } from './utils'; export const createUserMenuLinks = (config: CloudConfigType): UserMenuLink[] => { - const { resetPasswordUrl, accountUrl } = config; + const { profile_url: profileUrl, organization_url: organizationUrl, base_url: baseUrl } = config; const userMenuLinks = [] as UserMenuLink[]; - if (resetPasswordUrl) { + if (baseUrl && profileUrl) { userMenuLinks.push({ label: i18n.translate('xpack.cloud.userMenuLinks.profileLinkText', { defaultMessage: 'Profile', }), iconType: 'user', - href: resetPasswordUrl, + href: getFullCloudUrl(baseUrl, profileUrl), order: 100, setAsProfile: true, }); } - if (accountUrl) { + if (baseUrl && organizationUrl) { userMenuLinks.push({ label: i18n.translate('xpack.cloud.userMenuLinks.accountLinkText', { defaultMessage: 'Account & Billing', }), iconType: 'gear', - href: accountUrl, + href: getFullCloudUrl(baseUrl, organizationUrl), order: 200, }); } diff --git a/x-pack/plugins/cloud/public/utils.ts b/x-pack/plugins/cloud/public/utils.ts new file mode 100644 index 00000000000000..e4d4ace64563cb --- /dev/null +++ b/x-pack/plugins/cloud/public/utils.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export function getFullCloudUrl(baseUrl: string | undefined, dirPath: string | undefined) { + if (baseUrl && dirPath) { + return `${baseUrl}${dirPath}`; + } + + return ''; +} diff --git a/x-pack/plugins/cloud/server/config.ts b/x-pack/plugins/cloud/server/config.ts index 673df5ac2203b3..0e73d596671314 100644 --- a/x-pack/plugins/cloud/server/config.ts +++ b/x-pack/plugins/cloud/server/config.ts @@ -22,9 +22,11 @@ const configSchema = schema.object({ enabled: schema.boolean({ defaultValue: true }), id: schema.maybe(schema.string()), apm: schema.maybe(apmConfigSchema), - resetPasswordUrl: schema.maybe(schema.string()), - deploymentUrl: schema.maybe(schema.string()), - accountUrl: schema.maybe(schema.string()), + cname: schema.maybe(schema.string()), + base_url: schema.maybe(schema.string()), + profile_url: schema.maybe(schema.string()), + deployment_url: schema.maybe(schema.string()), + organization_url: schema.maybe(schema.string()), }); export type CloudConfigType = TypeOf; @@ -32,9 +34,11 @@ export type CloudConfigType = TypeOf; export const config: PluginConfigDescriptor = { exposeToBrowser: { id: true, - resetPasswordUrl: true, - deploymentUrl: true, - accountUrl: true, + cname: true, + base_url: true, + profile_url: true, + deployment_url: true, + organization_url: true, }, schema: configSchema, }; diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kibana_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kibana_logic.mock.ts index d8d66e5ee19987..133f704fd59a9b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kibana_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kibana_logic.mock.ts @@ -14,7 +14,7 @@ export const mockKibanaValues = { charts: chartPluginMock.createStartContract(), cloud: { isCloudEnabled: false, - cloudDeploymentUrl: 'https://cloud.elastic.co/deployments/some-id', + deployment_url: 'https://cloud.elastic.co/deployments/some-id', }, history: mockHistory, navigateToUrl: jest.fn(), diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/setup_guide.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/setup_guide.tsx index 2140b3392abaed..b4108e584086d1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/setup_guide.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/setup_guide.tsx @@ -50,7 +50,7 @@ export const SetupGuideLayout: React.FC = ({ }) => { const { cloud } = useValues(KibanaLogic); const isCloudEnabled = Boolean(cloud.isCloudEnabled); - const cloudDeploymentLink = cloud.cloudDeploymentUrl || ''; + const cloudDeploymentLink = cloud.deploymentUrl || ''; return ( diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/data_tier_allocation_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/data_tier_allocation_field.tsx index ffd4e2758ab865..8c90a738d2c090 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/data_tier_allocation_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/data_tier_allocation_field.tsx @@ -60,7 +60,7 @@ export const DataTierAllocationField: FunctionComponent = ({ phase, descr const hasNodeAttrs = Boolean(Object.keys(nodesByAttributes ?? {}).length); const isCloudEnabled = cloud?.isCloudEnabled ?? false; - const cloudDeploymentUrl = cloud?.cloudDeploymentUrl; + const cloudDeploymentUrl = cloud?.deploymentUrl; const renderNotice = () => { switch (allocationType) { diff --git a/x-pack/plugins/security/public/nav_control/nav_control_component.tsx b/x-pack/plugins/security/public/nav_control/nav_control_component.tsx index 546d6cf5a6bba8..56eb784467c056 100644 --- a/x-pack/plugins/security/public/nav_control/nav_control_component.tsx +++ b/x-pack/plugins/security/public/nav_control/nav_control_component.tsx @@ -15,7 +15,6 @@ import { EuiIcon, EuiLoadingSpinner, EuiPopover, - EuiText, } from '@elastic/eui'; import React, { Component } from 'react'; import type { Observable, Subscription } from 'rxjs'; @@ -128,7 +127,7 @@ export class SecurityNavControl extends Component { const userMenuLinkMenuItems = userMenuLinks .sort(({ order: orderA = Infinity }, { order: orderB = Infinity }) => orderA - orderB) .map(({ label, iconType, href }: UserMenuLink) => ({ - name: {label}, + name: label, icon: , href, 'data-test-subj': `userMenuLink__${label}`, diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index f55b6c5217ad99..8d223e730c5fa8 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -2097,7 +2097,7 @@ "home.tutorials.common.auditbeatStatusCheck.successText": "データを受信しました", "home.tutorials.common.auditbeatStatusCheck.text": "Auditbeat からデータを受け取ったことを確認してください。", "home.tutorials.common.auditbeatStatusCheck.title": "ステータス", - "home.tutorials.common.cloudInstructions.passwordAndResetLink": "{passwordTemplate}が「Elastic」ユーザーのパスワードです。\\{#config.cloud.resetPasswordUrl\\}\n パスワードを忘れた場合[Elastic Cloudでリセット] (\\{config.cloud.resetPasswordUrl\\}) 。\n \\{/config.cloud.resetPasswordUrl\\}", + "home.tutorials.common.cloudInstructions.passwordAndResetLink": "{passwordTemplate}が「Elastic」ユーザーのパスワードです。\\{#config.cloud.base_url\\}\\{#config.cloud.profile_url\\}\n パスワードを忘れた場合[Elastic Cloudでリセット] (\\{#config.cloud.base_url\\}\\{config.cloud.profile_url\\}) 。\n \\{#config.cloud.base_url\\}\\{/config.cloud.profile_url\\}", "home.tutorials.common.filebeat.cloudInstructions.gettingStarted.title": "はじめに", "home.tutorials.common.filebeat.premCloudInstructions.gettingStarted.title": "はじめに", "home.tutorials.common.filebeat.premInstructions.gettingStarted.title": "はじめに", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index c0652b8ac2a653..269926a607d959 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -2108,7 +2108,7 @@ "home.tutorials.common.auditbeatStatusCheck.successText": "已成功接收数据", "home.tutorials.common.auditbeatStatusCheck.text": "确认从 Auditbeat 收到数据", "home.tutorials.common.auditbeatStatusCheck.title": "状态", - "home.tutorials.common.cloudInstructions.passwordAndResetLink": "其中 {passwordTemplate} 是用户 `elastic` 的密码。\\{#config.cloud.resetPasswordUrl\\}\n 忘了密码?[在 Elastic Cloud 中重置](\\{config.cloud.resetPasswordUrl\\})。\n \\{/config.cloud.resetPasswordUrl\\}", + "home.tutorials.common.cloudInstructions.passwordAndResetLink": "其中 {passwordTemplate} 是用户 `elastic` 的密码。\\{#config.cloud.base_url\\}\\{#config.cloud.profile_url\\}\n 忘了密码?[在 Elastic Cloud 中重置](\\{#config.cloud.base_url\\}\\{config.cloud.profile_url\\})。\n \\{#config.cloud.base_url\\}\\{/config.cloud.profile_url\\}", "home.tutorials.common.filebeat.cloudInstructions.gettingStarted.title": "入门", "home.tutorials.common.filebeat.premCloudInstructions.gettingStarted.title": "入门", "home.tutorials.common.filebeat.premInstructions.gettingStarted.title": "入门",