aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/misc/from-now.pipe.ts2
-rw-r--r--client/src/app/shared/search/search.component.ts33
-rw-r--r--client/src/app/shared/shared.module.ts7
3 files changed, 6 insertions, 36 deletions
diff --git a/client/src/app/shared/misc/from-now.pipe.ts b/client/src/app/shared/misc/from-now.pipe.ts
index 25e5d6a85..80dab02ba 100644
--- a/client/src/app/shared/misc/from-now.pipe.ts
+++ b/client/src/app/shared/misc/from-now.pipe.ts
@@ -1,6 +1,6 @@
1import { Pipe, PipeTransform } from '@angular/core' 1import { Pipe, PipeTransform } from '@angular/core'
2 2
3// Thanks: https://github.com/danrevah/ngx-pipes/blob/master/src/pipes/math/bytes.ts 3// Thanks: https://stackoverflow.com/questions/3177836/how-to-format-time-since-xxx-e-g-4-minutes-ago-similar-to-stack-exchange-site
4 4
5@Pipe({name: 'fromNow'}) 5@Pipe({name: 'fromNow'})
6export class FromNowPipe implements PipeTransform { 6export class FromNowPipe implements PipeTransform {
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts
index 6ef19c97a..f49ecc8ad 100644
--- a/client/src/app/shared/search/search.component.ts
+++ b/client/src/app/shared/search/search.component.ts
@@ -1,8 +1,6 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { Router } from '@angular/router' 2import { Router } from '@angular/router'
3
4import { Search } from './search.model' 3import { Search } from './search.model'
5import { SearchField } from './search-field.type'
6import { SearchService } from './search.service' 4import { SearchService } from './search.service'
7 5
8@Component({ 6@Component({
@@ -12,12 +10,6 @@ import { SearchService } from './search.service'
12}) 10})
13 11
14export class SearchComponent implements OnInit { 12export class SearchComponent implements OnInit {
15 fieldChoices = {
16 name: 'Name',
17 account: 'Account',
18 host: 'Host',
19 tags: 'Tags'
20 }
21 searchCriteria: Search = { 13 searchCriteria: Search = {
22 field: 'name', 14 field: 'name',
23 value: '' 15 value: ''
@@ -40,30 +32,11 @@ export class SearchComponent implements OnInit {
40 ) 32 )
41 } 33 }
42 34
43 get choiceKeys () {
44 return Object.keys(this.fieldChoices)
45 }
46
47 choose ($event: MouseEvent, choice: SearchField) {
48 $event.preventDefault()
49 $event.stopPropagation()
50
51 this.searchCriteria.field = choice
52
53 if (this.searchCriteria.value) {
54 this.doSearch()
55 }
56 }
57
58 doSearch () { 35 doSearch () {
59 if (this.router.url.indexOf('/videos/list') === -1) { 36 // if (this.router.url.indexOf('/videos/list') === -1) {
60 this.router.navigate([ '/videos/list' ]) 37 // this.router.navigate([ '/videos/list' ])
61 } 38 // }
62 39
63 this.searchService.searchUpdated.next(this.searchCriteria) 40 this.searchService.searchUpdated.next(this.searchCriteria)
64 } 41 }
65
66 getStringChoice (choiceKey: SearchField) {
67 return this.fieldChoices[choiceKey]
68 }
69} 42}
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts
index c7ea6e603..7618748e9 100644
--- a/client/src/app/shared/shared.module.ts
+++ b/client/src/app/shared/shared.module.ts
@@ -6,21 +6,20 @@ import { RouterModule } from '@angular/router'
6 6
7import { BsDropdownModule } from 'ngx-bootstrap/dropdown' 7import { BsDropdownModule } from 'ngx-bootstrap/dropdown'
8import { ModalModule } from 'ngx-bootstrap/modal' 8import { ModalModule } from 'ngx-bootstrap/modal'
9import { PaginationModule } from 'ngx-bootstrap/pagination'
10import { ProgressbarModule } from 'ngx-bootstrap/progressbar' 9import { ProgressbarModule } from 'ngx-bootstrap/progressbar'
11import { BytesPipe, KeysPipe } from 'ngx-pipes' 10import { BytesPipe, KeysPipe } from 'ngx-pipes'
12import { SharedModule as PrimeSharedModule } from 'primeng/components/common/shared' 11import { SharedModule as PrimeSharedModule } from 'primeng/components/common/shared'
13import { DataTableModule } from 'primeng/components/datatable/datatable' 12import { DataTableModule } from 'primeng/components/datatable/datatable'
14 13
15import { AUTH_INTERCEPTOR_PROVIDER } from './auth' 14import { AUTH_INTERCEPTOR_PROVIDER } from './auth'
15import { FromNowPipe } from './misc/from-now.pipe'
16import { LoaderComponent } from './misc/loader.component' 16import { LoaderComponent } from './misc/loader.component'
17import { NumberFormatterPipe } from './misc/number-formatter.pipe'
17import { RestExtractor, RestService } from './rest' 18import { RestExtractor, RestService } from './rest'
18import { SearchComponent, SearchService } from './search' 19import { SearchComponent, SearchService } from './search'
19import { UserService } from './users' 20import { UserService } from './users'
20import { VideoAbuseService } from './video-abuse' 21import { VideoAbuseService } from './video-abuse'
21import { VideoBlacklistService } from './video-blacklist' 22import { VideoBlacklistService } from './video-blacklist'
22import { NumberFormatterPipe } from './misc/number-formatter.pipe'
23import { FromNowPipe } from './misc/from-now.pipe'
24 23
25@NgModule({ 24@NgModule({
26 imports: [ 25 imports: [
@@ -32,7 +31,6 @@ import { FromNowPipe } from './misc/from-now.pipe'
32 31
33 BsDropdownModule.forRoot(), 32 BsDropdownModule.forRoot(),
34 ModalModule.forRoot(), 33 ModalModule.forRoot(),
35 PaginationModule.forRoot(),
36 ProgressbarModule.forRoot(), 34 ProgressbarModule.forRoot(),
37 35
38 DataTableModule, 36 DataTableModule,
@@ -57,7 +55,6 @@ import { FromNowPipe } from './misc/from-now.pipe'
57 55
58 BsDropdownModule, 56 BsDropdownModule,
59 ModalModule, 57 ModalModule,
60 PaginationModule,
61 ProgressbarModule, 58 ProgressbarModule,
62 DataTableModule, 59 DataTableModule,
63 PrimeSharedModule, 60 PrimeSharedModule,