Revision 58109
Added by Stefania Martziou about 4 years ago
empty-page.component.ts | ||
---|---|---|
1 |
import { Component, OnInit } from '@angular/core'; |
|
2 |
import { RepositoryService } from "../../services/repository.service"; |
|
3 |
import { SharedService } from "../../services/shared.service"; |
|
4 |
import { RepositorySnippet } from "../../domain/typeScriptClasses"; |
|
5 |
import { Router } from "@angular/router"; |
|
1 |
import { Component } from '@angular/core'; |
|
6 | 2 |
|
7 | 3 |
@Component ({ |
8 | 4 |
selector: 'app-empty-page', |
9 | 5 |
templateUrl: './empty-page.component.html', |
10 | 6 |
}) |
11 | 7 |
|
12 |
export class EmptyPageComponent implements OnInit {
|
|
8 |
export class EmptyPageComponent { |
|
13 | 9 |
|
14 |
repositoriesOfUser: RepositorySnippet[]; |
|
15 |
|
|
16 |
constructor(private repositoryService: RepositoryService, |
|
17 |
private sharedService: SharedService, |
|
18 |
private router: Router) { |
|
19 |
} |
|
20 |
|
|
21 |
ngOnInit() { |
|
22 |
|
|
23 |
let body = document.getElementsByTagName('body')[0]; |
|
24 |
body.classList.remove("landing"); |
|
25 |
body.classList.add("dashboard"); |
|
26 |
|
|
27 |
if(this.sharedService.getRepositoriesOfUser() && this.sharedService.getRepositoriesOfUser().length>0) { |
|
28 |
this.repositoriesOfUser = this.sharedService.getRepositoriesOfUser(); |
|
29 |
if(this.repositoriesOfUser.length>0) |
|
30 |
this.router.navigate([`/repository/${this.repositoriesOfUser[0].id}/dashboard`]); |
|
31 |
// this.getSelectedRepositorySummaryInfo(this.repository); |
|
32 |
} else { |
|
33 |
this.getReposOfUser(); |
|
34 |
} |
|
35 |
|
|
36 |
// this.sharedService.repositoriesOfUser$.subscribe( |
|
37 |
// r => { |
|
38 |
// this.repositoriesOfUser = r; |
|
39 |
// } |
|
40 |
// ); |
|
41 |
|
|
42 |
} |
|
43 |
|
|
44 |
getReposOfUser(): void { |
|
45 |
this.repositoryService.getRepositoriesOfUser() |
|
46 |
.subscribe( |
|
47 |
repos => { |
|
48 |
this.repositoriesOfUser = repos; |
|
49 |
// this.sharedService.setRepositoriesOfUser(repos); |
|
50 |
if(this.repositoriesOfUser.length>0) |
|
51 |
this.router.navigate([`/repository/${this.repositoriesOfUser[0].id}/dashboard`]); |
|
52 |
}, |
|
53 |
error => { console.log(error); } |
|
54 |
); |
|
55 |
} |
|
10 |
constructor() {} |
|
56 | 11 |
} |
Also available in: Unified diff
Added a join page which will be the page users see when they login and they don't have a repository registered