From 57e97ac52de1db67bd41cba7809f5371ca6b6eff Mon Sep 17 00:00:00 2001 From: Ryan Keairns Date: Fri, 26 Mar 2021 13:27:05 -0500 Subject: [PATCH 1/4] Handle cloud urls from kibana.yml --- .../instructions/cloud_instructions.ts | 7 ++-- x-pack/plugins/cloud/public/mocks.ts | 7 ++-- x-pack/plugins/cloud/public/plugin.ts | 35 ++++++++++++------- .../plugins/cloud/public/user_menu_links.ts | 12 ++++--- x-pack/plugins/cloud/public/utils.ts | 17 +++++++++ x-pack/plugins/cloud/server/config.ts | 16 +++++---- .../__mocks__/kibana_logic.mock.ts | 2 +- .../shared/setup_guide/setup_guide.tsx | 2 +- .../data_tier_allocation_field.tsx | 2 +- .../nav_control/nav_control_component.tsx | 3 +- .../translations/translations/ja-JP.json | 2 +- .../translations/translations/zh-CN.json | 2 +- 12 files changed, 71 insertions(+), 36 deletions(-) create mode 100644 x-pack/plugins/cloud/public/utils.ts diff --git a/src/plugins/home/server/tutorials/instructions/cloud_instructions.ts b/src/plugins/home/server/tutorials/instructions/cloud_instructions.ts index a75d6f6c06a95..5c39cbbcbf12b 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.profile_url\\} + Forgot the password? [Reset in Elastic Cloud](\\{config.cloud.base_url\\}\\{config.cloud.profile_url\\}). + \\{/config.cloud.profile_url\\}`, values: { passwordTemplate: '``' }, } ); diff --git a/x-pack/plugins/cloud/public/mocks.ts b/x-pack/plugins/cloud/public/mocks.ts index 8d9941073140f..52a027e899d0d 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 4c12aa3d92b47..752befe6bb9b0 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,39 @@ export class CloudPlugin implements Plugin { } public setup(core: CoreSetup, { home }: CloudSetupDependencies) { - const { id, resetPasswordUrl, deploymentUrl } = this.config; + // eslint-disable-next-line @typescript-eslint/naming-convention + const { id, cname, profile_url, organization_url, deployment_url, base_url } = 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, base_url, profile_url }); } } return { cloudId: id, - cloudDeploymentUrl: deploymentUrl, + cname, + baseUrl: base_url, + deploymentUrl: getFullCloudUrl(base_url, deployment_url), + profileUrl: getFullCloudUrl(base_url, profile_url), + organizationUrl: getFullCloudUrl(base_url, organization_url), isCloudEnabled: this.isCloudEnabled, }; } public start(coreStart: CoreStart, { security }: CloudStartDependencies) { - const { deploymentUrl } = this.config; + // eslint-disable-next-line @typescript-eslint/naming-convention + const { deployment_url, base_url } = this.config; coreStart.chrome.setHelpSupportUrl(ELASTIC_SUPPORT_LINK); - if (deploymentUrl) { + if (base_url && deployment_url) { coreStart.chrome.setCustomNavLink({ title: i18n.translate('xpack.cloud.deploymentLinkLabel', { defaultMessage: 'Manage this deployment', }), euiIconType: 'arrowLeft', - href: deploymentUrl, + href: getFullCloudUrl(base_url, deployment_url), }); } diff --git a/x-pack/plugins/cloud/public/user_menu_links.ts b/x-pack/plugins/cloud/public/user_menu_links.ts index e662d51500333..3581b03fe8b02 100644 --- a/x-pack/plugins/cloud/public/user_menu_links.ts +++ b/x-pack/plugins/cloud/public/user_menu_links.ts @@ -8,30 +8,32 @@ 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; + // eslint-disable-next-line @typescript-eslint/naming-convention + const { profile_url, organization_url, base_url } = config; const userMenuLinks = [] as UserMenuLink[]; - if (resetPasswordUrl) { + if (base_url && profile_url) { userMenuLinks.push({ label: i18n.translate('xpack.cloud.userMenuLinks.profileLinkText', { defaultMessage: 'Profile', }), iconType: 'user', - href: resetPasswordUrl, + href: getFullCloudUrl(base_url, profile_url), order: 100, setAsProfile: true, }); } - if (accountUrl) { + if (base_url && organization_url) { userMenuLinks.push({ label: i18n.translate('xpack.cloud.userMenuLinks.accountLinkText', { defaultMessage: 'Account & Billing', }), iconType: 'gear', - href: accountUrl, + href: getFullCloudUrl(base_url, organization_url), 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 0000000000000..6bf5228afcbc1 --- /dev/null +++ b/x-pack/plugins/cloud/public/utils.ts @@ -0,0 +1,17 @@ +/* + * 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, dirPath) { + let fullCloudUrl = ''; + + if (baseUrl && dirPath) { + fullCloudUrl = baseUrl.concat(dirPath); + } else { + throw new Error(`Both a baseUrl and dirPath must be passed to the getFullCloudUrl function.`); + } + return fullCloudUrl; +} diff --git a/x-pack/plugins/cloud/server/config.ts b/x-pack/plugins/cloud/server/config.ts index 673df5ac2203b..0e73d59667131 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 d8d66e5ee1998..133f704fd59a9 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 2140b3392abae..b4108e584086d 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 ffd4e2758ab86..8c90a738d2c09 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 546d6cf5a6bba..56eb784467c05 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 ad3cf86081e15..e6c2c267b909d 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -2080,7 +2080,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 babbccfab4dde..920db07903793 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -2091,7 +2091,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": "入门", From 8ebfa8eaa5268f8e9e00a535a0d266ce5333b5b0 Mon Sep 17 00:00:00 2001 From: Ryan Keairns Date: Fri, 26 Mar 2021 14:14:47 -0500 Subject: [PATCH 2/4] Add types to utils params --- x-pack/plugins/cloud/public/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/cloud/public/utils.ts b/x-pack/plugins/cloud/public/utils.ts index 6bf5228afcbc1..6e433b43a6ebd 100644 --- a/x-pack/plugins/cloud/public/utils.ts +++ b/x-pack/plugins/cloud/public/utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -export function getFullCloudUrl(baseUrl, dirPath) { +export function getFullCloudUrl(baseUrl: string, dirPath: string) { let fullCloudUrl = ''; if (baseUrl && dirPath) { From b00a55306e2fa45a9834e4e48efcb646bf09c5e3 Mon Sep 17 00:00:00 2001 From: Ryan Keairns Date: Mon, 29 Mar 2021 13:47:30 -0500 Subject: [PATCH 3/4] Update utils --- x-pack/plugins/cloud/public/utils.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/cloud/public/utils.ts b/x-pack/plugins/cloud/public/utils.ts index 6e433b43a6ebd..c84102b7407da 100644 --- a/x-pack/plugins/cloud/public/utils.ts +++ b/x-pack/plugins/cloud/public/utils.ts @@ -5,13 +5,12 @@ * 2.0. */ -export function getFullCloudUrl(baseUrl: string, dirPath: string) { +export function getFullCloudUrl(baseUrl: string | undefined, dirPath: string | undefined) { let fullCloudUrl = ''; - if (baseUrl && dirPath) { + if (typeof baseUrl !== 'undefined' && typeof dirPath !== 'undefined') { fullCloudUrl = baseUrl.concat(dirPath); - } else { - throw new Error(`Both a baseUrl and dirPath must be passed to the getFullCloudUrl function.`); } + return fullCloudUrl; } From fd53d2d79116d2ab49b4d9aac4653852174a7fd6 Mon Sep 17 00:00:00 2001 From: Ryan Keairns Date: Tue, 30 Mar 2021 17:36:45 -0500 Subject: [PATCH 4/4] address nits --- .../instructions/cloud_instructions.ts | 6 ++--- x-pack/plugins/cloud/public/plugin.ts | 27 +++++++++++-------- .../plugins/cloud/public/user_menu_links.ts | 11 ++++---- x-pack/plugins/cloud/public/utils.ts | 8 +++--- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/plugins/home/server/tutorials/instructions/cloud_instructions.ts b/src/plugins/home/server/tutorials/instructions/cloud_instructions.ts index 5c39cbbcbf12b..ed9e588a999b4 100644 --- a/src/plugins/home/server/tutorials/instructions/cloud_instructions.ts +++ b/src/plugins/home/server/tutorials/instructions/cloud_instructions.ts @@ -12,9 +12,9 @@ export const cloudPasswordAndResetLink = i18n.translate( { defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user.' + - `\\{#config.cloud.profile_url\\} - Forgot the password? [Reset in Elastic Cloud](\\{config.cloud.base_url\\}\\{config.cloud.profile_url\\}). - \\{/config.cloud.profile_url\\}`, + `\\{#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/plugin.ts b/x-pack/plugins/cloud/public/plugin.ts index 752befe6bb9b0..8ca4f7711811a 100644 --- a/x-pack/plugins/cloud/public/plugin.ts +++ b/x-pack/plugins/cloud/public/plugin.ts @@ -51,39 +51,44 @@ export class CloudPlugin implements Plugin { } public setup(core: CoreSetup, { home }: CloudSetupDependencies) { - // eslint-disable-next-line @typescript-eslint/naming-convention - const { id, cname, profile_url, organization_url, deployment_url, base_url } = 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, base_url, profile_url }); + home.tutorials.setVariable('cloud', { id, baseUrl, profileUrl }); } } return { cloudId: id, cname, - baseUrl: base_url, - deploymentUrl: getFullCloudUrl(base_url, deployment_url), - profileUrl: getFullCloudUrl(base_url, profile_url), - organizationUrl: getFullCloudUrl(base_url, organization_url), + baseUrl, + deploymentUrl: getFullCloudUrl(baseUrl, deploymentUrl), + profileUrl: getFullCloudUrl(baseUrl, profileUrl), + organizationUrl: getFullCloudUrl(baseUrl, organizationUrl), isCloudEnabled: this.isCloudEnabled, }; } public start(coreStart: CoreStart, { security }: CloudStartDependencies) { - // eslint-disable-next-line @typescript-eslint/naming-convention - const { deployment_url, base_url } = this.config; + const { deployment_url: deploymentUrl, base_url: baseUrl } = this.config; coreStart.chrome.setHelpSupportUrl(ELASTIC_SUPPORT_LINK); - if (base_url && deployment_url) { + if (baseUrl && deploymentUrl) { coreStart.chrome.setCustomNavLink({ title: i18n.translate('xpack.cloud.deploymentLinkLabel', { defaultMessage: 'Manage this deployment', }), euiIconType: 'arrowLeft', - href: getFullCloudUrl(base_url, deployment_url), + 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 3581b03fe8b02..f00911d577c59 100644 --- a/x-pack/plugins/cloud/public/user_menu_links.ts +++ b/x-pack/plugins/cloud/public/user_menu_links.ts @@ -11,29 +11,28 @@ import { CloudConfigType } from '.'; import { getFullCloudUrl } from './utils'; export const createUserMenuLinks = (config: CloudConfigType): UserMenuLink[] => { - // eslint-disable-next-line @typescript-eslint/naming-convention - const { profile_url, organization_url, base_url } = config; + const { profile_url: profileUrl, organization_url: organizationUrl, base_url: baseUrl } = config; const userMenuLinks = [] as UserMenuLink[]; - if (base_url && profile_url) { + if (baseUrl && profileUrl) { userMenuLinks.push({ label: i18n.translate('xpack.cloud.userMenuLinks.profileLinkText', { defaultMessage: 'Profile', }), iconType: 'user', - href: getFullCloudUrl(base_url, profile_url), + href: getFullCloudUrl(baseUrl, profileUrl), order: 100, setAsProfile: true, }); } - if (base_url && organization_url) { + if (baseUrl && organizationUrl) { userMenuLinks.push({ label: i18n.translate('xpack.cloud.userMenuLinks.accountLinkText', { defaultMessage: 'Account & Billing', }), iconType: 'gear', - href: getFullCloudUrl(base_url, organization_url), + href: getFullCloudUrl(baseUrl, organizationUrl), order: 200, }); } diff --git a/x-pack/plugins/cloud/public/utils.ts b/x-pack/plugins/cloud/public/utils.ts index c84102b7407da..e4d4ace64563c 100644 --- a/x-pack/plugins/cloud/public/utils.ts +++ b/x-pack/plugins/cloud/public/utils.ts @@ -6,11 +6,9 @@ */ export function getFullCloudUrl(baseUrl: string | undefined, dirPath: string | undefined) { - let fullCloudUrl = ''; - - if (typeof baseUrl !== 'undefined' && typeof dirPath !== 'undefined') { - fullCloudUrl = baseUrl.concat(dirPath); + if (baseUrl && dirPath) { + return `${baseUrl}${dirPath}`; } - return fullCloudUrl; + return ''; }