Chocobozzz/PeerTube

View on GitHub
client/src/app/+my-library/my-ownership/my-ownership.component.html

Summary

Maintainability
Test Coverage
<div class="sub-title-container">
  <div class="sub-title">
    <my-global-icon iconName="download" aria-hidden="true"></my-global-icon>
    <h1 i18n>My ownership changes</h1>
  </div>
</div>

<p-table
  [value]="videoChangeOwnerships" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage"
  [first]="pagination.start" [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)"
>
  <ng-template pTemplate="header">
    <tr>
      <th scope="col" style="width: 150px;" i18n>Actions</th>
      <th scope="col" style="width: 35%;" i18n>Initiator</th>
      <th scope="col" style="width: 65%;" i18n>Video</th>
      <th scope="col" style="width: 150px;" i18n [ngbTooltip]="sortTooltip" container="body" pSortableColumn="createdAt">
        Created
        <p-sortIcon field="createdAt"></p-sortIcon>
      </th>
      <th scope="col" style="width: 100px;" i18n>Status</th>
    </tr>
  </ng-template>

  <ng-template pTemplate="body" let-videoChangeOwnership>
    <tr>
      <td class="action-cell">
        <ng-container *ngIf="videoChangeOwnership.status === 'WAITING'">
          <my-button i18n-title title="Accept" icon="tick" (click)="openAcceptModal(videoChangeOwnership)"></my-button>
          <my-button i18n-title title="Refuse" icon="cross" (click)="refuse(videoChangeOwnership)"></my-button>
        </ng-container>
      </td>
      <td>
        <a [href]="videoChangeOwnership.initiatorAccount.url" i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer">
          <div class="chip two-lines">
            <my-actor-avatar [actor]="videoChangeOwnership.initiatorAccount" actorType="account" size="32"></my-actor-avatar>
            <div>
              {{ videoChangeOwnership.initiatorAccount.displayName }}
              <span class="muted">{{ videoChangeOwnership.initiatorAccount.nameWithHost }}</span>
            </div>
          </div>
        </a>
      </td>

      <td>
        <my-video-cell [video]="videoChangeOwnership.video"></my-video-cell>
      </td>

      <td>{{ videoChangeOwnership.createdAt | date: 'short' }}</td>

      <td>
        <span class="pt-badge"
          [ngClass]="getStatusClass(videoChangeOwnership.status)">{{ videoChangeOwnership.status }}</span>
      </td>
    </tr>
  </ng-template>

  <ng-template pTemplate="emptymessage">
    <tr>
      <td myAutoColspan>
        <div class="no-results">
          <ng-container i18n>No ownership change request found.</ng-container>
        </div>
      </td>
    </tr>
  </ng-template>
</p-table>

<my-accept-ownership #myAcceptOwnershipComponent (accepted)="accepted()"></my-accept-ownership>