Unify paginator disabling when no result is displayable, fix batch domain add for non-https

This commit is contained in:
Rigel Kent 2020-04-19 23:42:06 +02:00 committed by Rigel Kent
parent 36004aa7b0
commit b8cf27c0f8
18 changed files with 56 additions and 31 deletions

View File

@ -1,6 +1,8 @@
<p-table
[value]="followers" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[value]="followers" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)"
[showCurrentPageReport]="true" i18n-currentPageReportTemplate
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} followers"
>
<ng-template pTemplate="caption">
<div class="caption">

View File

@ -14,7 +14,8 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
export class FollowersListComponent extends RestTable implements OnInit {
followers: ActorFollow[] = []
totalRecords = 0
rowsPerPage = 10
rowsPerPageOptions = [ 20, 50, 100 ]
rowsPerPage = this.rowsPerPageOptions[0]
sort: SortMeta = { field: 'createdAt', order: -1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }

View File

@ -1,6 +1,8 @@
<p-table
[value]="following" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[value]="following" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)"
[showCurrentPageReport]="true" i18n-currentPageReportTemplate
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} hosts"
>
<ng-template pTemplate="caption">
<div class="caption">
@ -29,7 +31,12 @@
<ng-template pTemplate="body" let-follow>
<tr>
<td>{{ follow.following.host }}</td>
<td>
<a [href]="'https://' + follow.following.host" i18n-title title="Open instance in a new tab" target="_blank" rel="noopener noreferrer">
{{ follow.following.host }}
<span class="glyphicon glyphicon-new-window"></span>
</a>
</td>
<td *ngIf="follow.state === 'accepted'" i18n>Accepted</td>
<td *ngIf="follow.state === 'pending'" i18n>Pending</td>
@ -51,11 +58,17 @@
<td colspan="6">
<div class="empty-table-message">
<ng-container *ngIf="search" i18n>No host found matching current filters.</ng-container>
<ng-container *ngIf="!search" i18n>Your instance is not follwing any host.</ng-container>
<ng-container *ngIf="!search" i18n>Your instance is not following anyone.</ng-container>
</div>
</td>
</tr>
</ng-template>
</p-table>
<my-batch-domains-modal #batchDomainsModal i18n-action action="Follow domains" (domains)="addFollowing($event)"></my-batch-domains-modal>
<my-batch-domains-modal #batchDomainsModal i18n-action action="Follow domains" (domains)="addFollowing($event)">
<ng-container ngProjectAs="warning">
<div i18n *ngIf="httpEnabled() === false" class="alert alert-warning">
It seems that you are not on a HTTPS server. Your webserver needs to have TLS activated in order to follow servers.
</div>
</ng-container>
</my-batch-domains-modal>

View File

@ -1,6 +1,20 @@
@import '_variables';
@import '_mixins';
a {
@include disable-default-a-behaviour;
display: inline-block;
&, &:hover {
color: var(--mainForegroundColor);
}
span {
font-size: 80%;
color: var(--inputPlaceholderColor);
}
}
.caption {
justify-content: flex-end;

View File

@ -18,7 +18,8 @@ export class FollowingListComponent extends RestTable implements OnInit {
following: ActorFollow[] = []
totalRecords = 0
rowsPerPage = 10
rowsPerPageOptions = [ 20, 50, 100 ]
rowsPerPage = this.rowsPerPageOptions[0]
sort: SortMeta = { field: 'createdAt', order: -1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
@ -43,6 +44,10 @@ export class FollowingListComponent extends RestTable implements OnInit {
this.batchDomainsModal.openModal()
}
httpEnabled () {
return window.location.protocol === 'https:'
}
async addFollowing (hosts: string[]) {
this.followService.follow(hosts).subscribe(
() => {

View File

@ -12,7 +12,7 @@
</div>
<p-table
[value]="videoRedundancies" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[value]="videoRedundancies" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
>
<ng-template pTemplate="header">

View File

@ -1,5 +1,5 @@
<p-table
[value]="blockedAccounts" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
[value]="blockedAccounts" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)"
[showCurrentPageReport]="true" i18n-currentPageReportTemplate
currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} muted accounts"

View File

@ -1,5 +1,5 @@
<p-table
[value]="blockedServers" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
[value]="blockedServers" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)"
[showCurrentPageReport]="true" i18n-currentPageReportTemplate
currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} muted instances"
@ -54,10 +54,4 @@
</ng-template>
</p-table>
<my-batch-domains-modal #batchDomainsModal i18n-action action="Mute domains" (domains)="onDomainsToBlock($event)">
<ng-container ngProjectAs="warning">
<div i18n *ngIf="httpEnabled() === false" class="alert alert-warning">
It seems that you are not on a HTTPS server. Your webserver needs to have TLS activated in order to follow servers.
</div>
</ng-container>
</my-batch-domains-modal>
<my-batch-domains-modal #batchDomainsModal i18n-action action="Mute domains" (domains)="onDomainsToBlock($event)"></my-batch-domains-modal>

View File

@ -51,10 +51,6 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni
)
}
httpEnabled () {
return window.location.protocol === 'https:'
}
addServersToBlock () {
this.batchDomainsModal.openModal()
}

View File

@ -154,7 +154,7 @@
<!-- report text -->
<div class="mt-3 d-flex">
<span class="col-3 moderation-expanded-label" i18n>Report</span>
<span class="col-3 moderation-expanded-label" i18n>Report #{{ videoAbuse.id }}</span>
<span class="col-9 moderation-expanded-text" [innerHTML]="videoAbuse.reasonHtml"></span>
</div>
<div class="mt-3 d-flex" *ngIf="videoAbuse.moderationComment">

View File

@ -1,5 +1,5 @@
<p-table
[value]="blacklist" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
[value]="blacklist" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
[showCurrentPageReport]="true" i18n-currentPageReportTemplate
currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} blacklisted videos"

View File

@ -89,10 +89,10 @@ export class PluginListInstalledComponent implements OnInit {
getNoResultMessage () {
if (this.pluginType === PluginType.PLUGIN) {
return this.i18n('You don\'t have plugins installed yet.')
return this.i18n("You don't have plugins installed yet.")
}
return this.i18n('You don\'t have themes installed yet.')
return this.i18n("You don't have themes installed yet.")
}
isUpdateAvailable (plugin: PeerTubePlugin) {

View File

@ -19,7 +19,7 @@
</div>
<p-table
[value]="jobs" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" dataKey="uniqId"
[value]="jobs" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" dataKey="uniqId"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" [first]="pagination.start"
[tableStyle]="{'table-layout':'auto'}"
>

View File

@ -8,7 +8,7 @@
</div>
<p-table
[value]="users" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[value]="users" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
[(selection)]="selectedUsers"
[showCurrentPageReport]="true" i18n-currentPageReportTemplate

View File

@ -3,7 +3,7 @@
</div>
<p-table
[value]="blockedAccounts" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[value]="blockedAccounts" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)"
>

View File

@ -3,7 +3,7 @@
</div>
<p-table
[value]="blockedServers" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[value]="blockedServers" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)"
>

View File

@ -1,7 +1,7 @@
<p-table
[value]="videoChangeOwnerships"
[lazy]="true"
[paginator]="true"
[paginator]="totalRecords > 0"
[totalRecords]="totalRecords"
[rows]="rowsPerPage"
[sortField]="sort.field"

View File

@ -1,5 +1,5 @@
<p-table
[value]="videoImports" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[value]="videoImports" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage"
[sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
>
<ng-template pTemplate="header">