Chocobozzz/PeerTube

View on GitHub
client/src/app/+admin/moderation/video-block-list/video-block-list.component.html

Summary

Maintainability
Test Coverage
<div class="sub-title-container">
  <div class="sub-title">
    <my-global-icon iconName="cross" aria-hidden="true"></my-global-icon>
    <h1 i18n>Video blocks</h1>
  </div>
</div>

<p-table
  [value]="blocklist" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [first]="pagination.start"
  [rowsPerPageOptions]="rowsPerPageOptions" [sortField]="sort.field" [sortOrder]="sort.order" dataKey="id"
  [lazy]="true" (onLazyLoad)="loadLazy($event)" [lazyLoadOnInit]="false"
  [showCurrentPageReport]="true" [currentPageReportTemplate]="getPaginationTemplate()"
  [expandedRowKeys]="expandedRows"
>
  <ng-template pTemplate="caption">
    <div class="caption">
      <div class="ms-auto">
        <my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)"></my-advanced-input-filter>
      </div>
    </div>
  </ng-template>

  <ng-template pTemplate="header">
    <tr>
      <th scope="col" style="width: 40px;">
        <span i18n class="visually-hidden">More information</span>
      </th>
      <th scope="col" style="width: 150px;">
        <span i18n class="visually-hidden">Actions</span>
      </th>
      <th scope="col" i18n [ngbTooltip]="sortTooltip" container="body" pSortableColumn="name">Video <p-sortIcon field="name"></p-sortIcon></th>
      <th scope="col" style="width: 100px;" i18n>Sensitive</th>
      <th scope="col" style="width: 120px;" i18n>Unfederated</th>
      <th scope="col" style="width: 150px;" i18n [ngbTooltip]="sortTooltip" container="body" pSortableColumn="createdAt">Date <p-sortIcon field="createdAt"></p-sortIcon></th>
    </tr>
  </ng-template>

  <ng-template pTemplate="body" let-videoBlock let-expanded="expanded">
    <tr>
      <td *ngIf="!videoBlock.reason">
        <span i18n class="visually-hidden">No more information is available for this row</span>
      </td>

      <td class="expand-cell" *ngIf="videoBlock.reason" >
        <my-table-expander-icon [pRowToggler]="videoBlock" [expanded]="expanded"></my-table-expander-icon>
      </td>

      <td class="action-cell">
        <my-action-dropdown
          [ngClass]="{ 'show': expanded }" placement="bottom-right auto" container="body"
          i18n-label label="Actions" [actions]="videoBlocklistActions" [entry]="videoBlock"
        ></my-action-dropdown>
      </td>

      <td>
        <my-video-cell [video]="videoBlock.video">
          <span name>
            <my-global-icon *ngIf="videoBlock.type === 2" i18n-title title="The video was blocked due to automatic blocking of new videos" iconName="robot"></my-global-icon>
          </span>
        </my-video-cell>
      </td>

      <td>
        <span *ngIf="videoBlock.video.nsfw" class="pt-badge badge-red" i18n>NSFW</span>
      </td>

      <td>
        <span *ngIf="videoBlock.unfederated" class="pt-badge badge-blue" i18n>Unfederated</span>
      </td>

      <td>
        {{ videoBlock.createdAt | date: 'short' }}
      </td>
    </tr>
  </ng-template>

  <ng-template pTemplate="rowexpansion" let-videoBlock>
    <tr>
      <td class="expand-cell" myAutoColspan>
        <div class="d-flex moderation-expanded">

          <div class="left">
            <span class="moderation-expanded-label" i18n>Block reason:</span>
            <span class="moderation-expanded-text" [innerHTML]="videoBlock.reasonHtml"></span>
          </div>

          <div class="right">
            <my-embed [video]="videoBlock.video"></my-embed>
          </div>

        </div>
      </td>
    </tr>
  </ng-template>

  <ng-template pTemplate="emptymessage">
    <tr>
      <td myAutoColspan>
        <div class="no-results">
          <ng-container *ngIf="search" i18n>No blocked video found matching current filters.</ng-container>
          <ng-container *ngIf="!search" i18n>No blocked video found.</ng-container>
        </div>
      </td>
    </tr>
  </ng-template>
</p-table>