diff options
Diffstat (limited to 'client/angular/app/search.component.ts')
-rw-r--r-- | client/angular/app/search.component.ts | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/client/angular/app/search.component.ts b/client/angular/app/search.component.ts deleted file mode 100644 index e21b91fce..000000000 --- a/client/angular/app/search.component.ts +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | import { Component, EventEmitter, Output } from '@angular/core'; | ||
2 | |||
3 | import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown'; | ||
4 | |||
5 | import { Search, SearchField } from './search'; | ||
6 | |||
7 | @Component({ | ||
8 | selector: 'my-search', | ||
9 | templateUrl: 'app/angular/app/search.component.html', | ||
10 | directives: [ DROPDOWN_DIRECTIVES ] | ||
11 | }) | ||
12 | |||
13 | export class SearchComponent { | ||
14 | @Output() search: EventEmitter<Search> = new EventEmitter<Search>(); | ||
15 | |||
16 | searchCriterias: Search = { | ||
17 | field: 'name', | ||
18 | value: '' | ||
19 | }; | ||
20 | fieldChoices = { | ||
21 | name: 'Name', | ||
22 | author: 'Author', | ||
23 | podUrl: 'Pod Url', | ||
24 | magnetUri: 'Magnet Uri' | ||
25 | }; | ||
26 | |||
27 | get choiceKeys() { | ||
28 | return Object.keys(this.fieldChoices); | ||
29 | } | ||
30 | |||
31 | getStringChoice(choiceKey: SearchField): string { | ||
32 | return this.fieldChoices[choiceKey]; | ||
33 | } | ||
34 | |||
35 | choose($event:MouseEvent, choice: SearchField) { | ||
36 | $event.preventDefault(); | ||
37 | $event.stopPropagation(); | ||
38 | |||
39 | this.searchCriterias.field = choice; | ||
40 | } | ||
41 | |||
42 | doSearch(): void { | ||
43 | this.search.emit(this.searchCriterias); | ||
44 | } | ||
45 | |||
46 | } | ||