Skip to content

Commit 2377811

Browse files
authored
Merge pull request #153 from dealako/feature/standalone-redirect
Added Standalone Redirect Logic
2 parents 6eb8fbe + 6f32e00 commit 2377811

File tree

3 files changed

+66
-55
lines changed

3 files changed

+66
-55
lines changed

src/app/core/models/project.ts

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,68 @@
11
// Copyright The Linux Foundation and each contributor to CommunityBridge.
22
// SPDX-License-Identifier: MIT
3+
// This is actually a CLA Group model (but we call it ProjectModel for historical reasons)
34
export class ProjectModel {
4-
date_created: Date;
5-
date_modified: Date;
6-
foundation_sfid: string;
7-
project_acl: string[];
8-
project_ccla_enabled: boolean;
9-
project_ccla_requires_icla_signature: boolean;
10-
project_corporate_documents: ProjectCorporateDocument[];
11-
project_icla_enabled: boolean;
12-
project_id: string;
13-
project_individual_documents: ProjectIndividualDocument[];
14-
project_member_documents: any[];
15-
project_name: string;
16-
project_name_lower: string;
17-
version: string;
18-
logoUrl: string;
19-
projects: Project[];
20-
signed_at_foundation_level: boolean;
5+
date_created: Date;
6+
date_modified: Date;
7+
foundation_sfid: string;
8+
project_acl: string[];
9+
project_ccla_enabled: boolean;
10+
project_ccla_requires_icla_signature: boolean;
11+
project_corporate_documents: ProjectCorporateDocument[];
12+
project_icla_enabled: boolean;
13+
project_id: string;
14+
project_individual_documents: ProjectIndividualDocument[];
15+
project_member_documents: any[];
16+
project_name: string;
17+
project_name_lower: string;
18+
version: string;
19+
logoUrl: string;
20+
projects: Project[];
21+
signed_at_foundation_level: boolean;
2122
}
2223

2324
export class ProjectCorporateDocument {
24-
document_name: string;
25-
document_file_id: string;
26-
document_content_type: string;
27-
document_content?: any;
28-
document_author_name: string;
29-
document_major_version: number;
30-
document_minor_version: number;
31-
document_creation_date: Date;
32-
document_preamble: string;
33-
document_legal_entity_name: string;
34-
document_s3_url: string;
35-
document_tabs: string[][];
25+
document_name: string;
26+
document_file_id: string;
27+
document_content_type: string;
28+
document_content?: any;
29+
document_author_name: string;
30+
document_major_version: number;
31+
document_minor_version: number;
32+
document_creation_date: Date;
33+
document_preamble: string;
34+
document_legal_entity_name: string;
35+
document_s3_url: string;
36+
document_tabs: string[][];
3637
}
3738

3839
export class ProjectIndividualDocument {
39-
document_name: string;
40-
document_file_id: string;
41-
document_content_type: string;
42-
document_content?: any;
43-
document_author_name: string;
44-
document_major_version: number;
45-
document_minor_version: number;
46-
document_creation_date: Date;
47-
document_preamble: string;
48-
document_legal_entity_name: string;
49-
document_s3_url: string;
50-
document_tabs: string[][];
40+
document_name: string;
41+
document_file_id: string;
42+
document_content_type: string;
43+
document_content?: any;
44+
document_author_name: string;
45+
document_major_version: number;
46+
document_minor_version: number;
47+
document_creation_date: Date;
48+
document_preamble: string;
49+
document_legal_entity_name: string;
50+
document_s3_url: string;
51+
document_tabs: string[][];
5152
}
5253

53-
54+
// Project CLA Group mapping record/model
5455
export class Project {
55-
cla_group_id: string;
56-
cla_group_name: string;
57-
date_created: Date;
58-
date_modified: Date;
59-
foundation_name?: any;
60-
foundation_sfid: string;
61-
note?: any;
62-
project_name: string;
63-
project_sfid: string;
64-
repositories_count: string;
65-
version: string;
56+
cla_group_id: string;
57+
cla_group_name: string;
58+
date_created: Date;
59+
date_modified: Date;
60+
foundation_name?: any;
61+
foundation_sfid: string;
62+
note?: any;
63+
project_name: string;
64+
project_sfid: string;
65+
repositories_count: string;
66+
standalone_project: boolean;
67+
version: string;
6668
}

src/app/core/services/cla-contributor.service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,21 @@ export class ClaContributorService {
173173

174174
getLFXCorporateURL(): string {
175175
let url = '';
176+
// Load the CLA Group models from local storage - should only be 1 CLA Group
176177
const project: ProjectModel = JSON.parse(this.storageService.getItem(AppSettings.PROJECT));
178+
// We may have zero or more SF Projects attached to this CLA Group
177179
const projectDetails = project.projects;
180+
181+
// No SF Projects for this CLA Group
178182
if (projectDetails.length === 0) {
179183
// No SFID associated with project so redirect at corporate console dashboard.
180184
url = environment.lfxCorporateUrl + 'company/dashboard';
181185
} else if (project.signed_at_foundation_level) {
182186
// Signed at foundation level.
183187
url = environment.lfxCorporateUrl + 'foundation/' + projectDetails[0].foundation_sfid + '/cla';
188+
} else if (projectDetails[0].standalone_project) {
189+
// Standalone project
190+
url = environment.lfxCorporateUrl + 'foundation/LF%20Supported/project/' + projectDetails[0].project_sfid + '/cla';
184191
} else {
185192
// Signed at project level.
186193
url = environment.lfxCorporateUrl + 'foundation/' + projectDetails[0].foundation_sfid + '/project/' + projectDetails[0].project_sfid + '/cla';

tslint.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@
116116
"options": [
117117
"ban-keywords",
118118
"check-format",
119-
"allow-pascal-case"
119+
"allow-pascal-case",
120+
"allow-leading-underscore",
121+
"allow-snake-case"
120122
]
121123
},
122124
"whitespace": {
@@ -145,4 +147,4 @@
145147
"rulesDirectory": [
146148
"codelyzer"
147149
]
148-
}
150+
}

0 commit comments

Comments
 (0)