comparison src/app/feature-extraction-menu/feature-extraction-menu.component.ts @ 236:53ea6406d601

Generate new project with latest @angular/cli, including Angular 4.
author Lucas Thompson <dev@lucas.im>
date Tue, 25 Apr 2017 20:01:09 +0100
parents bf8826d4e2c6
children 51803e9a42ca
comparison
equal deleted inserted replaced
235:76f2cd2c5a68 236:53ea6406d601
1 import { 1 import {
2 Component, OnInit, Output, EventEmitter, Input, 2 Component,
3 OnInit,
4 Output,
5 EventEmitter,
6 Input,
3 OnDestroy 7 OnDestroy
4 } from '@angular/core'; 8 } from '@angular/core';
5 import {FeatureExtractionService} from "../services/feature-extraction/feature-extraction.service"; 9 import {
6 import {ListResponse} from "piper"; 10 FeatureExtractionService
7 import {Subscription} from "rxjs"; 11 } from '../services/feature-extraction/feature-extraction.service';
12 import {ListResponse} from 'piper';
13 import {Subscription} from 'rxjs/Subscription';
14 import {MdSelect} from '@angular/material';
8 15
9 export interface ExtractorOutputInfo { 16 export interface ExtractorOutputInfo {
10 extractorKey: string; 17 extractorKey: string;
11 combinedKey: string; 18 combinedKey: string;
12 outputId: string; 19 outputId: string;
13 name: string; 20 name: string;
14 } 21 }
15 22
16 @Component({ 23 @Component({
17 selector: 'app-feature-extraction-menu', 24 selector: 'ugly-feature-extraction-menu',
18 templateUrl: './feature-extraction-menu.component.html', 25 templateUrl: './feature-extraction-menu.component.html',
19 styleUrls: ['./feature-extraction-menu.component.css'] 26 styleUrls: ['./feature-extraction-menu.component.css']
20 }) 27 })
21 export class FeatureExtractionMenuComponent implements OnInit, OnDestroy { 28 export class FeatureExtractionMenuComponent implements OnInit, OnDestroy {
22 29
64 }; 71 };
65 } 72 }
66 73
67 ngOnInit() { 74 ngOnInit() {
68 this.piperService.list().then(this.populateExtractors); 75 this.piperService.list().then(this.populateExtractors);
69 this.librariesUpdatedSubscription = this.piperService.librariesUpdated$.subscribe(this.populateExtractors); 76 this.librariesUpdatedSubscription =
77 this.piperService.librariesUpdated$.subscribe(this.populateExtractors);
70 } 78 }
71 79
72 extract(combinedKey: string): void { 80 extract(combinedKey: string): void {
73 const info: ExtractorOutputInfo = 81 const info: ExtractorOutputInfo =
74 this.extractorsMap.get(combinedKey); 82 this.extractorsMap.get(combinedKey);
75 if (info) { 83 if (info) {
76 this.requestOutput.emit(info); 84 this.requestOutput.emit(info);
77 } 85 }
78 } 86 }
79 87
80 load(): void { 88 load(select: MdSelect): void {
89 console.warn(select, select._keyManager);
90 const item = select._keyManager.activeItemIndex;
91 select._keyManager.setFirstItemActive();
81 this.piperService.updateAvailableLibraries().subscribe(res => { 92 this.piperService.updateAvailableLibraries().subscribe(res => {
82 Object.keys(res).forEach(key => this.piperService.load(key)); 93 Object.keys(res).forEach(key => this.piperService.load(key));
83 }); 94 });
84 } 95 }
85 96