@@ -12,12 +12,15 @@ import { getIsCloudEnabled } from '../common/is_cloud_enabled';
1212import { ELASTIC_SUPPORT_LINK } from '../common/constants' ;
1313import { HomePublicPluginSetup } from '../../../../src/plugins/home/public' ;
1414import { createUserMenuLinks } from './user_menu_links' ;
15+ import { getFullCloudUrl } from './utils' ;
1516
1617export interface CloudConfigType {
1718 id ?: string ;
18- resetPasswordUrl ?: string ;
19- deploymentUrl ?: string ;
20- accountUrl ?: string ;
19+ cname ?: string ;
20+ base_url ?: string ;
21+ profile_url ?: string ;
22+ deployment_url ?: string ;
23+ organization_url ?: string ;
2124}
2225
2326interface CloudSetupDependencies {
@@ -30,10 +33,12 @@ interface CloudStartDependencies {
3033
3134export interface CloudSetup {
3235 cloudId ?: string ;
33- cloudDeploymentUrl ?: string ;
36+ cname ?: string ;
37+ baseUrl ?: string ;
38+ deploymentUrl ?: string ;
39+ profileUrl ?: string ;
40+ organizationUrl ?: string ;
3441 isCloudEnabled : boolean ;
35- resetPasswordUrl ?: string ;
36- accountUrl ?: string ;
3742}
3843
3944export class CloudPlugin implements Plugin < CloudSetup > {
@@ -46,33 +51,39 @@ export class CloudPlugin implements Plugin<CloudSetup> {
4651 }
4752
4853 public setup ( core : CoreSetup , { home } : CloudSetupDependencies ) {
49- const { id, resetPasswordUrl, deploymentUrl } = this . config ;
54+ // eslint-disable-next-line @typescript-eslint/naming-convention
55+ const { id, cname, profile_url, organization_url, deployment_url, base_url } = this . config ;
5056 this . isCloudEnabled = getIsCloudEnabled ( id ) ;
5157
5258 if ( home ) {
5359 home . environment . update ( { cloud : this . isCloudEnabled } ) ;
5460 if ( this . isCloudEnabled ) {
55- home . tutorials . setVariable ( 'cloud' , { id, resetPasswordUrl } ) ;
61+ home . tutorials . setVariable ( 'cloud' , { id, base_url , profile_url } ) ;
5662 }
5763 }
5864
5965 return {
6066 cloudId : id ,
61- cloudDeploymentUrl : deploymentUrl ,
67+ cname,
68+ baseUrl : base_url ,
69+ deploymentUrl : getFullCloudUrl ( base_url , deployment_url ) ,
70+ profileUrl : getFullCloudUrl ( base_url , profile_url ) ,
71+ organizationUrl : getFullCloudUrl ( base_url , organization_url ) ,
6272 isCloudEnabled : this . isCloudEnabled ,
6373 } ;
6474 }
6575
6676 public start ( coreStart : CoreStart , { security } : CloudStartDependencies ) {
67- const { deploymentUrl } = this . config ;
77+ // eslint-disable-next-line @typescript-eslint/naming-convention
78+ const { deployment_url, base_url } = this . config ;
6879 coreStart . chrome . setHelpSupportUrl ( ELASTIC_SUPPORT_LINK ) ;
69- if ( deploymentUrl ) {
80+ if ( base_url && deployment_url ) {
7081 coreStart . chrome . setCustomNavLink ( {
7182 title : i18n . translate ( 'xpack.cloud.deploymentLinkLabel' , {
7283 defaultMessage : 'Manage this deployment' ,
7384 } ) ,
7485 euiIconType : 'arrowLeft' ,
75- href : deploymentUrl ,
86+ href : getFullCloudUrl ( base_url , deployment_url ) ,
7687 } ) ;
7788 }
7889
0 commit comments