-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds cloud links to user popover (#66825)
Co-authored-by: Ryan Keairns <contactryank@gmail.com>
- Loading branch information
1 parent
26f79a6
commit 8cdf566
Showing
16 changed files
with
292 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
function createSetupMock() { | ||
return { | ||
cloudId: 'mock-cloud-id', | ||
isCloudEnabled: true, | ||
resetPasswordUrl: 'reset-password-url', | ||
accountUrl: 'account-url', | ||
}; | ||
} | ||
|
||
export const cloudMock = { | ||
createSetup: createSetupMock, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { UserMenuLink } from '../../security/public'; | ||
import { CloudConfigType } from '.'; | ||
|
||
export const createUserMenuLinks = (config: CloudConfigType): UserMenuLink[] => { | ||
const { resetPasswordUrl, accountUrl } = config; | ||
const userMenuLinks = [] as UserMenuLink[]; | ||
|
||
if (resetPasswordUrl) { | ||
userMenuLinks.push({ | ||
label: i18n.translate('xpack.cloud.userMenuLinks.profileLinkText', { | ||
defaultMessage: 'Cloud profile', | ||
}), | ||
iconType: 'logoCloud', | ||
href: resetPasswordUrl, | ||
order: 100, | ||
}); | ||
} | ||
|
||
if (accountUrl) { | ||
userMenuLinks.push({ | ||
label: i18n.translate('xpack.cloud.userMenuLinks.accountLinkText', { | ||
defaultMessage: 'Account & Billing', | ||
}), | ||
iconType: 'gear', | ||
href: accountUrl, | ||
order: 200, | ||
}); | ||
} | ||
|
||
return userMenuLinks; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { SecurityNavControlServiceStart } from '.'; | ||
|
||
export const navControlServiceMock = { | ||
createStart: (): jest.Mocked<SecurityNavControlServiceStart> => ({ | ||
getUserMenuLinks$: jest.fn(), | ||
addUserMenuLinks: jest.fn(), | ||
}), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/security/public/nav_control/nav_control_component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.chrNavControl__userMenu { | ||
.euiContextMenuPanelTitle { | ||
// Uppercased by default, override to match actual username | ||
text-transform: none; | ||
} | ||
|
||
.euiContextMenuItem { | ||
// Temp fix for EUI issue https://github.com/elastic/eui/issues/3092 | ||
line-height: normal; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.