You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by cw...@apache.org on 2019/05/16 23:46:13 UTC
[incubator-druid] branch master updated: Web console: fixed issue
when grouping tasks by different attributes (#7657)
This is an automated email from the ASF dual-hosted git repository.
cwylie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/master by this push:
new ec0b778 Web console: fixed issue when grouping tasks by different attributes (#7657)
ec0b778 is described below
commit ec0b7787cf1811bbbe90f5c5e5f6514a24894d12
Author: Jenny Zhu <je...@imply.io>
AuthorDate: Thu May 16 16:46:04 2019 -0700
Web console: fixed issue when grouping tasks by different attributes (#7657)
* deleted created_time in "status"
* added toString on the status object
---
web-console/src/views/tasks-view.tsx | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/web-console/src/views/tasks-view.tsx b/web-console/src/views/tasks-view.tsx
index 8acee10..b76d23d 100644
--- a/web-console/src/views/tasks-view.tsx
+++ b/web-console/src/views/tasks-view.tsx
@@ -117,7 +117,7 @@ export class TasksView extends React.Component<TasksViewProps, TasksViewState> {
private taskQueryManager: QueryManager<string, TaskQueryResultRow[]>;
private supervisorTableColumnSelectionHandler: TableColumnSelectionHandler;
private taskTableColumnSelectionHandler: TableColumnSelectionHandler;
- static statusRanking = {RUNNING: 4, PENDING: 3, WAITING: 2, SUCCESS: 1, FAILED: 1};
+ static statusRanking: Record<string, number> = {RUNNING: 4, PENDING: 3, WAITING: 2, SUCCESS: 1, FAILED: 1};
constructor(props: TasksViewProps, context: any) {
super(props, context);
@@ -600,7 +600,7 @@ ORDER BY "rank" DESC, "created_time" DESC`);
Header: 'Status',
id: 'status',
width: 110,
- accessor: (row) => { return {status: row.status, created_time: row.created_time}; },
+ accessor: (row) => ({ status: row.status, created_time: row.created_time, toString: () => row.status }),
Cell: row => {
if (row.aggregated) return '';
const { status, location } = row.original;
@@ -617,20 +617,20 @@ ORDER BY "rank" DESC, "created_time" DESC`);
{errorMsg && <a onClick={() => this.setState({ alertErrorMsg: errorMsg })} title={errorMsg}> ?</a>}
</span>;
},
- PivotValue: (opt) => {
- const { subRows, value } = opt;
- if (!subRows || !subRows.length) return '';
- return `${subRows[0]._original['status']} (${subRows.length})`;
- },
- Aggregated: (opt: any) => {
- const { subRows, column } = opt;
- const previewValues = subRows.filter((d: any) => typeof d[column.id] !== 'undefined').map((row: any) => row._original[column.id]);
- const previewCount = countBy(previewValues);
- return <span>{Object.keys(previewCount).sort().map(v => `${v} (${previewCount[v]})`).join(', ')}</span>;
- },
sortMethod: (d1, d2) => {
- const statusRanking: any = TasksView.statusRanking;
- return statusRanking[d1.status] - statusRanking[d2.status] || d1.created_time.localeCompare(d2.created_time);
+ const typeofD1 = typeof d1;
+ const typeofD2 = typeof d2;
+ if (typeofD1 !== typeofD2) return 0;
+ switch (typeofD1) {
+ case 'string':
+ return TasksView.statusRanking[d1] - TasksView.statusRanking[d2];
+
+ case 'object':
+ return TasksView.statusRanking[d1.status] - TasksView.statusRanking[d2.status] || d1.created_time.localeCompare(d2.created_time);
+
+ default:
+ return 0;
+ }
},
filterMethod: (filter: Filter, row: any) => {
return booleanCustomTableFilter(filter, row.status.status);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org