Mercurial > hg > ugly-duckling
comparison src/app/analysis-item/analysis-item.component.ts @ 224:1c1cc4ec183c
Setup analysis-item to display determinate spinner if progress prop provided when declared.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Fri, 21 Apr 2017 12:55:24 +0100 |
parents | 1db0bb28688b |
children | 0249ee049353 |
comparison
equal
deleted
inserted
replaced
223:7df3269dcd95 | 224:1c1cc4ec183c |
---|---|
1 /** | 1 /** |
2 * Created by lucast on 21/03/2017. | 2 * Created by lucast on 21/03/2017. |
3 */ | 3 */ |
4 import {Component, Input} from "@angular/core"; | 4 import {Component, Input, OnInit} from "@angular/core"; |
5 import Waves from 'waves-ui'; | 5 import Waves from 'waves-ui'; |
6 | 6 |
7 export interface AnalysisItem { | 7 export interface AnalysisItem { |
8 rootAudioUri: string; | 8 rootAudioUri: string; |
9 hasSharedTimeline: boolean; | 9 hasSharedTimeline: boolean; |
10 isRoot: boolean; | 10 isRoot: boolean; |
11 extractorKey: string; | 11 extractorKey: string; |
12 title?: string; | 12 title?: string; |
13 description?: string; | 13 description?: string; |
14 id?: string; | 14 id?: string; |
15 progress?: number; | |
15 } | 16 } |
16 | 17 |
17 @Component({ | 18 @Component({ |
18 selector: 'ugly-analysis-item', | 19 selector: 'ugly-analysis-item', |
19 templateUrl: './analysis-item.component.html', | 20 templateUrl: './analysis-item.component.html', |
20 styleUrls: ['./analysis-item.component.css'] | 21 styleUrls: ['./analysis-item.component.css'] |
21 }) | 22 }) |
22 export class AnalysisItemComponent { | 23 export class AnalysisItemComponent implements OnInit { |
24 | |
23 @Input() timeline: Timeline; | 25 @Input() timeline: Timeline; |
24 @Input() title: string; | 26 @Input() title: string; |
25 @Input() description: string; | 27 @Input() description: string; |
26 @Input() isActive: boolean; | 28 @Input() isActive: boolean; |
27 @Input() isRoot: boolean; | 29 @Input() isRoot: boolean; |
28 @Input() id: string; | 30 @Input() id: string; |
31 @Input() progress: number; | |
32 private hasProgressOnInit = false; | |
33 | |
34 ngOnInit(): void { | |
35 this.hasProgressOnInit = this.progress != null; | |
36 } | |
37 | |
38 isLoading(): boolean { | |
39 return this.hasProgressOnInit && this.progress < 100; | |
40 } | |
29 } | 41 } |