Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<thead>
<tr>
<th><strong>ID</strong></th>
<th [nzSortFn]="sortEndpointFn"><strong>Endpoint</strong></th>
<th [nzSortFn]="sortAckTimestampFn"><strong>Acknowledged</strong></th>
<th [nzSortFn]="sortEndToEndDurationFn"><strong>End to End Duration</strong></th>
<th [nzSortFn]="sortCheckpointedSizeFn">
Expand All @@ -166,6 +167,7 @@
<tbody>
<tr *ngFor="let subTask of table.data">
<td>{{ subTask['index'] }}</td>
<td>{{ mapOfSubtask.get(subTask['index'])?.endpoint || '-' }}</td>
<ng-container *ngIf="subTask['status'] === 'completed'">
<td>{{ subTask['ack_timestamp'] | date: 'yyyy-MM-dd HH:mm:ss.SSS' }}</td>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ import { NzTableModule, NzTableSortFn } from 'ng-zorro-antd/table';
import { JobLocalService } from '../../job-local.service';

function createSortFn(
selector: (item: CompletedSubTaskCheckpointStatistics) => number | boolean
selector: (item: CompletedSubTaskCheckpointStatistics) => number | boolean | string | null
): NzTableSortFn<SubTaskCheckpointStatisticsItem> {
// FIXME This type-asserts that pre / next are a specific subtype.
return (pre, next) =>
selector(pre as CompletedSubTaskCheckpointStatistics) > selector(next as CompletedSubTaskCheckpointStatistics)
? 1
: -1;
return (pre, next) => {
const a = selector(pre as CompletedSubTaskCheckpointStatistics) ?? '';
const b = selector(next as CompletedSubTaskCheckpointStatistics) ?? '';
return a > b ? 1 : -1;
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to createSortFn are not needed, since sortEndpointFn is implemented separately without using it.

}

@Component({
Expand All @@ -77,6 +77,11 @@ export class JobCheckpointsSubtaskComponent implements OnInit, OnChanges, OnDest
public mapOfSubtask: Map<number, JobVertexSubTaskData> = new Map();

public readonly sortAckTimestampFn = createSortFn(item => item.ack_timestamp);
public readonly sortEndpointFn: NzTableSortFn<SubTaskCheckpointStatisticsItem> = (a, b) => {
const endpointA = this.mapOfSubtask.get(a['index'])?.endpoint ?? '';
const endpointB = this.mapOfSubtask.get(b['index'])?.endpoint ?? '';
return endpointA > endpointB ? 1 : endpointA < endpointB ? -1 : 0;
};
public readonly sortEndToEndDurationFn = createSortFn(item => item.end_to_end_duration);
public readonly sortCheckpointedSizeFn = createSortFn(item => item.checkpointed_size);
public readonly sortStateSizeFn = createSortFn(item => item.state_size);
Expand Down