Project

General

Profile

« Previous | Next » 

Revision 58042

added loader and messages to metrics-instructions

View differences:

metrics-instructions.component.ts
6 6
import { ActivatedRoute, Router } from '@angular/router';
7 7
import { PiwikService } from '../../services/piwik.service';
8 8
import { AuthenticationService } from '../../services/authentication.service';
9
import { loadingUserRepoInfoError } from '../../domain/shared-messages';
9 10

  
10 11
@Component ({
11 12
  selector: 'app-metrics-instructions',
......
15 16
export class MetricsInstructionsComponent implements OnInit {
16 17
  piwik: PiwikInfo;
17 18
  errorMessage: string;
19
  loadingMessage: string;
18 20

  
19 21
  constructor(
20 22
    private route: ActivatedRoute,
......
27 29
  }
28 30

  
29 31
  getPiwik(): void {
32
    this.loadingMessage = 'Retrieving instructions ...';
30 33
    const id = this.route.snapshot.paramMap.get('id');
31 34
    this.piwikService.getPiwikInfo(id).subscribe(
32 35
      piwik => this.piwik = piwik,
33
      error => console.log(error),
36
      error => {
37
        console.log(error);
38
        this.loadingMessage = '';
39
        this.errorMessage = loadingUserRepoInfoError;
40
      },
34 41
      () => {
42
        this.loadingMessage = '';
35 43
      }
36 44
    );
37 45
  }

Also available in: Unified diff