diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-07-23 21:30:04 +0200 |
---|---|---|
committer | Rigel Kent <par@rigelk.eu> | 2020-07-29 18:15:53 +0200 |
commit | 4f5d045960b042eb27e10bac1bdaf1c074c9fa2a (patch) | |
tree | 09e1e8cce0a2e64146ede51941cfa2f1bdcf3c2f /client/src/app/+my-account/+my-account-video-channels | |
parent | bc99dfe54e093e69ba8fd06d36b36fbbda3f45de (diff) | |
download | PeerTube-4f5d045960b042eb27e10bac1bdaf1c074c9fa2a.tar.gz PeerTube-4f5d045960b042eb27e10bac1bdaf1c074c9fa2a.tar.zst PeerTube-4f5d045960b042eb27e10bac1bdaf1c074c9fa2a.zip |
harmonize search for libraries
Diffstat (limited to 'client/src/app/+my-account/+my-account-video-channels')
3 files changed, 41 insertions, 13 deletions
diff --git a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.html b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.html index e8d44a45e..c20215cf9 100644 --- a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.html +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.html | |||
@@ -1,14 +1,21 @@ | |||
1 | <h1> | 1 | <h1 class="d-flex justify-content-between"> |
2 | <my-global-icon iconName="channel" aria-hidden="true"></my-global-icon> | 2 | <span> |
3 | <ng-container i18n>My channels</ng-container> | 3 | <my-global-icon iconName="channel" aria-hidden="true"></my-global-icon> |
4 | </h1> | 4 | <ng-container i18n>My channels</ng-container> |
5 | <span class="badge badge-secondary">{{ totalItems }}</span> | ||
6 | </span> | ||
7 | |||
8 | <div class="has-feedback has-clear"> | ||
9 | <input type="text" placeholder="Search your channels" i18n-placeholder [(ngModel)]="channelsSearch" (ngModelChange)="onChannelsSearchChanged()" /> | ||
10 | <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetSearch()"></a> | ||
11 | <span class="sr-only" i18n>Clear filters</span> | ||
12 | </div> | ||
5 | 13 | ||
6 | <div class="video-channels-header"> | ||
7 | <a class="create-button" routerLink="create"> | 14 | <a class="create-button" routerLink="create"> |
8 | <my-global-icon iconName="add" aria-hidden="true"></my-global-icon> | 15 | <my-global-icon iconName="add" aria-hidden="true"></my-global-icon> |
9 | <ng-container i18n>Create video channel</ng-container> | 16 | <ng-container i18n>Create video channel</ng-container> |
10 | </a> | 17 | </a> |
11 | </div> | 18 | </h1> |
12 | 19 | ||
13 | <div class="video-channels"> | 20 | <div class="video-channels"> |
14 | <div *ngFor="let videoChannel of videoChannels; let i = index" class="video-channel"> | 21 | <div *ngFor="let videoChannel of videoChannels; let i = index" class="video-channel"> |
diff --git a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.scss b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.scss index 76fb2cde0..4ecb4f408 100644 --- a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.scss +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.scss | |||
@@ -5,6 +5,10 @@ | |||
5 | @include create-button; | 5 | @include create-button; |
6 | } | 6 | } |
7 | 7 | ||
8 | input[type=text] { | ||
9 | @include peertube-input-text(300px); | ||
10 | } | ||
11 | |||
8 | ::ng-deep .action-button { | 12 | ::ng-deep .action-button { |
9 | &.action-button-edit { | 13 | &.action-button-edit { |
10 | margin-right: 10px; | 14 | margin-right: 10px; |
@@ -55,11 +59,6 @@ | |||
55 | } | 59 | } |
56 | } | 60 | } |
57 | 61 | ||
58 | .video-channels-header { | ||
59 | text-align: right; | ||
60 | margin: 20px 0 50px; | ||
61 | } | ||
62 | |||
63 | ::ng-deep .chartjs-render-monitor { | 62 | ::ng-deep .chartjs-render-monitor { |
64 | position: relative; | 63 | position: relative; |
65 | top: 1px; | 64 | top: 1px; |
diff --git a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts index 70510d7c9..da8c7298f 100644 --- a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts | |||
@@ -1,10 +1,11 @@ | |||
1 | import { ChartData } from 'chart.js' | 1 | import { ChartData } from 'chart.js' |
2 | import { max, maxBy, min, minBy } from 'lodash-es' | 2 | import { max, maxBy, min, minBy } from 'lodash-es' |
3 | import { flatMap } from 'rxjs/operators' | 3 | import { flatMap, debounceTime } from 'rxjs/operators' |
4 | import { Component, OnInit } from '@angular/core' | 4 | import { Component, OnInit } from '@angular/core' |
5 | import { AuthService, ConfirmService, Notifier, ScreenService, User } from '@app/core' | 5 | import { AuthService, ConfirmService, Notifier, ScreenService, User } from '@app/core' |
6 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' | 6 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { Subject } from 'rxjs' | ||
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
10 | selector: 'my-account-video-channels', | 11 | selector: 'my-account-video-channels', |
@@ -12,11 +13,16 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
12 | styleUrls: [ './my-account-video-channels.component.scss' ] | 13 | styleUrls: [ './my-account-video-channels.component.scss' ] |
13 | }) | 14 | }) |
14 | export class MyAccountVideoChannelsComponent implements OnInit { | 15 | export class MyAccountVideoChannelsComponent implements OnInit { |
16 | totalItems: number | ||
17 | |||
15 | videoChannels: VideoChannel[] = [] | 18 | videoChannels: VideoChannel[] = [] |
16 | videoChannelsChartData: ChartData[] | 19 | videoChannelsChartData: ChartData[] |
17 | videoChannelsMinimumDailyViews = 0 | 20 | videoChannelsMinimumDailyViews = 0 |
18 | videoChannelsMaximumDailyViews: number | 21 | videoChannelsMaximumDailyViews: number |
19 | 22 | ||
23 | channelsSearch: string | ||
24 | channelsSearchChanged = new Subject<string>() | ||
25 | |||
20 | private user: User | 26 | private user: User |
21 | 27 | ||
22 | constructor ( | 28 | constructor ( |
@@ -32,6 +38,12 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
32 | this.user = this.authService.getUser() | 38 | this.user = this.authService.getUser() |
33 | 39 | ||
34 | this.loadVideoChannels() | 40 | this.loadVideoChannels() |
41 | |||
42 | this.channelsSearchChanged | ||
43 | .pipe(debounceTime(500)) | ||
44 | .subscribe(() => { | ||
45 | this.loadVideoChannels() | ||
46 | }) | ||
35 | } | 47 | } |
36 | 48 | ||
37 | get isInSmallView () { | 49 | get isInSmallView () { |
@@ -87,6 +99,15 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
87 | } | 99 | } |
88 | } | 100 | } |
89 | 101 | ||
102 | resetSearch() { | ||
103 | this.channelsSearch = '' | ||
104 | this.onChannelsSearchChanged() | ||
105 | } | ||
106 | |||
107 | onChannelsSearchChanged () { | ||
108 | this.channelsSearchChanged.next() | ||
109 | } | ||
110 | |||
90 | async deleteVideoChannel (videoChannel: VideoChannel) { | 111 | async deleteVideoChannel (videoChannel: VideoChannel) { |
91 | const res = await this.confirmService.confirmWithInput( | 112 | const res = await this.confirmService.confirmWithInput( |
92 | this.i18n( | 113 | this.i18n( |
@@ -118,9 +139,10 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
118 | 139 | ||
119 | private loadVideoChannels () { | 140 | private loadVideoChannels () { |
120 | this.authService.userInformationLoaded | 141 | this.authService.userInformationLoaded |
121 | .pipe(flatMap(() => this.videoChannelService.listAccountVideoChannels(this.user.account, null, true))) | 142 | .pipe(flatMap(() => this.videoChannelService.listAccountVideoChannels(this.user.account, null, true, this.channelsSearch))) |
122 | .subscribe(res => { | 143 | .subscribe(res => { |
123 | this.videoChannels = res.data | 144 | this.videoChannels = res.data |
145 | this.totalItems = res.total | ||
124 | 146 | ||
125 | // chart data | 147 | // chart data |
126 | this.videoChannelsChartData = this.videoChannels.map(v => ({ | 148 | this.videoChannelsChartData = this.videoChannels.map(v => ({ |