diff options
Diffstat (limited to 'client/src/app/+admin/follows')
4 files changed, 62 insertions, 27 deletions
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.html b/client/src/app/+admin/follows/followers-list/followers-list.component.html index 74f2c2e36..85d2a2cf6 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.html +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.html | |||
@@ -1,11 +1,26 @@ | |||
1 | <p-dataTable | 1 | <p-table |
2 | [value]="followers" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" | 2 | [value]="followers" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" |
3 | sortField="createdAt" (onLazyLoad)="loadLazy($event)" | 3 | [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" |
4 | > | 4 | > |
5 | <p-column field="id" header="ID" [style]="{ width: '60px' }"></p-column> | 5 | <ng-template pTemplate="header"> |
6 | <p-column field="score" header="Score"></p-column> | 6 | <tr> |
7 | <p-column field="follower.name" header="Name"></p-column> | 7 | <th style="width: 60px">ID</th> |
8 | <p-column field="follower.host" header="Host"></p-column> | 8 | <th>Score</th> |
9 | <p-column field="state" header="State"></p-column> | 9 | <th>Name</th> |
10 | <p-column field="createdAt" header="Created date" [sortable]="true"></p-column> | 10 | <th>Host</th> |
11 | </p-dataTable> | 11 | <th>State</th> |
12 | <th pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> | ||
13 | </tr> | ||
14 | </ng-template> | ||
15 | |||
16 | <ng-template pTemplate="body" let-follow> | ||
17 | <tr> | ||
18 | <td>{{ follow.id }}</td> | ||
19 | <td>{{ follow.score }}</td> | ||
20 | <td>{{ follow.follower.name }}</td> | ||
21 | <td>{{ follow.follower.host }}</td> | ||
22 | <td>{{ follow.state }}</td> | ||
23 | <td>{{ follow.createdAt }}</td> | ||
24 | </tr> | ||
25 | </ng-template> | ||
26 | </p-table> | ||
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index 649815709..69b3e5e58 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { SortMeta } from 'primeng/primeng' | 4 | import { SortMeta } from 'primeng/primeng' |
@@ -11,7 +11,7 @@ import { FollowService } from '../shared' | |||
11 | templateUrl: './followers-list.component.html', | 11 | templateUrl: './followers-list.component.html', |
12 | styleUrls: [ './followers-list.component.scss' ] | 12 | styleUrls: [ './followers-list.component.scss' ] |
13 | }) | 13 | }) |
14 | export class FollowersListComponent extends RestTable { | 14 | export class FollowersListComponent extends RestTable implements OnInit { |
15 | followers: AccountFollow[] = [] | 15 | followers: AccountFollow[] = [] |
16 | totalRecords = 0 | 16 | totalRecords = 0 |
17 | rowsPerPage = 10 | 17 | rowsPerPage = 10 |
@@ -25,6 +25,10 @@ export class FollowersListComponent extends RestTable { | |||
25 | super() | 25 | super() |
26 | } | 26 | } |
27 | 27 | ||
28 | ngOnInit () { | ||
29 | this.loadSort() | ||
30 | } | ||
31 | |||
28 | protected loadData () { | 32 | protected loadData () { |
29 | this.followService.getFollowers(this.pagination, this.sort) | 33 | this.followService.getFollowers(this.pagination, this.sort) |
30 | .subscribe( | 34 | .subscribe( |
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 fc1cf0dc4..24981d3e9 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 | |||
@@ -1,14 +1,26 @@ | |||
1 | <p-dataTable | 1 | <p-table |
2 | [value]="following" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" | 2 | [value]="following" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" |
3 | sortField="createdAt" (onLazyLoad)="loadLazy($event)" | 3 | [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" |
4 | > | 4 | > |
5 | <p-column field="id" header="ID" [style]="{ width: '60px' }"></p-column> | 5 | <ng-template pTemplate="header"> |
6 | <p-column field="following.host" header="Host"></p-column> | 6 | <tr> |
7 | <p-column field="state" header="State"></p-column> | 7 | <th style="width: 60px">ID</th> |
8 | <p-column field="createdAt" header="Created date" [sortable]="true"></p-column> | 8 | <th>Host</th> |
9 | <p-column styleClass="action-cell"> | 9 | <th>State</th> |
10 | <ng-template pTemplate="body" let-following="rowData"> | 10 | <th pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> |
11 | <my-delete-button (click)="removeFollowing(following)"></my-delete-button> | 11 | <th></th> |
12 | </ng-template> | 12 | </tr> |
13 | </p-column> | 13 | </ng-template> |
14 | </p-dataTable> | 14 | |
15 | <ng-template pTemplate="body" let-follow> | ||
16 | <tr> | ||
17 | <td>{{ follow.id }}</td> | ||
18 | <td>{{ follow.following.host }}</td> | ||
19 | <td>{{ follow.state }}</td> | ||
20 | <td>{{ follow.createdAt }}</td> | ||
21 | <td class="action-cell"> | ||
22 | <my-delete-button (click)="removeFollowing(follow)"></my-delete-button> | ||
23 | </td> | ||
24 | </tr> | ||
25 | </ng-template> | ||
26 | </p-table> | ||
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 ad1bd4536..873a5d965 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 } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { NotificationsService } from 'angular2-notifications' |
3 | import { SortMeta } from 'primeng/primeng' | 3 | import { SortMeta } from 'primeng/primeng' |
4 | import { AccountFollow } from '../../../../../../shared/models/actors/follow.model' | 4 | import { AccountFollow } from '../../../../../../shared/models/actors/follow.model' |
@@ -10,7 +10,7 @@ import { FollowService } from '../shared' | |||
10 | selector: 'my-followers-list', | 10 | selector: 'my-followers-list', |
11 | templateUrl: './following-list.component.html' | 11 | templateUrl: './following-list.component.html' |
12 | }) | 12 | }) |
13 | export class FollowingListComponent extends RestTable { | 13 | export class FollowingListComponent extends RestTable implements OnInit { |
14 | following: AccountFollow[] = [] | 14 | following: AccountFollow[] = [] |
15 | totalRecords = 0 | 15 | totalRecords = 0 |
16 | rowsPerPage = 10 | 16 | rowsPerPage = 10 |
@@ -25,6 +25,10 @@ export class FollowingListComponent extends RestTable { | |||
25 | super() | 25 | super() |
26 | } | 26 | } |
27 | 27 | ||
28 | ngOnInit () { | ||
29 | this.loadSort() | ||
30 | } | ||
31 | |||
28 | async removeFollowing (follow: AccountFollow) { | 32 | async removeFollowing (follow: AccountFollow) { |
29 | const res = await this.confirmService.confirm(`Do you really want to unfollow ${follow.following.host}?`, 'Unfollow') | 33 | const res = await this.confirmService.confirm(`Do you really want to unfollow ${follow.following.host}?`, 'Unfollow') |
30 | if (res === false) return | 34 | if (res === false) return |