<div #tableContainer class="worker-container">
  <sm-table #table
            [tableData]="workers"
            [selection]="selectedWorker"
            [reorderableColumns]="false"
            [resizableColumns]="false"
            [scrollable]="true"
            [columns]="cols"
            [rowsNumber]="100"
            [rowHeight]="40"
            (rowSelectionChanged)="onRowClicked($event)"
  >
    <ng-template let-col let-worker="rowData" pTemplate="body">
      <ng-container [ngSwitch]="col.id">
        <ng-container *ngSwitchCase="WORKERS_TABLE_COL_FIELDS.TASK_RUNNING_TIME">
          <span class="ellipsis">{{worker?.task?.running_time | durationFormater:'ms':'ddhhmmss'}}</span>
          <span *ngIf="!worker?.task?.running_time">&mdash;</span>
        </ng-container>
        <ng-container *ngSwitchCase="WORKERS_TABLE_COL_FIELDS.ID">
          <span class="first-content ellipsis" [smTooltip]="worker.name" smShowTooltipIfEllipsis>
            {{worker.name}}
          </span>
        </ng-container>
        <ng-container *ngSwitchDefault>
          <span  class="ellipsis" [smTooltip]="getBodyData(worker, col)" smShowTooltipIfEllipsis>{{getBodyData(worker, col)}}</span>
          <span *ngIf="(getBodyData(worker, col)!==0) && !getBodyData(worker, col)">&mdash;</span>
        </ng-container>
      </ng-container>
    </ng-template>

    <ng-template let-col pTemplate="sort-filter">
      <sm-table-filter-sort-template
        [class.first]="col.id === WORKERS_TABLE_COL_FIELDS.ID"
        [column]="col"
        [sortOrder]="tableSortFieldsObject[col.id]"
        (sortOrderChanged)="onSortChanged($event, col.id)">
      </sm-table-filter-sort-template>
    </ng-template>
  </sm-table>
</div>



