Skip to content

Commit 4db37c2

Browse files
committed
Pre 2021 version
1 parent be514c6 commit 4db37c2

27 files changed

+418
-396
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@
1818

1919
# System Files
2020
.DS_Store
21-
Thumbs.db
21+
Thumbs.db
22+
/Playground.puml
23+
/todo.txt

CGIAR-QA-front/src/app/_helpers/auth.guard.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ export class AuthGuard implements CanActivate {
4545
return false;
4646
}
4747

48-
private validateRole(available_roles: [], currentUser) {
48+
validateRole(available_roles: [], currentUser) {
4949
let userRoles = currentUser.roles.map(role => { return role ? role['description'] : null });
5050
let hasCRP = currentUser.crp ? true : false;
5151
let found = intersectionWith(available_roles, userRoles, (a, b) => a === b);
5252
return hasCRP ? hasCRP && found.length > 0 : found.length > 0
5353
}
5454

55-
private validateConfig(currentUser) {
55+
validateConfig(currentUser) {
5656
if (!currentUser.config.length) return true;
5757
if (currentUser.config[0].status !== GeneralStatus.Close) return false;
5858
return false;
5959
}
60-
private validateCycle(currentUser) {
60+
validateCycle(currentUser) {
6161
let isAssessor = currentUser.roles.map(role => { return role ? role['description'] : null }).find(role => { return role === Role.asesor });
6262
// console.log('validateCycle', isAdmin ? false : !currentUser.hasOwnProperty('cycle'));
6363
return isAssessor && !currentUser.hasOwnProperty('cycle') ? true : false;
Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
export class CRP {
2-
private id: number;
3-
private name: string;
4-
private crp_id: string;
5-
private acronym: string;
6-
private is_marlo: boolean;
7-
private createdAt?: Date;
8-
private updatedAt?: Date;
2+
id: number;
3+
name: string;
4+
crp_id: string;
5+
acronym: string;
6+
is_marlo: boolean;
7+
createdAt?: Date;
8+
updatedAt?: Date;
9+
10+
constructor(id, name, crp_id, acronym, is_marlo) {
11+
this.id = id;
12+
this.name = name;
13+
this.crp_id = crp_id;
14+
this.acronym = acronym;
15+
this.is_marlo = is_marlo;
16+
this.createdAt = new Date();
17+
this.updatedAt = new Date();
18+
}
919
}
Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
export class User {
22
id: number;
3-
private username: string;
4-
private email: string;
5-
private password: string;
3+
username: string;
4+
email: string;
5+
password: string;
66
roles:any[];
77
config:any[];
8-
private cycle:any;
9-
private indicators:any[];
8+
cycle:any;
9+
indicators:any[];
1010
crp:any;
11-
private name: string;
12-
private cycle_ended:any;
11+
name: string;
12+
cycle_ended:any;
1313
token: string;
14+
15+
// constructor(id, name, crp_id, acronym, is_marlo) {
16+
// this.id = id;
17+
// this.name = name;
18+
// this.crp_id = crp_id;
19+
// this.acronym = acronym;
20+
// this.is_marlo = is_marlo;
21+
// this.createdAt = new Date();
22+
// this.updatedAt = new Date();
23+
// }
1424
}

CGIAR-QA-front/src/app/_shared/alert/alert.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { AlertService } from '../../services/alert.service';
55

66
@Component({ selector: 'alert', templateUrl: 'alert.component.html' })
77
export class AlertComponent implements OnInit, OnDestroy {
8-
private subscription: Subscription;
9-
private message: any;
8+
subscription: Subscription;
9+
message: any;
1010

1111
constructor(private alertService: AlertService) { }
1212

CGIAR-QA-front/src/app/_shared/header-bar/header-bar.component.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import { GeneralStatus } from '../../_models/general-status.model';
1717
styleUrls: ['./header-bar.component.scss']
1818
})
1919
export class HeaderBarComponent implements OnInit {
20-
private currentUser: User;
21-
private allRoles = Role;
22-
private generalStatus = GeneralStatus;
23-
private indicators = [];
24-
private currentRole = '';
25-
private params;
20+
currentUser: User;
21+
allRoles = Role;
22+
generalStatus = GeneralStatus;
23+
indicators = [];
24+
currentRole = '';
25+
params;
2626

27-
private isHome ;
27+
isHome ;
2828

2929
constructor(private activeRoute: ActivatedRoute, private authenticationService: AuthenticationService, public router: Router, private indicatorService: IndicatorsService, private alertService: AlertService) {
3030
this.activeRoute.params.subscribe(routeParams => {
@@ -43,7 +43,7 @@ export class HeaderBarComponent implements OnInit {
4343

4444
}
4545

46-
private getCurrentRoute(){
46+
getCurrentRoute(){
4747
return this.router.isActive( `/dashboard/${this.currentRole}` , true);
4848
}
4949

@@ -52,7 +52,7 @@ export class HeaderBarComponent implements OnInit {
5252
// this.getHeaderLinks();
5353
}
5454

55-
private goToView(indicator: any) {
55+
goToView(indicator: any) {
5656
// //console.log(this.router.navigate(['/reload']), this.activeRoute.pathFromRoot.toString(), this.router.url.toString().indexOf('/indicator'))
5757

5858
if (indicator === 'logo' || indicator === 'home') {
@@ -66,7 +66,7 @@ export class HeaderBarComponent implements OnInit {
6666

6767
}
6868

69-
private getHeaderLinks() {
69+
getHeaderLinks() {
7070
if (this.indicators && !this.indicators.length && this.currentUser && !this.isCRP()) {
7171
this.indicatorService.getIndicatorsByUser(this.currentUser.id).subscribe(
7272
res => {
@@ -83,7 +83,7 @@ export class HeaderBarComponent implements OnInit {
8383

8484
}
8585

86-
private isCRP() {
86+
isCRP() {
8787
if (this.currentUser) {
8888
// let mapped_roles = this.currentUser.roles.map(role => { return role.description });
8989
// let has_roles = mapped_roles.find(role_ => {
@@ -95,7 +95,7 @@ export class HeaderBarComponent implements OnInit {
9595
return false;
9696
}
9797

98-
private logout() {
98+
logout() {
9999
this.authenticationService.logout();
100100
this.router.navigate(['/login']);
101101
}

CGIAR-QA-front/src/app/admin/admin.component.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@ import { Role } from '../_models/roles.model';
1818
})
1919
export class AdminComponent implements OnInit {
2020

21-
private addUserForm: FormGroup;
22-
private editUserForm: FormGroup;
23-
private modalRef: BsModalRef;
21+
addUserForm: FormGroup;
22+
editUserForm: FormGroup;
23+
modalRef: BsModalRef;
2424

25-
private users: User[] = [];
25+
users: User[] = [];
2626

27-
private loading = false;
28-
private submitted = false;
29-
private selectedRole = '';
30-
private allRoles = Role;
31-
private suggestedIndicators = [];
27+
loading = false;
28+
submitted = false;
29+
selectedRole = '';
30+
allRoles = Role;
31+
suggestedIndicators = [];
3232
// [
3333
// 'test',
3434
// 'test1',
3535
// 'test2',
3636
// 'test3',
3737
// ];
38-
private modalConfig = {
38+
modalConfig = {
3939
keyboard: true,
4040
animated: true,
4141
class: 'custom-confirmation modal-lg'
4242
};
43-
private confirmationData = {
43+
confirmationData = {
4444
text: '',
4545
title: '',
4646
type: '',
@@ -80,7 +80,7 @@ export class AdminComponent implements OnInit {
8080
get t() { return this.editUserForm.get('editUserFormArray') as FormArray; }
8181

8282
// load all users
83-
private loadAllUsers() {
83+
loadAllUsers() {
8484
this.loading = true;
8585
this.showSpinner();
8686
this.userService.getAllUsers()
@@ -112,7 +112,7 @@ export class AdminComponent implements OnInit {
112112

113113

114114
//load all indicators
115-
private loadAllIndicators() {
115+
loadAllIndicators() {
116116
this.indicatorService.getIndicators()
117117
.subscribe(res => {
118118
this.suggestedIndicators = res.data;
@@ -124,13 +124,13 @@ export class AdminComponent implements OnInit {
124124

125125

126126
// change between roles
127-
private selectRole(role) {
127+
selectRole(role) {
128128
this.selectedRole = role;
129129
this.resetForm();
130130
}
131131

132132
//add new user
133-
private addUser() {
133+
addUser() {
134134
this.submitted = true;
135135

136136
// stop here if form is invalid
@@ -168,7 +168,7 @@ export class AdminComponent implements OnInit {
168168
}
169169

170170
//delete current user
171-
private deleteUser(id: string) {
171+
deleteUser(id: string) {
172172
this.loading = true;
173173
this.showSpinner();
174174

@@ -188,7 +188,7 @@ export class AdminComponent implements OnInit {
188188
}
189189

190190
//save edited users
191-
private editUser(user) {
191+
editUser(user) {
192192
user.isEditing = !user.isEditing;
193193
user.isCollapsed = false;
194194
let editUserData = {
@@ -210,7 +210,7 @@ export class AdminComponent implements OnInit {
210210

211211

212212
//reset forms and field validations
213-
private resetForm() {
213+
resetForm() {
214214
this.addUserForm.reset();
215215
this.addUserForm.controls.name.setErrors(null);
216216
this.addUserForm.controls.email.setErrors(null);
@@ -224,7 +224,7 @@ export class AdminComponent implements OnInit {
224224
*/
225225

226226
//confirmation logic
227-
private openModal(template: TemplateRef<any>, type: string, data: any) {
227+
openModal(template: TemplateRef<any>, type: string, data: any) {
228228
this.confirmationData.type = type;
229229
this.confirmationData.data = data;
230230
switch (type) {
@@ -242,7 +242,7 @@ export class AdminComponent implements OnInit {
242242
this.modalRef = this.modalService.show(template, this.modalConfig);
243243
}
244244

245-
private confirm(confirmData: any): void {
245+
confirm(confirmData: any): void {
246246
switch (confirmData.type) {
247247
case 'delete':
248248
this.deleteUser(confirmData.data.id)
@@ -258,7 +258,7 @@ export class AdminComponent implements OnInit {
258258
this.modalRef.hide();
259259
}
260260

261-
private decline(): void {
261+
decline(): void {
262262
// this.message = 'Declined!';
263263
this.modalRef.hide();
264264
}
@@ -271,15 +271,15 @@ export class AdminComponent implements OnInit {
271271

272272

273273
// spinner
274-
private showSpinner() {
274+
showSpinner() {
275275
this.spinner.show(undefined,
276276
{
277277
fullScreen: true,
278278
type: "ball-clip-rotate-multiple"
279279
}
280280
);
281281
}
282-
private hideSpinner() {
282+
hideSpinner() {
283283
this.spinner.hide();
284284
}
285285

CGIAR-QA-front/src/app/app.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ declare let gtag: Function;
1111
styleUrls: ['./app.component.scss']
1212
})
1313
export class AppComponent {
14-
private title = 'qa-app';
15-
private env = environment;
16-
private isModalShown = false;
14+
title = 'qa-app';
15+
env = environment;
16+
isModalShown = false;
1717

18-
@ViewChild('autoShownModal', { static: false }) private autoShownModal: ModalDirective;
18+
@ViewChild('autoShownModal', { static: false }) autoShownModal: ModalDirective;
1919

2020
constructor(public router: Router) {
2121
const isIEOrEdge = /msie\s|trident\/|edge\//i.test(window.navigator.userAgent);
@@ -35,16 +35,16 @@ export class AppComponent {
3535

3636

3737

38-
private showModal(): void {
38+
showModal(): void {
3939
this.isModalShown = true;
4040

4141
}
4242

43-
private hideModal(): void {
43+
hideModal(): void {
4444
this.autoShownModal.hide();
4545
}
4646

47-
private onHidden(): void {
47+
onHidden(): void {
4848
this.isModalShown = false;
4949
}
5050

0 commit comments

Comments
 (0)