From 7eac685e47e2eadbaf2ad0fe83ed42e399e4796f Mon Sep 17 00:00:00 2001 From: mcbrewster <37322608+mcbrewster@users.noreply.github.com> Date: Fri, 24 May 2019 23:18:18 -0700 Subject: [PATCH] Web-console: add hostname to tasks view (#7758) * add host name * change to location * remove space --- web-console/src/utils/general.tsx | 3 ++- .../__snapshots__/tasks-view.spec.tsx.snap | 8 ++++++++ web-console/src/views/task-view/tasks-view.tsx | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/web-console/src/utils/general.tsx b/web-console/src/utils/general.tsx index 52aff78ba4a..87d5e24f278 100644 --- a/web-console/src/utils/general.tsx +++ b/web-console/src/utils/general.tsx @@ -88,9 +88,10 @@ function getNeedleAndMode(input: string): NeedleAndMode { } export function booleanCustomTableFilter(filter: Filter, value: any): boolean { - if (value === undefined) { + if (value === undefined ) { return true; } + if (value === null) return false; const haystack = String(value.toLowerCase()); const needleAndMode: NeedleAndMode = getNeedleAndMode(filter.value.toLowerCase()); const needle = needleAndMode.needle; diff --git a/web-console/src/views/task-view/__snapshots__/tasks-view.spec.tsx.snap b/web-console/src/views/task-view/__snapshots__/tasks-view.spec.tsx.snap index 5ef95b58ab9..16b7b901256 100644 --- a/web-console/src/views/task-view/__snapshots__/tasks-view.spec.tsx.snap +++ b/web-console/src/views/task-view/__snapshots__/tasks-view.spec.tsx.snap @@ -362,6 +362,7 @@ exports[`describe tasks view tasks view snapshot 1`] = ` "Task ID", "Type", "Datasource", + "Location", "Created time", "Status", "Duration", @@ -446,6 +447,13 @@ exports[`describe tasks view tasks view snapshot 1`] = ` "accessor": "datasource", "show": true, }, + Object { + "Aggregated": [Function], + "Header": "Location", + "accessor": "location", + "filterMethod": [Function], + "show": true, + }, Object { "Aggregated": [Function], "Header": "Created time", diff --git a/web-console/src/views/task-view/tasks-view.tsx b/web-console/src/views/task-view/tasks-view.tsx index da4f3aede2c..442317f9e50 100644 --- a/web-console/src/views/task-view/tasks-view.tsx +++ b/web-console/src/views/task-view/tasks-view.tsx @@ -41,7 +41,7 @@ import { BasicAction, basicActionsToMenu } from '../../utils/basic-action'; import './tasks-view.scss'; const supervisorTableColumns: string[] = ['Datasource', 'Type', 'Topic/Stream', 'Status', 'Actions']; -const taskTableColumns: string[] = ['Task ID', 'Type', 'Datasource', 'Created time', 'Status', 'Duration', 'Actions']; +const taskTableColumns: string[] = ['Task ID', 'Type', 'Datasource', 'Location', 'Created time', 'Status', 'Duration', 'Actions']; export interface TasksViewProps extends React.Props { taskId: string | null; @@ -231,7 +231,7 @@ export class TasksView extends React.Component { CASE WHEN "status" = 'RUNNING' THEN (CASE WHEN "runner_status" = 'RUNNING' THEN 4 WHEN "runner_status" = 'PENDING' THEN 3 ELSE 2 END) ELSE 1 END AS "rank", - "location", "duration", "error_msg" + "location", "duration", "error_msg" FROM sys.tasks ORDER BY "rank" DESC, "created_time" DESC`); @@ -608,6 +608,16 @@ ORDER BY "rank" DESC, "created_time" DESC`); }, show: taskTableColumnSelectionHandler.showColumn('Datasource') }, + + { + Header: 'Location', + accessor: 'location', + Aggregated: row => '', + filterMethod: (filter: Filter, row: any) => { + return booleanCustomTableFilter(filter, row.location); + }, + show: taskTableColumnSelectionHandler.showColumn('Location') + }, { Header: 'Created time', accessor: 'created_time',