Skip to content

Commit

Permalink
Fixed ts error
Browse files Browse the repository at this point in the history
  • Loading branch information
cqliu1 committed Nov 5, 2020
1 parent 8d706f2 commit 7db9f92
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions x-pack/plugins/cloud/public/user_menu_links.ts
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;
};
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class SecurityNavControlService {
this.navControlRegistered = true;
}

private sortUserMenuLinks(userMenuLinks: ReadonlyMap<string, UserMenuLink>) {
private sortUserMenuLinks(userMenuLinks: ReadonlyMap<string, UserMenuLink[]>) {
return sortBy([...userMenuLinks.values()], 'order');
}
}

0 comments on commit 7db9f92

Please sign in to comment.