Skip to content

Commit b1e45ef

Browse files
Reset to main
Signed-off-by: Amol Sontakke <[email protected]>
1 parent 1005f4d commit b1e45ef

27 files changed

+127
-229
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Once the CLA is signed, the GitHub pull request status is updated.
2626

2727
## Documentation
2828

29-
Please see our [online product documentation](https://docs.linuxfoundation.org/lfx/easycla) for a complete product
29+
Please see our [online product documentation](https://docs.linuxfoundation.org/lfx/v/v2/easycla) for a complete product
3030
overview.
3131

3232
## License

edge/security-headers.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ function generateCSP(env, isDevServer) {
4040
'https://api-gw.staging.platform.linuxfoundation.org/',
4141
'https://api-gw.platform.linuxfoundation.org/',
4242
'https://api.lfcla.staging.platform.linuxfoundation.org/',
43-
'https://api.lfcla.dev.platform.linuxfoundation.org/',
44-
'https://easycla.dev.communitybridge.org/',
45-
'https://easycla.lfx.linuxfoundation.org/',
46-
'https://contributor.easycla.lfx.linuxfoundation.org/'
43+
'https://api.lfcla.dev.platform.linuxfoundation.org/'
4744
];
4845
let scriptSources = [SELF, UNSAFE_EVAL, UNSAFE_INLINE,
4946
'https://cdn.dev.platform.linuxfoundation.org/lfx-header-v2.js',

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://www.linuxfoundation.org/"
88
},
99
"engines": {
10-
"node": ">=12.0.0",
10+
"node": ">=16.0.0",
1111
"npm": ">=8.0.0"
1212
},
1313
"version": "1.0.0",
@@ -56,10 +56,9 @@
5656
"@fortawesome/fontawesome-free": "^6.4.0",
5757
"@ng-bootstrap/ng-bootstrap": "^6.1.0",
5858
"@silvermine/serverless-plugin-cloudfront-lambda-edge": "^2.1.1",
59-
"@linuxfoundation/lfx-ui-core": "^0.0.12",
60-
"aws-sdk": "2.1558.0",
6159
"@types/node": "^18.16.0",
6260
"auth0-spa-js": "^1.6.5",
61+
"aws-sdk": "2.1558.0",
6362
"bootstrap": "^4.4.0",
6463
"file-saver": "^2.0.5",
6564
"query-string": "^6.13.8",

serverless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ package:
1212

1313
provider:
1414
name: aws
15-
runtime: nodejs16.x
15+
runtime: nodejs14.x
1616
stage: ${opt:stage}
1717
region: us-east-1 # Region can't be configurable, lambda@edge is us-east-1 only.
1818
deploymentBucket:

src/app/app.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
<div class="fix-header-margin">
66
<app-alert></app-alert>
7-
<router-outlet></router-outlet>
7+
<router-outlet></router-outlet>
88
</div>
9+
910
<lfx-footer></lfx-footer>

src/app/app.component.scss

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
/* Copyright The Linux Foundation and each contributor to CommunityBridge.
22
SPDX-License-Identifier: MIT */
33
.fix-header-margin {
4-
margin-top: 35px;
5-
padding: 25px 0 0 0;
6-
min-height: calc(100vh - 125px);
7-
}
4+
transition: margin 0.3s;
5+
margin-top: 25px;
6+
padding: 25px 0;
7+
min-height: calc(100vh - 167px);
8+
&.expanded {
9+
margin-top: 100px;
10+
min-height: calc(100vh - 242px);
11+
}
12+
}

src/app/app.component.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright The Linux Foundation and each contributor to CommunityBridge.
22
// SPDX-License-Identifier: MIT
33

4-
5-
// To run this project you required node version 12.0.0 or higher, yarn 1.13.0 or higher.
6-
74
import { Component } from '@angular/core';
5+
import { AppSettings } from './config/app-settings';
6+
import { LfxHeaderService } from './shared/services/lfx-header.service';
7+
import { EnvConfig } from './config/cla-env-utils';
88
import { environment } from 'src/environments/environment';
99

1010
@Component({
@@ -13,9 +13,20 @@ import { environment } from 'src/environments/environment';
1313
styleUrls: ['./app.component.scss'],
1414
})
1515
export class AppComponent {
16+
title = 'easycla-contributor-console';
17+
hasExpanded: boolean;
18+
links: any[];
19+
20+
constructor(private lfxHeaderService: LfxHeaderService) {}
21+
22+
onToggled() {
23+
this.hasExpanded = !this.hasExpanded;
24+
}
1625

1726
ngOnInit() {
1827
this.mountHeader();
28+
this.hasExpanded = true;
29+
this.mountFooter();
1930
}
2031

2132
private mountHeader(): void {
@@ -24,4 +35,10 @@ export class AppComponent {
2435
script.setAttribute('async', 'true');
2536
document.head.appendChild(script);
2637
}
38+
39+
private mountFooter(): void {
40+
const script = document.createElement('script');
41+
script.setAttribute('src', EnvConfig.default[AppSettings.LFX_FOOTER]);
42+
document.head.appendChild(script);
43+
}
2744
}

src/app/config/app-settings.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,4 @@ export class AppSettings {
4949
public static GITLAB_DOMAIN = "gitlab.com";
5050
public static GITLAB = "Gitlab";
5151
public static SUPPORT_TICKET_LINK = 'https://jira.linuxfoundation.org/plugins/servlet/theme/portal/4/create/143';
52-
public static ACCEPTED_TERMS = 'acceptedTerms';
5352
}

src/app/config/scripts/prefetch-ssm.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
// Copyright The Linux Foundation and each contributor to CommunityBridge.
22
// SPDX-License-Identifier: MIT
3+
34
const fs = require('fs');
45
const RetrieveSSMValues = require('./read-ssm');
56
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'];
67
const region = 'us-east-1';
8+
const profile = process.env.AWS_PROFILE;
79
const stageEnv = process.env.STAGE_ENV;
810
const AWS_SSM_JSON_PATH = './src/app/config/cla-env-config.json';
911

1012
async function prefetchSSM() {
1113
console.log(`Start to fetch SSM values at ${stageEnv}...`);
12-
const result = await RetrieveSSMValues(configVarArray, stageEnv, region);
14+
const result = await RetrieveSSMValues(configVarArray, stageEnv, region, profile);
1315
console.log('Fetching completed.');
1416

1517
//test for local

src/app/config/scripts/read-ssm.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
1+
// @ts-check
2+
13
// Copyright The Linux Foundation and each contributor to CommunityBridge.
24
// SPDX-License-Identifier: MIT
35
const AWS = require('aws-sdk');
46

5-
// @ts-check
6-
7-
87
/**
98
* @param {string[]} variables
109
* @param {string} stage
1110
* @param {string} region
11+
* @param {string} profile
1212
* @returns {Promise<{ [key:string]: string}>}
1313
*/
14-
async function retrieveSSMValues(variables, stage, region) {
14+
async function retrieveSSMValues(variables, stage, region, profile) {
1515
const scopedVariables = variables.map((param) => `cla-${param}-${stage}`);
16-
const result = await requestSSMParameters(scopedVariables, stage, region);
16+
const result = await requestSSMParameters(scopedVariables, stage, region, profile);
1717
const parameters = result.Parameters;
1818
const error = result.$response.error;
1919
if (error !== null) {
2020
throw new Error(
21-
`Couldn't retrieve SSM parameters for stage ${stage} in region ${region} - error ${error}`
21+
`Couldn't retrieve SSM parameters for stage ${stage} in region ${region} using profile ${profile} - error ${error}`
2222
);
2323
}
2424
const scopedParams = createParameterMap(parameters, stage);
2525
const params = new Map();
2626
Object.keys(scopedParams).forEach((key) => {
27+
// console.log(`processing ${key}`);
2728
const param = scopedParams[key];
2829
key = key.replace('cla-', '');
2930
key = key.replace(`-${stage}`, '');
@@ -33,7 +34,7 @@ async function retrieveSSMValues(variables, stage, region) {
3334
variables.forEach((variable) => {
3435
if (params[variable] === undefined) {
3536
throw new Error(
36-
`Missing SSM parameter with name ${variable} for stage ${stage} in region ${region}`,
37+
`Missing SSM parameter with name ${variable} for stage ${stage} in region ${region} using profile ${profile}`,
3738
);
3839
}
3940
});
@@ -46,14 +47,20 @@ async function retrieveSSMValues(variables, stage, region) {
4647
* @param {string[]} variables
4748
* @param {string} stage
4849
* @param {string} region
50+
* @param {string} profile
4951
*/
50-
async function requestSSMParameters(variables, stage, region) {
52+
async function requestSSMParameters(variables, stage, region, profile) {
53+
console.log(`Loading AWS credentials from profile: ${profile}`)
54+
AWS.config.credentials = new AWS.SharedIniFileCredentials({ profile });
5155
const ssm = new AWS.SSM({ region });
5256
const ps = {
5357
Names: variables,
5458
WithDecryption: true
5559
};
60+
// console.log(AWS.config.credentials);
61+
// console.log(`fetching ssm parameters: ${variables}`);
5662
const response = await ssm.getParameters(ps).promise();
63+
// console.log(response);
5764
return response;
5865
}
5966

0 commit comments

Comments
 (0)