From f06f0c3ad86cecc7a05b289748609c6c2508f373 Mon Sep 17 00:00:00 2001 From: Qi Shu Date: Wed, 17 Apr 2019 23:11:45 -0700 Subject: [PATCH] Add created_time as tie breaker when sorting by status in task table (#7460) * Add created_time as tie breaker when sorting by status * Fixed bug * Fixed created_time tie breaker * Use locale compare --- web-console/src/views/tasks-view.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web-console/src/views/tasks-view.tsx b/web-console/src/views/tasks-view.tsx index 5cd4dc40fa7..05f82d806af 100644 --- a/web-console/src/views/tasks-view.tsx +++ b/web-console/src/views/tasks-view.tsx @@ -493,7 +493,7 @@ ORDER BY "rank" DESC, "created_time" DESC`); Header: 'Status', id: 'status', width: 110, - accessor: 'status', + accessor: (row) => { return {status: row.status, created_time: row.created_time}; }, Cell: row => { if (row.aggregated) return ''; const { status, location } = row.original; @@ -521,9 +521,9 @@ ORDER BY "rank" DESC, "created_time" DESC`); const previewCount = countBy(previewValues); return {Object.keys(previewCount).sort().map(v => `${v} (${previewCount[v]})`).join(', ')}; }, - sortMethod: (status1: string, status2: string) => { + sortMethod: (d1, d2) => { const statusRanking: any = this.statusRanking; - return statusRanking[status1] - statusRanking[status2]; + return statusRanking[d1.status] - statusRanking[d2.status] || d1.created_time.localeCompare(d2.created_time); }, show: taskTableColumnSelectionHandler.showColumn('Status') },