diff options
Diffstat (limited to 'client/src/app/+admin/follows/following-list')
3 files changed, 32 insertions, 4 deletions
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.html b/client/src/app/+admin/follows/following-list/following-list.component.html index 01aba0c11..cb62d52dd 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.html +++ b/client/src/app/+admin/follows/following-list/following-list.component.html | |||
@@ -4,12 +4,16 @@ | |||
4 | > | 4 | > |
5 | <ng-template pTemplate="caption"> | 5 | <ng-template pTemplate="caption"> |
6 | <div class="caption"> | 6 | <div class="caption"> |
7 | <div> | 7 | <div class="ml-auto"> |
8 | <input | 8 | <input |
9 | type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." | 9 | type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." |
10 | (keyup)="onSearch($event)" | 10 | (keyup)="onSearch($event)" |
11 | > | 11 | > |
12 | </div> | 12 | </div> |
13 | <a class="ml-2 follow-button" (click)="addDomainsToFollow()" (key.enter)="addDomainsToFollow()"> | ||
14 | <my-global-icon iconName="add"></my-global-icon> | ||
15 | <ng-container i18n>Follow domain</ng-container> | ||
16 | </a> | ||
13 | </div> | 17 | </div> |
14 | </ng-template> | 18 | </ng-template> |
15 | 19 | ||
@@ -42,3 +46,5 @@ | |||
42 | </tr> | 46 | </tr> |
43 | </ng-template> | 47 | </ng-template> |
44 | </p-table> | 48 | </p-table> |
49 | |||
50 | <my-batch-domains-modal #batchDomainsModal i18n-action action="Follow domains" (domains)="addFollowing($event)"></my-batch-domains-modal> | ||
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.scss b/client/src/app/+admin/follows/following-list/following-list.component.scss index a6f0656b8..f4656b88d 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.scss +++ b/client/src/app/+admin/follows/following-list/following-list.component.scss | |||
@@ -7,4 +7,8 @@ | |||
7 | input { | 7 | input { |
8 | @include peertube-input-text(250px); | 8 | @include peertube-input-text(250px); |
9 | } | 9 | } |
10 | } \ No newline at end of file | 10 | } |
11 | |||
12 | .follow-button { | ||
13 | @include create-button; | ||
14 | } | ||
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index dd7629ead..477a6c0d7 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
2 | import { Notifier } from '@app/core' | 2 | import { Notifier } from '@app/core' |
3 | import { SortMeta } from 'primeng/api' | 3 | import { SortMeta } from 'primeng/api' |
4 | import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' | 4 | import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' |
@@ -6,6 +6,7 @@ import { ConfirmService } from '../../../core/confirm/confirm.service' | |||
6 | import { RestPagination, RestTable } from '../../../shared' | 6 | import { RestPagination, RestTable } from '../../../shared' |
7 | import { FollowService } from '@app/shared/instance/follow.service' | 7 | import { FollowService } from '@app/shared/instance/follow.service' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | 8 | import { I18n } from '@ngx-translate/i18n-polyfill' |
9 | import { BatchDomainsModalComponent } from '@app/+admin/config/shared/batch-domains-modal.component' | ||
9 | 10 | ||
10 | @Component({ | 11 | @Component({ |
11 | selector: 'my-followers-list', | 12 | selector: 'my-followers-list', |
@@ -13,10 +14,12 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
13 | styleUrls: [ './following-list.component.scss' ] | 14 | styleUrls: [ './following-list.component.scss' ] |
14 | }) | 15 | }) |
15 | export class FollowingListComponent extends RestTable implements OnInit { | 16 | export class FollowingListComponent extends RestTable implements OnInit { |
17 | @ViewChild('batchDomainsModal') batchDomainsModal: BatchDomainsModalComponent | ||
18 | |||
16 | following: ActorFollow[] = [] | 19 | following: ActorFollow[] = [] |
17 | totalRecords = 0 | 20 | totalRecords = 0 |
18 | rowsPerPage = 10 | 21 | rowsPerPage = 10 |
19 | sort: SortMeta = { field: 'createdAt', order: 1 } | 22 | sort: SortMeta = { field: 'createdAt', order: -1 } |
20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 23 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
21 | 24 | ||
22 | constructor ( | 25 | constructor ( |
@@ -36,6 +39,21 @@ export class FollowingListComponent extends RestTable implements OnInit { | |||
36 | return 'FollowingListComponent' | 39 | return 'FollowingListComponent' |
37 | } | 40 | } |
38 | 41 | ||
42 | addDomainsToFollow () { | ||
43 | this.batchDomainsModal.openModal() | ||
44 | } | ||
45 | |||
46 | async addFollowing (hosts: string[]) { | ||
47 | this.followService.follow(hosts).subscribe( | ||
48 | () => { | ||
49 | this.notifier.success(this.i18n('Follow request(s) sent!')) | ||
50 | this.loadData() | ||
51 | }, | ||
52 | |||
53 | err => this.notifier.error(err.message) | ||
54 | ) | ||
55 | } | ||
56 | |||
39 | async removeFollowing (follow: ActorFollow) { | 57 | async removeFollowing (follow: ActorFollow) { |
40 | const res = await this.confirmService.confirm( | 58 | const res = await this.confirmService.confirm( |
41 | this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }), | 59 | this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }), |