From 8ea071d79ca3cf2deff66ea565466b7cc1fc41e8 Mon Sep 17 00:00:00 2001 From: Blair Chen Date: Thu, 7 Jul 2022 16:32:15 +0800 Subject: [PATCH] UI: Display more columns in DataSource and Feature list page --- ui/src/components/dataSourceList.tsx | 70 +++++++++++++++++++--------- ui/src/components/featureList.tsx | 59 +++++++++++++++++++---- ui/src/models/model.ts | 7 +-- 3 files changed, 102 insertions(+), 34 deletions(-) diff --git a/ui/src/components/dataSourceList.tsx b/ui/src/components/dataSourceList.tsx index 0abd63b8d..71466524c 100644 --- a/ui/src/components/dataSourceList.tsx +++ b/ui/src/components/dataSourceList.tsx @@ -1,18 +1,17 @@ import React, { useCallback, useEffect, useState } from 'react'; import { Form, Select, Table } from "antd"; -import { DataSourceAttributes, DataSource } from "../models/model"; +import { DataSource } from "../models/model"; import { fetchDataSources, fetchProjects } from "../api"; const DataSourceList: React.FC = () => { const columns = [ { title:
Name
, - dataIndex: 'attributes', key: 'name', align: 'center' as 'center', width: 120, - render: (row: DataSourceAttributes) => { - return row.name; + render: (row: DataSource) => { + return row.attributes.name; }, onCell: () => { return { @@ -23,13 +22,12 @@ const DataSourceList: React.FC = () => { } }, { - title:
QualifiedName
, - dataIndex: 'attributes', - key: 'qualifiedName', + title:
Type
, + key: 'type', align: 'center' as 'center', - width: 120, - render: (row: DataSourceAttributes) => { - return row.qualifiedName; + width: 80, + render: (row: DataSource) => { + return row.attributes.type; }, onCell: () => { return { @@ -40,13 +38,44 @@ const DataSourceList: React.FC = () => { } }, { - title:
Type
, - dataIndex: 'attributes', - key: 'attributes', + title:
Path
, + key: 'path', align: 'center' as 'center', - width: 80, - render: (row: DataSourceAttributes) => { - return row.type; + width: 190, + render: (row: DataSource) => { + return row.attributes.path; + }, + onCell: () => { + return { + style: { + maxWidth: 120 + } + } + } + }, + { + title:
Pre Processing
, + key: 'preprocessing', + align: 'center' as 'center', + width: 190, + render: (row: DataSource) => { + return row.attributes.preprocessing; + }, + onCell: () => { + return { + style: { + maxWidth: 120 + } + } + } + }, + { + title:
Event Timestamp Column
, + key: 'eventTimestampColumn', + align: 'center' as 'center', + width: 190, + render: (row: DataSource) => { + return row.attributes.eventTimestampColumn; }, onCell: () => { return { @@ -57,13 +86,12 @@ const DataSourceList: React.FC = () => { } }, { - title:
Path
, - dataIndex: 'attributes', - key: 'attributes', + title:
Timestamp Format
, + key: 'timestampFormat', align: 'center' as 'center', width: 190, - render: (row: DataSourceAttributes) => { - return row.path; + render: (row: DataSource) => { + return row.attributes.timestampFormat; }, onCell: () => { return { diff --git a/ui/src/components/featureList.tsx b/ui/src/components/featureList.tsx index d71cd9fef..fe7aa2b17 100644 --- a/ui/src/components/featureList.tsx +++ b/ui/src/components/featureList.tsx @@ -9,15 +9,14 @@ const FeatureList: React.FC = () => { const navigate = useNavigate(); const columns = [ { - title:
Name
, - dataIndex: 'displayText', + title:
Name
, key: 'name', width: 150, render: (name: string, row: Feature) => { return ( + } }>{ row.displayText } ) }, onCell: () => { @@ -29,11 +28,14 @@ const FeatureList: React.FC = () => { } }, { - title:
Type
, - dataIndex: 'typeName', + title:
Type
, key: 'type', - align: 'center' as 'center', - width: 190, + width: 120, + render: (name: string, row: Feature) => { + return ( +
{ row.typeName.replace('feathr_', '').replace('_v1', '')}
+ ) + }, onCell: () => { return { style: { @@ -43,9 +45,46 @@ const FeatureList: React.FC = () => { } }, { - title: (
Action Learn more }>
), - dataIndex: 'action', + title:
Transformation
, + key: 'transformation', + width: 190, + render: (name: string, row: Feature) => { + return ( +
{ row.attributes.transformation.transformExpr ?? row.attributes.transformation.defExpr }
+ ) + }, + onCell: () => { + return { + style: { + maxWidth: 120, + } + } + } + }, + { + title:
Aggregation
, + key: 'aggregation', + width: 150, + render: (name: string, row: Feature) => { + return ( + <> +
{ row.attributes.transformation.aggFunc && `Type: ${ row.attributes.transformation.aggFunc }` }
+
{ row.attributes.transformation.aggFunc && `Window: ${ row.attributes.transformation.window }` }
+
{ row.attributes.transformation.aggFunc && `Key: ${ row.attributes.key[0].keyColumn }` }
+ + ) + }, + onCell: () => { + return { + style: { + maxWidth: 120, + } + } + } + }, + { + title: ( +
Action Learn more }>
), key: 'action', align: 'center' as 'center', width: 120, diff --git a/ui/src/models/model.ts b/ui/src/models/model.ts index ed195d1a6..67138833a 100644 --- a/ui/src/models/model.ts +++ b/ui/src/models/model.ts @@ -61,19 +61,20 @@ export interface DataSource { attributes: DataSourceAttributes; displayText: string; guid: string; - labels: string[]; - name: string; - qualifiedName: string; + lastModifiedTS: string; status: string; typeName: string; version: string; } export interface DataSourceAttributes { + eventTimestampColumn: string; name: string; path: string; + preprocessing: string; qualifiedName: string; tags: string[]; + timestampFormat: string; type: string; }