view src/app/analysis-item/analysis-item.component.ts @ 269:077b57d64bbd

Helper method for accessing current item from MdSelect
author Lucas Thompson <dev@lucas.im>
date Tue, 02 May 2017 15:16:44 +0100
parents 53ea6406d601
children 2d7da410ba46
line wrap: on
line source
/**
 * Created by lucast on 21/03/2017.
 */
import {
  ChangeDetectionStrategy,
  Component,
  Input,
  OnInit
} from '@angular/core';

export interface AnalysisItem {
  rootAudioUri: string;
  hasSharedTimeline: boolean;
  isRoot: boolean;
  extractorKey: string;
  title?: string;
  description?: string;
  id?: string;
  progress?: number;
}

@Component({
  selector: 'ugly-analysis-item',
  templateUrl: './analysis-item.component.html',
  styleUrls: ['./analysis-item.component.css'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class AnalysisItemComponent implements OnInit {

  @Input() timeline: Timeline;
  @Input() isActive: boolean;
  @Input() item: AnalysisItem;
  private hasProgressOnInit = false;

  ngOnInit(): void {
    this.hasProgressOnInit = this.item.progress != null;
  }

  isLoading(): boolean {
    return this.hasProgressOnInit && this.item.progress < 100;
  }
}