Skip to content

Commit

Permalink
Reset to main
Browse files Browse the repository at this point in the history
Signed-off-by: Amol Sontakke <amols@proximabiz.com>
  • Loading branch information
amolsontakke3576 committed Dec 16, 2024
1 parent 1005f4d commit b1e45ef
Show file tree
Hide file tree
Showing 27 changed files with 127 additions and 229 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions edge/security-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<div class="fix-header-margin">
<app-alert></app-alert>
<router-outlet></router-outlet>
<router-outlet></router-outlet>
</div>

<lfx-footer></lfx-footer>
13 changes: 9 additions & 4 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -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);
}
transition: margin 0.3s;
margin-top: 25px;
padding: 25px 0;
min-height: calc(100vh - 167px);
&.expanded {
margin-top: 100px;
min-height: calc(100vh - 242px);
}
}
23 changes: 20 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -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 {
Expand All @@ -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);
}
}
1 change: 0 additions & 1 deletion src/app/config/app-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
4 changes: 3 additions & 1 deletion src/app/config/scripts/prefetch-ssm.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
23 changes: 15 additions & 8 deletions src/app/config/scripts/read-ssm.js
Original file line number Diff line number Diff line change
@@ -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}`, '');
Expand All @@ -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}`,
);
}
});
Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,8 @@
</div>
</div>
</div>

<div class="row justify-content-center" style="margin: 30px 0 30px 0;">
<div class="col-12">
<app-consent (termAccepted)="hasTermAccepted = $event"></app-consent>
</div>
</div>

<div class="col-12 buttons">
<div class="col-12 buttons" [ngClass]="{ 'mt-30': selectedCompany }">
<div class="row justify-content-center align-items-center">
<div class="col-xs-6 col-sm-6 col-md-4 col-lg-3">
<button
Expand All @@ -125,9 +119,9 @@
<button
tabindex="-1"
type="button"
[disabled]="selectedCompany === '' || !hasTermAccepted"
[disabled]="selectedCompany === ''"
class="btn inactive"
[ngClass]="{ active: selectedCompany !== '' && hasTermAccepted }"
[ngClass]="{ active: selectedCompany !== '' }"
(click)="onClickProceed()"
>
Proceed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
position: relative;
}

.mt-30 {
margin-top: 30px !important;
}

.building-icon {
float: right;
margin-top: -32px;
Expand Down Expand Up @@ -105,6 +109,7 @@
}

.buttons {
margin-top: 100px;
.btn {
text-align: center;
background: #ffffff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export class CorporateDashboardComponent implements OnInit, OnDestroy {
mySubscription: Subscription;
proccedWithExistingOrganization: Subscription;
attempt: boolean;
hasTermAccepted = false;

constructor(
private route: ActivatedRoute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
</div>
</div>
</div>

<div class="deskop-view">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Copyright The Linux Foundation and each contributor to CommunityBridge.
SPDX-License-Identifier: MIT -->
<div class="container">
<div class="message">Welcome to Gerrit Window </div>
<div class="subtitle">wait ... We are trying to login LFX portal</div>
<div class="warning">If you are still viewing this screen, please <a class="link" (click)="login()">click here</a></div>
<div class="container-fluid">
<div class="row justify-content-center align-items-center">
<div class="col-auto message">You are being redirected to the login page.</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -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;
}
}
Loading

0 comments on commit b1e45ef

Please sign in to comment.