<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<nz-table
  class="small"
  nzTemplateMode
  nzSize="small"
  [nzLoading]="isLoading"
  [nzScroll]="{ x: '1180px', y: 'calc(100% - 36px)' }"
  [nzFrontPagination]="false"
  [nzShowPagination]="false"
>
  <thead>
    <tr>
      <th nzWidth="220px" nzLeft>Metric</th>
      <th nzWidth="120px">Min</th>
      <th nzWidth="120px">Max</th>
      <th nzWidth="120px">Avg</th>
      <th nzWidth="120px">Sum</th>
      <th nzWidth="120px">Median</th>
      <th nzWidth="120px">25th Percentile</th>
      <th nzWidth="120px">75th Percentile</th>
      <th nzWidth="120px">95th Percentile</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td nzLeft>CREATED Duration</td>
      <td>{{ aggregated?.['status-duration'].CREATED.min | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].CREATED.max | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].CREATED.avg | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].CREATED.sum | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].CREATED.median | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].CREATED.p25 | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].CREATED.p75 | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].CREATED.p95 | humanizeDuration }}</td>
    </tr>
    <tr>
      <td nzLeft>SCHEDULED Duration</td>
      <td>{{ aggregated?.['status-duration'].SCHEDULED.min | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].SCHEDULED.max | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].SCHEDULED.avg | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].SCHEDULED.sum | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].SCHEDULED.median | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].SCHEDULED.p25 | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].SCHEDULED.p75 | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].SCHEDULED.p95 | humanizeDuration }}</td>
    </tr>
    <tr>
      <td nzLeft>DEPLOYING Duration</td>
      <td>
        {{ aggregated?.['status-duration'].DEPLOYING.min | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.['status-duration'].DEPLOYING.max | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.['status-duration'].DEPLOYING.avg | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.['status-duration'].DEPLOYING.sum | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.['status-duration'].DEPLOYING.median | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.['status-duration'].DEPLOYING.p25 | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.['status-duration'].DEPLOYING.p75 | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.['status-duration'].DEPLOYING.p95 | humanizeDuration }}
      </td>
    </tr>
    <tr>
      <td nzLeft>INITIALIZING Duration</td>
      <td>{{ aggregated?.['status-duration'].INITIALIZING.min | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].INITIALIZING.max | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].INITIALIZING.avg | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].INITIALIZING.sum | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].INITIALIZING.median | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].INITIALIZING.p25 | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].INITIALIZING.p75 | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].INITIALIZING.p95 | humanizeDuration }}</td>
    </tr>
    <tr>
      <td nzLeft>RUNNING Duration</td>
      <td>{{ aggregated?.['status-duration'].RUNNING.min | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].RUNNING.max | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].RUNNING.avg | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].RUNNING.sum | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].RUNNING.median | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].RUNNING.p25 | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].RUNNING.p75 | humanizeDuration }}</td>
      <td>{{ aggregated?.['status-duration'].RUNNING.p95 | humanizeDuration }}</td>
    </tr>
    <tr>
      <td nzLeft>Read Records</td>
      <td>{{ (aggregated?.metrics['read-records'].min | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['read-records'].max | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['read-records'].avg | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['read-records'].sum | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['read-records'].median | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['read-records'].p25 | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['read-records'].p75 | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['read-records'].p95 | number: '1.0-0') || '-' }}</td>
    </tr>
    <tr>
      <td nzLeft>Write Records</td>
      <td>{{ (aggregated?.metrics['write-records'].min | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['write-records'].max | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['write-records'].avg | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['write-records'].sum | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['write-records'].median | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['write-records'].p25 | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['write-records'].p75 | number: '1.0-0') || '-' }}</td>
      <td>{{ (aggregated?.metrics['write-records'].p95 | number: '1.0-0') || '-' }}</td>
    </tr>
    <tr>
      <td nzLeft>Read Bytes</td>
      <td>{{ aggregated?.metrics['read-bytes'].min | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['read-bytes'].max | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['read-bytes'].avg | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['read-bytes'].sum | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['read-bytes'].median | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['read-bytes'].p25 | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['read-bytes'].p75 | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['read-bytes'].p95 | humanizeBytes }}</td>
    </tr>
    <tr>
      <td nzLeft>Write Bytes</td>
      <td>{{ aggregated?.metrics['write-bytes'].min | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['write-bytes'].max | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['write-bytes'].avg | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['write-bytes'].sum | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['write-bytes'].median | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['write-bytes'].p25 | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['write-bytes'].p75 | humanizeBytes }}</td>
      <td>{{ aggregated?.metrics['write-bytes'].p95 | humanizeBytes }}</td>
    </tr>
    <tr>
      <td nzLeft>Accumulated Backpressured Time</td>
      <td>
        {{ aggregated?.metrics['accumulated-backpressured-time'].min | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.metrics['accumulated-backpressured-time'].max | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.metrics['accumulated-backpressured-time'].avg | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.metrics['accumulated-backpressured-time'].sum | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.metrics['accumulated-backpressured-time'].median | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.metrics['accumulated-backpressured-time'].p25 | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.metrics['accumulated-backpressured-time'].p75 | humanizeDuration }}
      </td>
      <td>
        {{ aggregated?.metrics['accumulated-backpressured-time'].p95 | humanizeDuration }}
      </td>
    </tr>
    <tr>
      <td nzLeft>Accumulated Idle Time</td>
      <td>{{ aggregated?.metrics['accumulated-idle-time'].min | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-idle-time'].max | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-idle-time'].avg | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-idle-time'].sum | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-idle-time'].median | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-idle-time'].p25 | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-idle-time'].p75 | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-idle-time'].p95 | humanizeDuration }}</td>
    </tr>
    <tr>
      <td nzLeft>Accumulated Busy Time</td>
      <td>{{ aggregated?.metrics['accumulated-busy-time'].min | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-busy-time'].max | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-busy-time'].avg | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-busy-time'].sum | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-busy-time'].median | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-busy-time'].p25 | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-busy-time'].p75 | humanizeDuration }}</td>
      <td>{{ aggregated?.metrics['accumulated-busy-time'].p95 | humanizeDuration }}</td>
    </tr>
  </tbody>
</nz-table>
