From b1e45ef9abdb581ba3e0542e18df4c350dbe90ea Mon Sep 17 00:00:00 2001 From: Amol Sontakke Date: Tue, 17 Dec 2024 00:32:03 +0530 Subject: [PATCH] Reset to main Signed-off-by: Amol Sontakke --- README.md | 2 +- edge/security-headers.js | 5 +- package.json | 5 +- serverless.yml | 2 +- src/app/app.component.html | 3 +- src/app/app.component.scss | 13 +++- src/app/app.component.ts | 23 +++++- src/app/config/app-settings.ts | 1 - src/app/config/scripts/prefetch-ssm.js | 4 +- src/app/config/scripts/read-ssm.js | 23 ++++-- .../corporate-dashboard.component.html | 12 +-- .../corporate-dashboard.component.scss | 5 ++ .../corporate-dashboard.component.ts | 1 - .../cla-dashboard.component.html | 1 + .../gerrit-dashboard.component.html | 8 +- .../gerrit-dashboard.component.scss | 31 ++------ .../gerrit-dashboard.component.ts | 74 ++----------------- .../docusign-signature-model.component.html | 10 +-- .../docusign-signature-model.component.ts | 1 - .../individual-dashboard.component.ts | 9 +-- .../shared/components/auth/auth.component.ts | 62 +++++----------- .../checkbox/checkbox.component.html | 9 +-- .../components/checkbox/checkbox.component.ts | 4 - src/app/shared/services/auth.service.ts | 19 ++--- src/app/shared/shared.module.ts | 10 +-- src/main.ts | 2 +- yarn.lock | 17 ++--- 27 files changed, 127 insertions(+), 229 deletions(-) diff --git a/README.md b/README.md index 66a5ed9b..30822286 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Once the CLA is signed, the GitHub pull request status is updated. ## Documentation -Please see our [online product documentation](https://docs.linuxfoundation.org/lfx/easycla) for a complete product +Please see our [online product documentation](https://docs.linuxfoundation.org/lfx/v/v2/easycla) for a complete product overview. ## License diff --git a/edge/security-headers.js b/edge/security-headers.js index 4f03410a..e6d7df33 100644 --- a/edge/security-headers.js +++ b/edge/security-headers.js @@ -40,10 +40,7 @@ function generateCSP(env, isDevServer) { 'https://api-gw.staging.platform.linuxfoundation.org/', 'https://api-gw.platform.linuxfoundation.org/', 'https://api.lfcla.staging.platform.linuxfoundation.org/', - 'https://api.lfcla.dev.platform.linuxfoundation.org/', - 'https://easycla.dev.communitybridge.org/', - 'https://easycla.lfx.linuxfoundation.org/', - 'https://contributor.easycla.lfx.linuxfoundation.org/' + 'https://api.lfcla.dev.platform.linuxfoundation.org/' ]; let scriptSources = [SELF, UNSAFE_EVAL, UNSAFE_INLINE, 'https://cdn.dev.platform.linuxfoundation.org/lfx-header-v2.js', diff --git a/package.json b/package.json index 95d42662..6aebc38f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "https://www.linuxfoundation.org/" }, "engines": { - "node": ">=12.0.0", + "node": ">=16.0.0", "npm": ">=8.0.0" }, "version": "1.0.0", @@ -56,10 +56,9 @@ "@fortawesome/fontawesome-free": "^6.4.0", "@ng-bootstrap/ng-bootstrap": "^6.1.0", "@silvermine/serverless-plugin-cloudfront-lambda-edge": "^2.1.1", - "@linuxfoundation/lfx-ui-core": "^0.0.12", - "aws-sdk": "2.1558.0", "@types/node": "^18.16.0", "auth0-spa-js": "^1.6.5", + "aws-sdk": "2.1558.0", "bootstrap": "^4.4.0", "file-saver": "^2.0.5", "query-string": "^6.13.8", diff --git a/serverless.yml b/serverless.yml index e510f390..83253a36 100644 --- a/serverless.yml +++ b/serverless.yml @@ -12,7 +12,7 @@ package: provider: name: aws - runtime: nodejs16.x + runtime: nodejs14.x stage: ${opt:stage} region: us-east-1 # Region can't be configurable, lambda@edge is us-east-1 only. deploymentBucket: diff --git a/src/app/app.component.html b/src/app/app.component.html index 45c48a6a..77f4c2f6 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -4,6 +4,7 @@
- +
+ diff --git a/src/app/app.component.scss b/src/app/app.component.scss index 8ad4ef07..a4c3bd39 100644 --- a/src/app/app.component.scss +++ b/src/app/app.component.scss @@ -1,7 +1,12 @@ /* Copyright The Linux Foundation and each contributor to CommunityBridge. SPDX-License-Identifier: MIT */ .fix-header-margin { - margin-top: 35px; - padding: 25px 0 0 0; - min-height: calc(100vh - 125px); -} \ No newline at end of file + transition: margin 0.3s; + margin-top: 25px; + padding: 25px 0; + min-height: calc(100vh - 167px); + &.expanded { + margin-top: 100px; + min-height: calc(100vh - 242px); + } +} diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 76bee0ef..e2cbffae 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,10 +1,10 @@ // Copyright The Linux Foundation and each contributor to CommunityBridge. // SPDX-License-Identifier: MIT - -// To run this project you required node version 12.0.0 or higher, yarn 1.13.0 or higher. - import { Component } from '@angular/core'; +import { AppSettings } from './config/app-settings'; +import { LfxHeaderService } from './shared/services/lfx-header.service'; +import { EnvConfig } from './config/cla-env-utils'; import { environment } from 'src/environments/environment'; @Component({ @@ -13,9 +13,20 @@ import { environment } from 'src/environments/environment'; styleUrls: ['./app.component.scss'], }) export class AppComponent { + title = 'easycla-contributor-console'; + hasExpanded: boolean; + links: any[]; + + constructor(private lfxHeaderService: LfxHeaderService) {} + + onToggled() { + this.hasExpanded = !this.hasExpanded; + } ngOnInit() { this.mountHeader(); + this.hasExpanded = true; + this.mountFooter(); } private mountHeader(): void { @@ -24,4 +35,10 @@ export class AppComponent { script.setAttribute('async', 'true'); document.head.appendChild(script); } + + private mountFooter(): void { + const script = document.createElement('script'); + script.setAttribute('src', EnvConfig.default[AppSettings.LFX_FOOTER]); + document.head.appendChild(script); + } } diff --git a/src/app/config/app-settings.ts b/src/app/config/app-settings.ts index a516d03c..7be02d6a 100644 --- a/src/app/config/app-settings.ts +++ b/src/app/config/app-settings.ts @@ -49,5 +49,4 @@ export class AppSettings { public static GITLAB_DOMAIN = "gitlab.com"; public static GITLAB = "Gitlab"; public static SUPPORT_TICKET_LINK = 'https://jira.linuxfoundation.org/plugins/servlet/theme/portal/4/create/143'; - public static ACCEPTED_TERMS = 'acceptedTerms'; } diff --git a/src/app/config/scripts/prefetch-ssm.js b/src/app/config/scripts/prefetch-ssm.js index 5d06c030..dc9c7de0 100644 --- a/src/app/config/scripts/prefetch-ssm.js +++ b/src/app/config/scripts/prefetch-ssm.js @@ -1,15 +1,17 @@ // Copyright The Linux Foundation and each contributor to CommunityBridge. // SPDX-License-Identifier: MIT + const fs = require('fs'); const RetrieveSSMValues = require('./read-ssm'); const configVarArray = ['auth0-clientId', 'auth0-domain', 'proj-console-link', 'corp-console-link', 'lfx-header', 'lfx-footer', 'corporate-v2-base', 'api-base', 'api-v4-base', 'admin-v2-base']; const region = 'us-east-1'; +const profile = process.env.AWS_PROFILE; const stageEnv = process.env.STAGE_ENV; const AWS_SSM_JSON_PATH = './src/app/config/cla-env-config.json'; async function prefetchSSM() { console.log(`Start to fetch SSM values at ${stageEnv}...`); - const result = await RetrieveSSMValues(configVarArray, stageEnv, region); + const result = await RetrieveSSMValues(configVarArray, stageEnv, region, profile); console.log('Fetching completed.'); //test for local diff --git a/src/app/config/scripts/read-ssm.js b/src/app/config/scripts/read-ssm.js index 6a64660e..49eceb0a 100644 --- a/src/app/config/scripts/read-ssm.js +++ b/src/app/config/scripts/read-ssm.js @@ -1,29 +1,30 @@ +// @ts-check + // Copyright The Linux Foundation and each contributor to CommunityBridge. // SPDX-License-Identifier: MIT const AWS = require('aws-sdk'); -// @ts-check - - /** * @param {string[]} variables * @param {string} stage * @param {string} region + * @param {string} profile * @returns {Promise<{ [key:string]: string}>} */ -async function retrieveSSMValues(variables, stage, region) { +async function retrieveSSMValues(variables, stage, region, profile) { const scopedVariables = variables.map((param) => `cla-${param}-${stage}`); - const result = await requestSSMParameters(scopedVariables, stage, region); + const result = await requestSSMParameters(scopedVariables, stage, region, profile); const parameters = result.Parameters; const error = result.$response.error; if (error !== null) { throw new Error( - `Couldn't retrieve SSM parameters for stage ${stage} in region ${region} - error ${error}` + `Couldn't retrieve SSM parameters for stage ${stage} in region ${region} using profile ${profile} - error ${error}` ); } const scopedParams = createParameterMap(parameters, stage); const params = new Map(); Object.keys(scopedParams).forEach((key) => { + // console.log(`processing ${key}`); const param = scopedParams[key]; key = key.replace('cla-', ''); key = key.replace(`-${stage}`, ''); @@ -33,7 +34,7 @@ async function retrieveSSMValues(variables, stage, region) { variables.forEach((variable) => { if (params[variable] === undefined) { throw new Error( - `Missing SSM parameter with name ${variable} for stage ${stage} in region ${region}`, + `Missing SSM parameter with name ${variable} for stage ${stage} in region ${region} using profile ${profile}`, ); } }); @@ -46,14 +47,20 @@ async function retrieveSSMValues(variables, stage, region) { * @param {string[]} variables * @param {string} stage * @param {string} region + * @param {string} profile */ -async function requestSSMParameters(variables, stage, region) { +async function requestSSMParameters(variables, stage, region, profile) { + console.log(`Loading AWS credentials from profile: ${profile}`) + AWS.config.credentials = new AWS.SharedIniFileCredentials({ profile }); const ssm = new AWS.SSM({ region }); const ps = { Names: variables, WithDecryption: true }; + // console.log(AWS.config.credentials); + // console.log(`fetching ssm parameters: ${variables}`); const response = await ssm.getParameters(ps).promise(); + // console.log(response); return response; } diff --git a/src/app/modules/corporate-contributor/container/corporate-dashboard/corporate-dashboard.component.html b/src/app/modules/corporate-contributor/container/corporate-dashboard/corporate-dashboard.component.html index 1a5d17ab..d77e60f9 100644 --- a/src/app/modules/corporate-contributor/container/corporate-dashboard/corporate-dashboard.component.html +++ b/src/app/modules/corporate-contributor/container/corporate-dashboard/corporate-dashboard.component.html @@ -102,14 +102,8 @@ - -
-
- -
-
-
+
+
diff --git a/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.html b/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.html index 27042739..074965b3 100644 --- a/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.html +++ b/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.html @@ -1,7 +1,7 @@ -
-
Welcome to Gerrit Window
-
wait ... We are trying to login LFX portal
-
If you are still viewing this screen, please click here
+
+
+
You are being redirected to the login page.
+
diff --git a/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.scss b/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.scss index d3b83b59..e416648b 100644 --- a/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.scss +++ b/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.scss @@ -1,28 +1,9 @@ /* Copyright The Linux Foundation and each contributor to CommunityBridge. SPDX-License-Identifier: MIT -->*/ -.container { - .message { - margin-top: calc(100vh / 3); - font-size: 24px; - text-align: center; - font-weight: bold; - } - - .subtitle { - font-size: 18px; - margin-top: 5px; - text-align: center; - font-weight: bold; - } - - .warning { - font-size: 18px; - margin-top: 20px; - text-align: center; - } - - .link { - color: #0099cc; - cursor: pointer; - } +.row { + .message { + font-size: 18px; + text-align: center; + font-weight: bold; + } } diff --git a/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.ts b/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.ts index c17683b0..fd757fc5 100644 --- a/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.ts +++ b/src/app/modules/dashboard/container/gerrit-dashboard/gerrit-dashboard.component.ts @@ -1,32 +1,24 @@ // Copyright The Linux Foundation and each contributor to CommunityBridge. // SPDX-License-Identifier: MIT -import { AfterViewInit, Component, OnInit } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { StorageService } from 'src/app/shared/services/storage.service'; import { AppSettings } from 'src/app/config/app-settings'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { AuthService } from 'src/app/shared/services/auth.service'; -import { ClaContributorService } from 'src/app/core/services/cla-contributor.service'; -import { ProjectModel } from 'src/app/core/models/project'; -import { GerritUserModel } from 'src/app/core/models/gerrit'; -import { AlertService } from 'src/app/shared/services/alert.service'; @Component({ selector: 'app-gerrit-dashboard', templateUrl: './gerrit-dashboard.component.html', - styleUrls: ['./gerrit-dashboard.component.scss'], + styleUrls: ['./gerrit-dashboard.component.scss'] }) -export class GerritDashboardComponent implements OnInit, AfterViewInit { +export class GerritDashboardComponent implements OnInit { projectId: string; contractType: string; - userId: string; constructor( private route: ActivatedRoute, private storageService: StorageService, - private authService: AuthService, - private claContributorService: ClaContributorService, - private router: Router, - private alertService: AlertService + private authService: AuthService ) { this.storageService.removeGithubItems(); } @@ -39,63 +31,7 @@ export class GerritDashboardComponent implements OnInit, AfterViewInit { this.storageService.setItem(AppSettings.HAS_GERRIT, true); this.storageService.setItem(AppSettings.PROJECT_ID, this.projectId); this.storageService.setItem(AppSettings.CONTRACT_TYPE, this.contractType); - } - - ngAfterViewInit(): void { - this.authService.userProfile$.subscribe((data) => { - console.log(data); - if (data) { - this.getGerritProjectInfo(); - this.getUserInfo(); - } else { - this.authService.login(); - } - }); - } - - login(){ this.authService.login(); } - getGerritProjectInfo() { - const projectId = JSON.parse( - this.storageService.getItem(AppSettings.PROJECT_ID) - ); - this.claContributorService.getGerritProjectInfo(projectId).subscribe( - (response: ProjectModel) => { - this.storageService.setItem( - AppSettings.PROJECT_NAME, - response.project_name - ); - this.storageService.setItem(AppSettings.PROJECT, response); - }, - (exception) => { - this.alertService.error(exception); - } - ); - } - - getUserInfo() { - this.claContributorService.getGerritUserInfo().subscribe( - (response: GerritUserModel) => { - this.userId = response.user_id; - this.storageService.setItem(AppSettings.USER_ID, response.user_id); - this.storageService.setItem(AppSettings.USER, response); - this.redirectForGerritFlow(); - }, - (exception) => { - this.alertService.error(exception.error); - } - ); - } - - redirectForGerritFlow() { - if (this.contractType === 'individual') { - const url = '/individual-dashboard/' + this.projectId + '/' + this.userId; - this.router.navigate([url]); - } else if (this.contractType === 'corporate') { - const url = '/corporate-dashboard/' + this.projectId + '/' + this.userId; - this.router.navigate([url]); - } - } } diff --git a/src/app/modules/individual-contributor/component/docusign-signature-model/docusign-signature-model.component.html b/src/app/modules/individual-contributor/component/docusign-signature-model/docusign-signature-model.component.html index bdab4413..2c8ed99e 100644 --- a/src/app/modules/individual-contributor/component/docusign-signature-model/docusign-signature-model.component.html +++ b/src/app/modules/individual-contributor/component/docusign-signature-model/docusign-signature-model.component.html @@ -33,12 +33,6 @@
-
-
- -
-
-
-
diff --git a/src/app/modules/individual-contributor/component/docusign-signature-model/docusign-signature-model.component.ts b/src/app/modules/individual-contributor/component/docusign-signature-model/docusign-signature-model.component.ts index 519d1d32..bd27e5b3 100644 --- a/src/app/modules/individual-contributor/component/docusign-signature-model/docusign-signature-model.component.ts +++ b/src/app/modules/individual-contributor/component/docusign-signature-model/docusign-signature-model.component.ts @@ -19,7 +19,6 @@ export class DocusignSignatureModelComponent { title: string; message: string; - hasTermAccepted = false; constructor( private storageService: StorageService, diff --git a/src/app/modules/individual-contributor/container/individual-dashboard/individual-dashboard.component.ts b/src/app/modules/individual-contributor/container/individual-dashboard/individual-dashboard.component.ts index bf539034..723570a5 100644 --- a/src/app/modules/individual-contributor/container/individual-dashboard/individual-dashboard.component.ts +++ b/src/app/modules/individual-contributor/container/individual-dashboard/individual-dashboard.component.ts @@ -38,7 +38,7 @@ export class IndividualDashboardComponent implements OnInit { this.hasGerrit = JSON.parse(this.storageService.getItem(AppSettings.HAS_GERRIT)); this.status = 'Pending'; if (this.hasGerrit) { - this.postIndividualRequestSignature(); + this.postIndivdualRequestSignature(); } else { this.findActiveSignature(); } @@ -49,7 +49,7 @@ export class IndividualDashboardComponent implements OnInit { (response) => { if (response) { this.activeSignatureModel = response; - this.postIndividualRequestSignature(); + this.postIndivdualRequestSignature(); } else { this.status = 'Failed'; const error = 'Whoops, It looks like you don\'t have any signatures in progress.' + @@ -63,13 +63,12 @@ export class IndividualDashboardComponent implements OnInit { ); } - postIndividualRequestSignature() { - const redirectUrl = JSON.parse(this.storageService.getItem(AppSettings.REDIRECT)); + postIndivdualRequestSignature() { const data = { project_id: this.projectId, user_id: this.userId, return_url_type: this.hasGerrit ? AppSettings.GERRIT :this.claContributorService.getTypeByUrl(), - return_url: this.hasGerrit ? redirectUrl || '' : this.activeSignatureModel.return_url + return_url: this.hasGerrit ? '' : this.activeSignatureModel.return_url }; this.claContributorService.postIndividualSignatureRequest(data).subscribe( (response) => { diff --git a/src/app/shared/components/auth/auth.component.ts b/src/app/shared/components/auth/auth.component.ts index dd0fa887..74d9431e 100644 --- a/src/app/shared/components/auth/auth.component.ts +++ b/src/app/shared/components/auth/auth.component.ts @@ -14,7 +14,7 @@ import { StorageService } from '../../services/storage.service'; @Component({ selector: 'app-auth', templateUrl: './auth.component.html', - styleUrls: ['./auth.component.scss'], + styleUrls: ['./auth.component.scss'] }) export class AuthComponent implements OnInit { message: string; @@ -31,21 +31,14 @@ export class AuthComponent implements OnInit { private claContributorService: ClaContributorService, private alertService: AlertService, private authService: AuthService - ) {} + ) { + } ngOnInit(): void { - this.contractType = JSON.parse( - this.storageService.getItem(AppSettings.CONTRACT_TYPE) - ); - this.hasGerrit = JSON.parse( - this.storageService.getItem(AppSettings.HAS_GERRIT) - ); - this.actionType = JSON.parse( - this.storageService.getItem(AppSettings.ACTION_TYPE) - ); - this.projectId = JSON.parse( - this.storageService.getItem(AppSettings.PROJECT_ID) - ); + this.contractType = JSON.parse(this.storageService.getItem(AppSettings.CONTRACT_TYPE)); + this.hasGerrit = JSON.parse(this.storageService.getItem(AppSettings.HAS_GERRIT)); + this.actionType = JSON.parse(this.storageService.getItem(AppSettings.ACTION_TYPE)); + this.projectId = JSON.parse(this.storageService.getItem(AppSettings.PROJECT_ID)); this.userId = JSON.parse(this.storageService.getItem(AppSettings.USER_ID)); this.previousURL = decodeURIComponent(window.location.hash.split('=')[1]); @@ -53,12 +46,11 @@ export class AuthComponent implements OnInit { this.authService.loading$.subscribe((loading) => { if (!loading) { - this.authService.isAuthenticated$.subscribe((authenticated) => { - console.log(authenticated); + this.authService.isAuthenticated$.subscribe(authenticated => { if (authenticated) { this.handleRedirection(); } else { - // this.authService.login(); + this.authService.login(); } }); } @@ -71,28 +63,22 @@ export class AuthComponent implements OnInit { setMessage() { if (this.actionType === AppSettings.SIGN_CLA) { - this.message = - 'Wait... You are being redirected to the Configure CLA Manager.'; + this.message = 'Wait... You are being redirected to the Configure CLA Manager.'; return; } if (this.hasGerrit) { - this.message = - 'You are being redirected to the ' + - this.contractType + - ' contributor console.'; + this.message = 'You are being redirected to the ' + this.contractType + ' contributor console.'; return; } - this.message = 'Wait... we are loading the screen'; + this.message = 'The page you are looking for was not found.'; } performActionAsPerType() { if (this.actionType === AppSettings.SIGN_CLA) { const url = '/corporate-dashboard/' + this.projectId + '/' + this.userId; - this.router.navigate([url], { - queryParams: { view: AppSettings.SIGN_CLA }, - }); + this.router.navigate([url], { queryParams: { view: AppSettings.SIGN_CLA } }); return; } @@ -107,13 +93,9 @@ export class AuthComponent implements OnInit { return; } else { // Redirect to landing page. - const redirectUrl = JSON.parse( - this.storageService.getItem(AppSettings.REDIRECT) - ); - this.router.navigate( - ['/cla/project/' + this.projectId + '/user/' + this.userId], - { queryParams: { redirect: redirectUrl } } - ); + const redirectUrl = JSON.parse(this.storageService.getItem(AppSettings.REDIRECT)); + this.router.navigate(['/cla/project/' + this.projectId + '/user/' + this.userId], + { queryParams: { redirect: redirectUrl } }); } // *todo: handle default case @@ -128,8 +110,7 @@ export class AuthComponent implements OnInit { this.redirectForGerritFlow(); }, (exception) => { - this.message = - 'Failed to redirect on a ' + this.contractType + ' console.'; + this.message = 'Failed to redirect on a ' + this.contractType + ' console.'; this.alertService.error(exception.error); } ); @@ -163,15 +144,11 @@ export class AuthComponent implements OnInit { getGerritProjectInfo() { this.claContributorService.getGerritProjectInfo(this.projectId).subscribe( (response: ProjectModel) => { - this.storageService.setItem( - AppSettings.PROJECT_NAME, - response.project_name - ); + this.storageService.setItem(AppSettings.PROJECT_NAME, response.project_name); this.storageService.setItem(AppSettings.PROJECT, response); }, (exception) => { - this.message = - 'Failed to redirect on a ' + this.contractType + ' console.'; + this.message = 'Failed to redirect on a ' + this.contractType + ' console.'; this.claContributorService.handleError(exception); } ); @@ -188,4 +165,5 @@ export class AuthComponent implements OnInit { this.message = 'Contract type is invalid.'; } } + } diff --git a/src/app/shared/components/checkbox/checkbox.component.html b/src/app/shared/components/checkbox/checkbox.component.html index 0e9d75f0..788305e8 100644 --- a/src/app/shared/components/checkbox/checkbox.component.html +++ b/src/app/shared/components/checkbox/checkbox.component.html @@ -2,10 +2,7 @@ SPDX-License-Identifier: MIT --> + + \ No newline at end of file diff --git a/src/app/shared/components/checkbox/checkbox.component.ts b/src/app/shared/components/checkbox/checkbox.component.ts index 97749deb..46471f60 100644 --- a/src/app/shared/components/checkbox/checkbox.component.ts +++ b/src/app/shared/components/checkbox/checkbox.component.ts @@ -11,10 +11,6 @@ import { Component, Input, EventEmitter, Output } from '@angular/core'; export class CheckboxComponent { @Input() checked: boolean; @Input() text: string; - @Input() fontSize: string; - @Input() topMargin: string; - @Input() bold: boolean; - @Input() required: boolean; @Output() checkboxEmitter: EventEmitter = new EventEmitter(); constructor() {} diff --git a/src/app/shared/services/auth.service.ts b/src/app/shared/services/auth.service.ts index cf07914f..7aa09193 100644 --- a/src/app/shared/services/auth.service.ts +++ b/src/app/shared/services/auth.service.ts @@ -81,19 +81,18 @@ export class AuthService { async initializeApplication() { // On initial load, check authentication state with authorization server // Set up local auth streams if user is already authenticated - // const params = this.currentHref; - // console.log(params) - // if (params.includes('code=') && params.includes('state=')) { - // console.log('Auth0 code and state are found.'); - // this.handleAuthCallback(); - // return; - // } + const params = this.currentHref; + if (params.includes('code=') && params.includes('state=')) { + console.log('Auth0 code and state are found.'); + this.handleAuthCallback(); + return; + } await this.localAuthSetup(); - this.handlerReturnToAfterLogout(); + this.handlerReturnToAferlogout(); } - handlerReturnToAfterLogout() { + handlerReturnToAferlogout() { const hasGerrit = JSON.parse(this.storageService.getItem(AppSettings.HAS_GERRIT)); this.storageService.removeItem(AppSettings.AUTH_DATA); if (!hasGerrit) { @@ -103,6 +102,8 @@ export class AuthService { const target = this.getTargetRouteFromReturnTo(returnTo); this.router.navigate([target]); } + } else { + this.login(); } } // When calling, options can be passed if desired diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index ade16a1c..fd4a95a9 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -17,8 +17,6 @@ import { LfxHeaderService } from './services/lfx-header.service'; import { InterceptorService } from './services/interceptor.service'; import { AuthComponent } from './components/auth/auth.component'; import { FooterComponent } from './components/footer/footer.component'; -import { CommonModule } from '@angular/common'; -import { ConsentComponent } from './components/consent/consent.component'; @NgModule({ declarations: [ @@ -32,11 +30,10 @@ import { ConsentComponent } from './components/consent/consent.component'; TrimCharactersPipe, CheckboxComponent, AuthComponent, - FooterComponent, - ConsentComponent + FooterComponent ], imports: [ - CommonModule + ], exports: [ HeaderComponent, @@ -48,8 +45,7 @@ import { ConsentComponent } from './components/consent/consent.component'; ProjectTitleComponent, TrimCharactersPipe, CheckboxComponent, - FooterComponent, - ConsentComponent + FooterComponent ], providers: [StorageService, AuthService, LfxHeaderService, InterceptorService] }) diff --git a/src/main.ts b/src/main.ts index 5f2879b5..4a19aed3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,7 @@ import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import '@linuxfoundation/lfx-ui-core'; + import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; diff --git a/yarn.lock b/yarn.lock index 46f3b87b..d955fbde 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1442,11 +1442,6 @@ resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== -"@linuxfoundation/lfx-ui-core@^0.0.12": - version "0.0.12" - resolved "https://registry.yarnpkg.com/@linuxfoundation/lfx-ui-core/-/lfx-ui-core-0.0.12.tgz#69b89fb82bc3ddc2343f140a87c5c43bae230801" - integrity sha512-yOGk9URri2/Ojp611cCloORO0PuMdjJD8Og6emhLV9+dMvArweTRzLTTOsTAJp7Y1ZtzZA81xMG24nwu/0fyag== - "@ng-bootstrap/ng-bootstrap@^6.1.0": version "6.2.0" resolved "https://registry.yarnpkg.com/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-6.2.0.tgz#0506d612ca6002bd8fa398d006fa2641013e11d4" @@ -2507,10 +2502,10 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -aws-sdk@2.1558.0: - version "2.1558.0" - resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1558.0.tgz#e62f58a1ef3886a57b9e524b65541ad6efad0a30" - integrity sha512-lxaPHlLg5EfVK5yg2dAJ1k1BJgxUoTODYk8yMPFAjMwNIN302b8D8XYNucstm7urgiykW3zEtRDeNaX9oc6RQA== +aws-sdk@2.1363.0: + version "2.1363.0" + resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1363.0.tgz#30c3b7fe999ee2ba1103a533ea27e1b0f5708e1f" + integrity sha512-M2MZZXehgi/EMQv5GlzRkn3TlhoOYHg2cYdSAAqhjv67WaEG50MjaQy5vRvfN1i8XvB24aJFJ5pCrx69TaCaIg== dependencies: buffer "4.9.2" events "1.1.1" @@ -2521,7 +2516,7 @@ aws-sdk@2.1558.0: url "0.10.3" util "^0.12.4" uuid "8.0.0" - xml2js "0.6.2" + xml2js "0.5.0" aws-sdk@^2.1404.0: version "2.1407.0" @@ -11229,7 +11224,7 @@ ws@^6.2.1, ws@^7.5.3, ws@^7.5.5, ws@^7.5.9, ws@~8.11.0: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== -xml2js@0.5.0, xml2js@0.6.2, xml2js@^0.4.17, xml2js@^0.5.0: +xml2js@0.5.0, xml2js@^0.4.17, xml2js@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.5.0.tgz#d9440631fbb2ed800203fad106f2724f62c493b7" integrity sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==