Skip to content

Commit

Permalink
feat: updated lfx header v2 (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
luismoriguerra authored Jan 25, 2023
1 parent cd12358 commit a9304aa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/config/app-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class AppSettings {
public static LEARN_MORE = 'https://docs.linuxfoundation.org/lfx/easycla/contributors';
public static TICKET_URL = 'https://jira.linuxfoundation.org/servicedesk/customer/portal/4/create/143';
public static LFX_FOOTER = 'lfx-footer';
public static LFX_HEADER = 'lfx-header';
public static LFX_HEADER = 'lfx-header-v2';
public static PROJECT_CONSOLE_LINK_V2 = 'admin-v2-base';
public static CORPORATE_CONSOLE_LINK_V2 = 'corporate-v2-base';
public static MAX_CLA_MANAGER_DESIGNEE_RETRY_COUNT = 5;
Expand Down
5 changes: 3 additions & 2 deletions src/app/shared/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,17 @@ export class AuthService {
}

setUserInHeader(user) {
const lfHeaderEl: any = document.getElementById('lfx-header');
const lfHeaderEl: any = document.getElementById('lfx-header-v2');
lfHeaderEl.authuser = user;
}

login() {
// Need to increase timeout to 1500 as for slower network it gives an error
// Cannot read property 'querySelector' of null
// TODO: verify this still works
setTimeout(() => {
const button = document
.querySelector('#lfx-header')
.querySelector('#lfx-header-v2')
.shadowRoot.querySelector('.lfx-header.is-login-link') as HTMLElement;
if (button) {
button.click();
Expand Down
6 changes: 3 additions & 3 deletions src/app/shared/services/lfx-header.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ export class LfxHeaderService {
url: AppSettings.LEARN_MORE
}
];
const element: any = document.getElementById('lfx-header');
const element: any = document.getElementById('lfx-header-v2');
element.links = this.links;
}

setCallBackUrl() {
const lfHeaderEl: any = document.getElementById('lfx-header');
const lfHeaderEl: any = document.getElementById('lfx-header-v2');
if (lfHeaderEl) {
lfHeaderEl.callbackurl = this.auth.auth0Options.callbackUrl;
}
}

setUserInLFxHeader(): void {
setTimeout(() => {
const lfHeaderEl: any = document.getElementById('lfx-header');
const lfHeaderEl: any = document.getElementById('lfx-header-v2');
if (lfHeaderEl) {
this.auth.userProfile$.subscribe((data) => {
if (data) {
Expand Down
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
</head>

<body>
<lfx-header
<lfx-header-v2
product="LF CLA"
id="lfx-header"
supportlink="https://jira.linuxfoundation.org/plugins/servlet/theme/portal/4/create/143"
docslink="https://docs.linuxfoundation.org/lfx/easycla/v2-current"
faqlink="https://docs.linuxfoundation.org/lfx/easycla/v2-current/getting-started/easycla-faqs"
>
</lfx-header>
</lfx-header-v2>
<app-root></app-root>
</body>
</html>

0 comments on commit a9304aa

Please sign in to comment.