<div class="header">
  <div class="peertube-select-container">
    <select [(ngModel)]="logType" (ngModelChange)="refresh()" class="form-control">
      <option *ngFor="let logTypeChoice of logTypeChoices" [value]="logTypeChoice.id">{{ logTypeChoice.label }}</option>
    </select>
  </div>

  <div class="peertube-select-container">
    <select [(ngModel)]="startDate" (ngModelChange)="refresh()" class="form-control">
      <option *ngFor="let timeChoice of timeChoices" [value]="timeChoice.id">{{ timeChoice.label }}</option>
    </select>
  </div>

  <div class="peertube-select-container" *ngIf="!isAuditLog()">
    <select [(ngModel)]="level" (ngModelChange)="refresh()" class="form-control">
      <option *ngFor="let levelChoice of levelChoices" [value]="levelChoice.id">{{ levelChoice.label }}</option>
    </select>
  </div>

  <my-button i18n-label label="Refresh" icon="refresh" (click)="refresh()"></my-button>
</div>

<div class="logs">
  <div *ngIf="loading" i18n>Loading...</div>

  <div #logsElement>
    <div *ngFor="let log of logs" class="log-row" [ngClass]="{ error: log.level === 'error', warn: log.level === 'warn' }">
      <span class="log-level">{{ log.level }}</span>

      <span class="log-date">[{{ log.localeDate }}]</span>

      <strong class="log-by" *ngIf="log.by" i18n>By {{ log.by }} -></strong>
      <strong class="log-domain-action" *ngIf="log.domain">{{ log.domain }} -> {{ log.action }}</strong>

      {{ log.message }}

      <pre>{{ log.meta }}</pre>
    </div>
  </div>
</div>
