Project

General

Profile

« Previous | Next » 

Revision 51830

fixed some bugs - fixed number of events shown in content/events

View differences:

content-events.component.ts
1
import {Component, OnInit} from "@angular/core";
1
import {Component, Input, OnInit} from "@angular/core";
2
import {AuthenticationService} from "../../services/authentication.service";
3
import {BrokerService} from "../../services/broker.service";
4
import {loadingRepoMessage, loadingUserRepoInfoEmpty, reposRetrievalError} from "../../domain/shared-messages";
2 5

  
3 6
@Component ({
4 7
  selector: 'app-content-events',
......
6 9
})
7 10

  
8 11
export class ContentEventsComponent implements OnInit {
12
  datasourcesOfUser = [];
13
  tilesView: boolean;
14
  errorMessage: string;
15
  noDatasourcesMessage: string;
16
  loadingMessage: string;
9 17

  
10
  constructor() {}
18
  @Input() parent: string = '';
11 19

  
12
  ngOnInit() {}
20
  constructor(private authService: AuthenticationService,
21
              private brokerService: BrokerService) {}
22

  
23
  ngOnInit() {
24
    this.tilesView = true;
25
    this.getDatasourcesOfUser();
26
  }
27

  
28

  
29
  getDatasourcesOfUser() {
30
    this.loadingMessage = loadingRepoMessage;
31
    this.brokerService.getDatasourcesOfUser(this.authService.getUserEmail()).subscribe(
32
      res => {
33
        this.datasourcesOfUser = res['datasourcesOfUser'];
34
      },
35
      error => {
36
        console.log(error);
37
        this.loadingMessage = '';
38
        this.errorMessage = reposRetrievalError;
39
      },
40
      () => {
41
        this.loadingMessage = '';
42
        if (!this.datasourcesOfUser.length) {
43
          this.noDatasourcesMessage = loadingUserRepoInfoEmpty;
44
        /*} else {
45
          this.datasourcesOfUser.forEach(
46
            d => {
47
              console.log( d['first']['value'],' -> ',d['first']['size'] );
48
            }
49
          );*/
50
        }
51
      }
52
    );
53
  }
54

  
55
  toggleTiles(){
56
    this.tilesView = !this.tilesView;
57
  }
58

  
13 59
}

Also available in: Unified diff