mirror of https://github.com/Chocobozzz/PeerTube
Add more filters to admin follows table
parent
97ecddae10
commit
cb5ce4cb13
|
@ -13,10 +13,9 @@
|
||||||
|
|
||||||
<ng-template pTemplate="header">
|
<ng-template pTemplate="header">
|
||||||
<tr>
|
<tr>
|
||||||
<th i18n style="width: 60px">ID</th>
|
|
||||||
<th i18n>Follower handle</th>
|
<th i18n>Follower handle</th>
|
||||||
<th i18n>State</th>
|
<th i18n pSortableColumn="state">State <p-sortIcon field="state"></p-sortIcon></th>
|
||||||
<th i18n>Score</th>
|
<th i18n pSortableColumn="score">Score <p-sortIcon field="score"></p-sortIcon></th>
|
||||||
<th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
|
<th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -24,7 +23,6 @@
|
||||||
|
|
||||||
<ng-template pTemplate="body" let-follow>
|
<ng-template pTemplate="body" let-follow>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ follow.id }}</td>
|
|
||||||
<td><a [href]="follow.follower.url" target="_blank" rel="noopener noreferrer">{{ follow.follower.name + '@' + follow.follower.host }}</a></td>
|
<td><a [href]="follow.follower.url" target="_blank" rel="noopener noreferrer">{{ follow.follower.name + '@' + follow.follower.host }}</a></td>
|
||||||
|
|
||||||
<td *ngIf="follow.state === 'accepted'" i18n>Accepted</td>
|
<td *ngIf="follow.state === 'accepted'" i18n>Accepted</td>
|
||||||
|
|
|
@ -15,18 +15,16 @@
|
||||||
|
|
||||||
<ng-template pTemplate="header">
|
<ng-template pTemplate="header">
|
||||||
<tr>
|
<tr>
|
||||||
<th i18n style="width: 60px">ID</th>
|
|
||||||
<th i18n>Host</th>
|
<th i18n>Host</th>
|
||||||
<th i18n>State</th>
|
<th i18n pSortableColumn="state">State <p-sortIcon field="state"></p-sortIcon></th>
|
||||||
<th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
|
<th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
|
||||||
<th i18n>Redundancy allowed</th>
|
<th i18n pSortableColumn="redundancyAllowed">Redundancy allowed <p-sortIcon field="redundancyAllowed"></p-sortIcon></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<ng-template pTemplate="body" let-follow>
|
<ng-template pTemplate="body" let-follow>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ follow.id }}</td>
|
|
||||||
<td>{{ follow.following.host }}</td>
|
<td>{{ follow.following.host }}</td>
|
||||||
|
|
||||||
<td *ngIf="follow.state === 'accepted'" i18n>Accepted</td>
|
<td *ngIf="follow.state === 'accepted'" i18n>Accepted</td>
|
||||||
|
|
|
@ -49,8 +49,8 @@ const SORTABLE_COLUMNS = {
|
||||||
VIDEO_COMMENT_THREADS: [ 'createdAt' ],
|
VIDEO_COMMENT_THREADS: [ 'createdAt' ],
|
||||||
VIDEO_RATES: [ 'createdAt' ],
|
VIDEO_RATES: [ 'createdAt' ],
|
||||||
BLACKLISTS: [ 'id', 'name', 'duration', 'views', 'likes', 'dislikes', 'uuid', 'createdAt' ],
|
BLACKLISTS: [ 'id', 'name', 'duration', 'views', 'likes', 'dislikes', 'uuid', 'createdAt' ],
|
||||||
FOLLOWERS: [ 'createdAt' ],
|
FOLLOWERS: [ 'createdAt', 'state', 'score' ],
|
||||||
FOLLOWING: [ 'createdAt' ],
|
FOLLOWING: [ 'createdAt', 'redundancyAllowed', 'state' ],
|
||||||
|
|
||||||
VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes', 'trending' ],
|
VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes', 'trending' ],
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import { logger } from '../../helpers/logger'
|
||||||
import { getServerActor } from '../../helpers/utils'
|
import { getServerActor } from '../../helpers/utils'
|
||||||
import { ACTOR_FOLLOW_SCORE, FOLLOW_STATES, SERVER_ACTOR_NAME } from '../../initializers/constants'
|
import { ACTOR_FOLLOW_SCORE, FOLLOW_STATES, SERVER_ACTOR_NAME } from '../../initializers/constants'
|
||||||
import { ServerModel } from '../server/server'
|
import { ServerModel } from '../server/server'
|
||||||
import { createSafeIn, getSort } from '../utils'
|
import { createSafeIn, getSort, getFollowsSort } from '../utils'
|
||||||
import { ActorModel, unusedActorAttributesForAPI } from './actor'
|
import { ActorModel, unusedActorAttributesForAPI } from './actor'
|
||||||
import { VideoChannelModel } from '../video/video-channel'
|
import { VideoChannelModel } from '../video/video-channel'
|
||||||
import { AccountModel } from '../account/account'
|
import { AccountModel } from '../account/account'
|
||||||
|
@ -324,7 +324,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
|
||||||
distinct: true,
|
distinct: true,
|
||||||
offset: start,
|
offset: start,
|
||||||
limit: count,
|
limit: count,
|
||||||
order: getSort(sort),
|
order: getFollowsSort(sort),
|
||||||
where: followWhere,
|
where: followWhere,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -391,7 +391,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
|
||||||
distinct: true,
|
distinct: true,
|
||||||
offset: start,
|
offset: start,
|
||||||
limit: count,
|
limit: count,
|
||||||
order: getSort(sort),
|
order: getFollowsSort(sort),
|
||||||
where: followWhere,
|
where: followWhere,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,19 @@ function getBlacklistSort (model: any, value: string, lastSort: OrderItem = [ 'i
|
||||||
return [ firstSort, lastSort ]
|
return [ firstSort, lastSort ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFollowsSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
|
||||||
|
const { direction, field } = buildDirectionAndField(value)
|
||||||
|
|
||||||
|
if (field === 'redundancyAllowed') {
|
||||||
|
return [
|
||||||
|
[ 'ActorFollowing', 'Server', 'redundancyAllowed', direction ],
|
||||||
|
lastSort
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
return getSort(value, lastSort)
|
||||||
|
}
|
||||||
|
|
||||||
function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) {
|
function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) {
|
||||||
const now = Date.now()
|
const now = Date.now()
|
||||||
const createdAtTime = model.createdAt.getTime()
|
const createdAtTime = model.createdAt.getTime()
|
||||||
|
@ -163,6 +176,7 @@ export {
|
||||||
buildWhereIdOrUUID,
|
buildWhereIdOrUUID,
|
||||||
isOutdated,
|
isOutdated,
|
||||||
parseAggregateResult,
|
parseAggregateResult,
|
||||||
|
getFollowsSort,
|
||||||
createSafeIn
|
createSafeIn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue