comparison src/app/feature-extraction-menu/feature-extraction-menu.component.ts @ 48:af0b4b05311c

Guard against extraction when no audio is loaded.
author Lucas Thompson <dev@lucas.im>
date Tue, 06 Dec 2016 11:03:38 +0000
parents 933c64ebcd13
children 8619f25ff52a
comparison
equal deleted inserted replaced
47:933c64ebcd13 48:af0b4b05311c
1 import {Component, OnInit, Output, EventEmitter} from '@angular/core'; 1 import {Component, OnInit, Output, EventEmitter, Input} from '@angular/core';
2 import {FeatureExtractionService} from "../services/feature-extraction/feature-extraction.service"; 2 import {FeatureExtractionService} from "../services/feature-extraction/feature-extraction.service";
3 3
4 export interface ExtractorOutputInfo { 4 export interface ExtractorOutputInfo {
5 extractorKey: string; 5 extractorKey: string;
6 combinedKey: string; 6 combinedKey: string;
13 templateUrl: './feature-extraction-menu.component.html', 13 templateUrl: './feature-extraction-menu.component.html',
14 styleUrls: ['./feature-extraction-menu.component.css'] 14 styleUrls: ['./feature-extraction-menu.component.css']
15 }) 15 })
16 export class FeatureExtractionMenuComponent implements OnInit { 16 export class FeatureExtractionMenuComponent implements OnInit {
17 17
18 @Input()
19 set disabled(isDisabled: boolean) {
20 this.isDisabled = isDisabled;
21 }
22
23 get disabled() {
24 return this.isDisabled;
25 }
26
18 @Output() requestOutput: EventEmitter<ExtractorOutputInfo>; 27 @Output() requestOutput: EventEmitter<ExtractorOutputInfo>;
19 28
29 private isDisabled: boolean;
20 private extractorsMap: Map<string, ExtractorOutputInfo>; 30 private extractorsMap: Map<string, ExtractorOutputInfo>;
21 extractors: Iterable<ExtractorOutputInfo>; 31 extractors: Iterable<ExtractorOutputInfo>;
22 32
23 constructor(private piperService: FeatureExtractionService) { 33 constructor(private piperService: FeatureExtractionService) {
24 this.extractorsMap = new Map(); 34 this.extractorsMap = new Map();
25 this.extractors = []; 35 this.extractors = [];
26 this.requestOutput = new EventEmitter(); 36 this.requestOutput = new EventEmitter();
37 this.isDisabled = true;
27 } 38 }
28 39
29 ngOnInit() { 40 ngOnInit() {
30 this.piperService.list().then(available => { 41 this.piperService.list().then(available => {
31 const maxCharacterLimit = 50; 42 const maxCharacterLimit = 50;