diff options
Diffstat (limited to 'client/app/shared/search.component.ts')
-rw-r--r-- | client/app/shared/search.component.ts | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/client/app/shared/search.component.ts b/client/app/shared/search.component.ts index 674518aba..e1e30b9af 100644 --- a/client/app/shared/search.component.ts +++ b/client/app/shared/search.component.ts | |||
@@ -14,26 +14,21 @@ import { SearchField } from './search-field.type'; | |||
14 | export class SearchComponent { | 14 | export class SearchComponent { |
15 | @Output() search = new EventEmitter<Search>(); | 15 | @Output() search = new EventEmitter<Search>(); |
16 | 16 | ||
17 | searchCriterias: Search = { | ||
18 | field: 'name', | ||
19 | value: '' | ||
20 | }; | ||
21 | |||
22 | fieldChoices = { | 17 | fieldChoices = { |
23 | name: 'Name', | 18 | name: 'Name', |
24 | author: 'Author', | 19 | author: 'Author', |
25 | podUrl: 'Pod Url', | 20 | podUrl: 'Pod Url', |
26 | magnetUri: 'Magnet Uri' | 21 | magnetUri: 'Magnet Uri' |
27 | }; | 22 | }; |
23 | searchCriterias: Search = { | ||
24 | field: 'name', | ||
25 | value: '' | ||
26 | }; | ||
28 | 27 | ||
29 | get choiceKeys() { | 28 | get choiceKeys() { |
30 | return Object.keys(this.fieldChoices); | 29 | return Object.keys(this.fieldChoices); |
31 | } | 30 | } |
32 | 31 | ||
33 | getStringChoice(choiceKey: SearchField) { | ||
34 | return this.fieldChoices[choiceKey]; | ||
35 | } | ||
36 | |||
37 | choose($event: MouseEvent, choice: SearchField) { | 32 | choose($event: MouseEvent, choice: SearchField) { |
38 | $event.preventDefault(); | 33 | $event.preventDefault(); |
39 | $event.stopPropagation(); | 34 | $event.stopPropagation(); |
@@ -45,4 +40,7 @@ export class SearchComponent { | |||
45 | this.search.emit(this.searchCriterias); | 40 | this.search.emit(this.searchCriterias); |
46 | } | 41 | } |
47 | 42 | ||
43 | getStringChoice(choiceKey: SearchField) { | ||
44 | return this.fieldChoices[choiceKey]; | ||
45 | } | ||
48 | } | 46 | } |