Skip to content
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

Hide hidden columns from trace viewer #179

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { AgGridReact } from 'ag-grid-react';
import { ColDef, IDatasource, GridReadyEvent } from 'ag-grid-community';
import { QueryHelper } from 'tsp-typescript-client/lib/models/query/query-helper';
import { cloneDeep } from 'lodash';

interface ColumnHeaderType {
hidden: boolean;
tag: string;
}
type TableOuputState = AbstractOutputState & {
tableColumns: ColDef[];
};
Expand Down Expand Up @@ -140,12 +143,21 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
}

columnEntries.forEach(columnHeader => {
const typeString: string | null = columnHeader.type;
let hiddenColumn = false;
if (typeString) {
const type: ColumnHeaderType = JSON.parse(typeString);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the column type field will need to be better documented in the tsp to mention those header types. But I guess that will be part of a more complete overhaul of the data type definition that we discussed a few weeks ago. Right now, the type is a string, while this code suggests it should be an object.

hiddenColumn = type.hidden;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check for undefined when the 'hidden' property doesn't exist.

}

const id = this.showIndexColumn ? ++columnHeader.id : columnHeader.id;
colIds.push(id);
columnsArray.push({
headerName: columnHeader.name,
field: columnHeader.id.toString(),
width: this.props.columnWidth
width: this.props.columnWidth,
hide: hiddenColumn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the ag-grid, the hide property accepts boolean.
https://www.ag-grid.com/javascript-grid-column-properties/

In our case, the hidden column is set to string after JSON.parse. It's good to set to boolean though it works in this case.


});
});

Expand All @@ -159,5 +171,6 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
this.setState({
tableColumns: this.columnArray
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

}
}