-
Notifications
You must be signed in to change notification settings - Fork 916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Table Visualization]restore export csv feature to table vis #2568
[Table Visualization]restore export csv feature to table vis #2568
Conversation
* add addtional action in toolbar to allow export data to csv. there are two types of csv, raw and formatted. raw is the original data and formatted is to show formatted Date and percentage data when needed. * when table is not saved, export csv file will be named as unsaved-raw.csv if choose raw. when table is saved with a filename, it will be saved as [filename]-[raw/formatted].csv Partically resolved: opensearch-project#2379 Signed-off-by: Anan Zhuang <[email protected]>
@@ -23,6 +23,7 @@ export const toExpressionAst = (vis: Vis, params: any) => { | |||
const schemas = getVisSchemas(vis, params); | |||
|
|||
const tableData = { | |||
title: vis.title, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is visualization title always present or do we need some default title set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question. Here table vis is using Visualization plugin. title is initiated here
public title: string = '';
when table vis is saved, title will be the saved title. otherwise, it will be an empty string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only place requires initialization is buckets: schemas.bucket || []
. This is because for table vis, we defined buckets as a required field in TableVisConfig
:
export interface TableVisConfig extends TableVisParams {
title: string;
metrics: SchemaConfig[];
buckets: SchemaConfig[];
splitRow?: SchemaConfig[];
splitColumn?: SchemaConfig[];
}
But in Visualization plugin, bucket
is defined as any[] || undefined
since it is optional, in Schema. Therefore, we need to initiated to []
.
export interface Schemas {
metric: SchemaConfig[];
bucket?: any[];
geo_centroid?: any[];
group?: any[];
params?: any[];
radius?: any[];
segment?: any[];
split_column?: any[];
split_row?: any[];
width?: any[];
// catch all for schema name
[key: string]: any[] | undefined;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SchemaConfig
I see! Is there a specific reason as to why buckets
is a required field in Table vis?
@ananzh Just curious to know why CI checks have been omitted on this PR? Is it because this is going into feature branch? Also, is the change going to get into main incrementally or will it has to be done with other changes for table visualization? Is this change planned for next major release? |
Yes, you are right. It is due to feature branch. Once we put everything together and send table vis to main, then it will run through all the tests. |
…opensearch-project#2279) To convert the table visualization into React & OUI DataGrid component, in this PR, we did two main things: * clean out legacy angular code * restore table vis in react * Datagrid component does not support splitted grids. For future transfer to OUI Datagrid, we create a tableGroup in visData for splitted grids. issue resolved: opensearch-project#2212 https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2213a Signed-off-by: Anan Zhuang <[email protected]> rename visTable back to opensearch_dashboards_table and add stronger type Signed-off-by: Anan Zhuang <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] add a plain datagrid component (opensearch-project#2390) implement a plain OuiDataGrid component use the basic pagenation, sort and format. Partially resolve: opensearch-project#2305 Signed-off-by: Anan Zhuang <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] restore datagrid columns (opensearch-project#2411) * restore datagrid columns * display column title correctly * deangular and re-use formatted column * convert formatted column to data grid column * restore filter in and filter out value functions Partially resolve: opensearch-project#2305 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] restore pagination to table vis (opensearch-project#2461) * add pagination patically resolved: opensearch-project#2305 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] make table vis column resizable (opensearch-project#2464) * add resizable state to column Partially resolve: opensearch-project#2305 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] make table vis column sortable (opensearch-project#2502) * add sort state (asc | desc) to column * fix pagination issue Partially resolve: opensearch-project#2305 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] format table cell and restore showTotal feature (opensearch-project#2562) * format table cell to show Date and percent * restore showTotal feature: it allows table vis to show total, avg, min, max and count statics on count * fix some type errors Partically resolved: opensearch-project#2379 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization]restore export csv feature to table vis (opensearch-project#2568) * add addtional action in toolbar to allow export data to csv. there are two types of csv, raw and formatted. raw is the original data and formatted is to show formatted Date and percentage data when needed. * when table is not saved, export csv file will be named as unsaved-raw.csv if choose raw. when table is saved with a filename, it will be saved as [filename]-[raw/formatted].csv Partically resolved: opensearch-project#2379 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] split table in rows and columns This PR implement a group component TableVisGroupComponent utilizing TableVisComponent as sub component. It also adds a title to TableVisComponent. Partically resolved: opensearch-project#2379 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] remove local state * remove local col width state to allow split tables to fetch updated col width state * fix type errors in usePagination Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] remove repeated column from split tables Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization][BUG] partical rows option generate repeated metrics Signed-off-by: Anan Zhuang <[email protected]>
…opensearch-project#2279) To convert the table visualization into React & OUI DataGrid component, in this PR, we did two main things: * clean out legacy angular code * restore table vis in react * Datagrid component does not support splitted grids. For future transfer to OUI Datagrid, we create a tableGroup in visData for splitted grids. issue resolved: opensearch-project#2212 https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2213a Signed-off-by: Anan Zhuang <[email protected]> rename visTable back to opensearch_dashboards_table and add stronger type Signed-off-by: Anan Zhuang <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] add a plain datagrid component (opensearch-project#2390) implement a plain OuiDataGrid component use the basic pagenation, sort and format. Partially resolve: opensearch-project#2305 Signed-off-by: Anan Zhuang <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] restore datagrid columns (opensearch-project#2411) * restore datagrid columns * display column title correctly * deangular and re-use formatted column * convert formatted column to data grid column * restore filter in and filter out value functions Partially resolve: opensearch-project#2305 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] restore pagination to table vis (opensearch-project#2461) * add pagination patically resolved: opensearch-project#2305 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] make table vis column resizable (opensearch-project#2464) * add resizable state to column Partially resolve: opensearch-project#2305 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] make table vis column sortable (opensearch-project#2502) * add sort state (asc | desc) to column * fix pagination issue Partially resolve: opensearch-project#2305 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] format table cell and restore showTotal feature (opensearch-project#2562) * format table cell to show Date and percent * restore showTotal feature: it allows table vis to show total, avg, min, max and count statics on count * fix some type errors Partically resolved: opensearch-project#2379 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization]restore export csv feature to table vis (opensearch-project#2568) * add addtional action in toolbar to allow export data to csv. there are two types of csv, raw and formatted. raw is the original data and formatted is to show formatted Date and percentage data when needed. * when table is not saved, export csv file will be named as unsaved-raw.csv if choose raw. when table is saved with a filename, it will be saved as [filename]-[raw/formatted].csv Partically resolved: opensearch-project#2379 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization] split table in rows and columns (opensearch-project#2578) This PR implement a group component TableVisGroupComponent utilizing TableVisComponent as sub component. It also adds a title to TableVisComponent. Partically resolved: opensearch-project#2379 Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization][IMPROVE] remove repeated column from split tables (opensearch-project#2583) Currently, when we split table by columns, the split column is shown both in the table title and as a separate column. This is not needed. In this PR, we remove the repeated column in split tables in col. Partically resolved: opensearch-project#2579 (comment) Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization][BUG] remove local column width state (opensearch-project#2582) * remove local col width state to allow split tables to fetch updated col width state * fix type errors in usePagination Partially resolved: opensearch-project#2579 (comment) Signed-off-by: Anan Zhuang <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> [Table Visualization][BUG] partical rows shows metrics for all columns (opensearch-project#2648) Currently, when we enable Show partial rows in the Options panel, we see metrics been added to every column even though Show metrics for every bucket/level is not enabled. Metrics are added and returned when we enable the partial rows. This PR fixed the bug by slice the returned data to allow only the last set of metrices. Partially resolved: opensearch-project#2579 (comment) Signed-off-by: Anan Zhuang <[email protected]>
Description
Partically resolved:
#2379
Previous table export feature is build in agg_table.js and agg_table.html :
With DataGrid component, we could use its toolbar. Toolbar is on top of the table vis. We could put export left or right of the toolbar. See what is shown in the example:
We could also add a toolbar option, so toolbar, by default, is not shown when click table vis. When customer needs to export, he/she can click
Options
button on the right and then add toolbar. Need some UX decisions here.Currently, table vis with export looks like this: