# HG changeset patch # User Lucas Thompson # Date 1496769090 -3600 # Node ID 4387175f594b97a6c5f08a2fcb454e1d8d60b3f4 # Parent 1811801a9830540b18d0817a9e631cdf12fc5147 Basic action tray for feature analysis. WIP, bit buggy wrt scrolling and not dismissed automatically when extractor selected. diff -r 1811801a9830 -r 4387175f594b src/app/actions/action-tray.component.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/actions/action-tray.component.ts Tue Jun 06 18:11:30 2017 +0100 @@ -0,0 +1,57 @@ +/** + * Created by lucast on 06/06/2017. + */ +import {Component, Input} from '@angular/core'; +import { + animate, keyframes, state, style, transition, + trigger +} from '@angular/animations'; + +@Component({ + selector: 'ugly-action-tray', + template: `
`, + styles: [ + `.tray { + background: white; + height: 100%; + width: 100%; + position: absolute; + z-index: 100; + overflow-y: hidden; + }` + ], + animations: [ + trigger('visibility', [ + state('show', style({ + height: '100%', + 'overflow-y': 'scroll' + })), + state('hide', style({ + height: 0, + 'overflow-y': 'hidden', + })), + transition('hide => show', [ + animate(300, keyframes([ + style({height: 0, offset: 0}), + style({height: '100%', offset: 1.0}), + ])) + ]), + transition('show => hide', [ + animate(300, keyframes([ + style({height: '100%', offset: 0.0}), + style({height: 0, offset: 1.0}), + ])) + ]), + ]) + ] +}) +export class ActionTrayComponent { + @Input() visibility: 'show' | 'hide' = 'hide'; + + toggle() { + this.visibility = this.visibility === 'show' ? 'hide' : 'show'; + } +} diff -r 1811801a9830 -r 4387175f594b src/app/app.component.html --- a/src/app/app.component.html Tue Jun 06 16:10:00 2017 +0100 +++ b/src/app/app.component.html Tue Jun 06 18:11:30 2017 +0100 @@ -18,13 +18,19 @@ (fileOpened)="onFileOpened($event)" > -
+ + + + - - + - {{extractor.name}} - - -

- -

-

- -

+

{{extractor.name}}

+ + extension +

{{output.name}}

+

{{output.combinedKey}}

+ +
+ + +
diff -r 1811801a9830 -r 4387175f594b src/app/feature-extraction-menu/feature-extraction-menu.component.ts --- a/src/app/feature-extraction-menu/feature-extraction-menu.component.ts Tue Jun 06 16:10:00 2017 +0100 +++ b/src/app/feature-extraction-menu/feature-extraction-menu.component.ts Tue Jun 06 18:11:30 2017 +0100 @@ -20,6 +20,11 @@ name: string; } +interface ExtractorInfo { + name: string; + outputs: ExtractorOutputInfo[]; +} + @Component({ selector: 'ugly-feature-extraction-menu', templateUrl: './feature-extraction-menu.component.html', @@ -39,35 +44,30 @@ @Output() requestOutput: EventEmitter; private isDisabled: boolean; - private extractorsMap: Map; private populateExtractors: (available: ListResponse) => void; - extractors: Iterable; + extractors: Iterable; private librariesUpdatedSubscription: Subscription; constructor(private piperService: FeatureExtractionService) { - this.extractorsMap = new Map(); this.extractors = []; this.requestOutput = new EventEmitter(); this.isDisabled = true; this.populateExtractors = available => { - const maxCharacterLimit = 50; - available.available.forEach(staticData => { - const isSingleOutputExtractor = staticData.basicOutputInfo.length === 1; - staticData.basicOutputInfo.forEach(output => { - const combinedKey = `${staticData.key}:${output.identifier}`; - this.extractorsMap.set(combinedKey, { - extractorKey: staticData.key, - combinedKey: combinedKey, - name: ( - isSingleOutputExtractor - ? staticData.basic.name - : `${staticData.basic.name}: ${output.name}` - ).substr(0, maxCharacterLimit) + '...', - outputId: output.identifier + this.extractors = available.available.reduce((acc, staticData) => { + const name = staticData.basic.name; + const outputs: ExtractorOutputInfo[] = + staticData.basicOutputInfo.map(output => { + const combinedKey = `${staticData.key}:${output.identifier}`; + return { + extractorKey: staticData.key, + combinedKey: combinedKey, + name: output.name, + outputId: output.identifier + }; }); - }); - }); - this.extractors = [...this.extractorsMap.values()]; + acc.push({name, outputs}); + return acc; + }, [] as ExtractorInfo[]); }; } @@ -85,10 +85,10 @@ this.piperService.list().then(this.populateExtractors); } - extract(combinedKey: string): void { - const info: ExtractorOutputInfo = - this.extractorsMap.get(combinedKey); + extract(info: ExtractorOutputInfo): void { + console.warn('extract?', info); if (info) { + console.warn('emit'); this.requestOutput.emit(info); } }