diff --git a/packages/react-components/src/components/table-output-component.tsx b/packages/react-components/src/components/table-output-component.tsx index 670dc5fa6..c4b63dfb5 100644 --- a/packages/react-components/src/components/table-output-component.tsx +++ b/packages/react-components/src/components/table-output-component.tsx @@ -103,7 +103,7 @@ export class TableOutputComponent extends AbstractOutputComponentthis.checkFocus(event)} + onFocus={event => this.checkFocus(event)} className={this.props.backgroundTheme === 'light' ? 'ag-theme-balham' : 'ag-theme-balham-dark'} style={{ height: this.props.style.height, width: this.props.outputWidth }}> = 0) { const data = await this.findMatchIndex(currRowIndex, direction); if (data !== undefined) { @@ -633,14 +669,21 @@ export class TableOutputComponent extends AbstractOutputComponent { + allCols.map(item => { if (item.field === column.field) { item.hide = columnApi.getColumn(column).isVisible(); } @@ -693,7 +736,7 @@ export class TableOutputComponent extends AbstractOutputComponent - +
{columns.map((column, key) => diff --git a/packages/react-components/src/components/timegraph-output-component.tsx b/packages/react-components/src/components/timegraph-output-component.tsx index bcab35887..20dde9450 100644 --- a/packages/react-components/src/components/timegraph-output-component.tsx +++ b/packages/react-components/src/components/timegraph-output-component.tsx @@ -22,7 +22,7 @@ import { TspDataProvider } from './data-providers/tsp-data-provider'; import { ReactTimeGraphContainer } from './utils/timegraph-container-component'; import { OutputElementStyle } from 'tsp-typescript-client/lib/models/styles'; import { EntryTree } from './utils/filter-tree/entry-tree'; -import { listToTree, getAllExpandedNodeIds } from './utils/filter-tree/utils'; +import { listToTree, getAllExpandedNodeIds, getIndexOfNode } from './utils/filter-tree/utils'; import hash from 'traceviewer-base/lib/utils/value-hash'; import ColumnHeader from './utils/filter-tree/column-header'; import { TimeGraphAnnotationComponent } from 'timeline-chart/lib/components/time-graph-annotation'; @@ -41,6 +41,7 @@ type TimegraphOutputState = AbstractOutputState & { collapsedNodes: number[]; collapsedMarkerNodes: number[]; columns: ColumnHeader[]; + dataRows: TimelineChart.TimeGraphRowModel[]; }; export class TimegraphOutputComponent extends AbstractTreeOutputComponent { @@ -65,6 +66,7 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent this.doHandleSelectionChangedSignal(payload); + private pendingSelection: TimeGraphEntry | undefined; constructor(props: TimegraphOutputProps) { super(props); @@ -76,7 +78,8 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent { + this.pendingSelection = undefined; if (model) { this.selectedElement = this.chartLayer.getStateById(model.id); } else { @@ -285,6 +289,19 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent { + if (el.metadata) { + let cnt = 0; + Object.entries(el.metadata).forEach(([key, values]) => { + if (typeof (payload.load) !== 'string') { + const val = payload.load[key]; + if (val !== undefined) { + const num = Number(val); + // at least one value in array needs to match + const result = values.find((value: string | number) => (num !== undefined && num === value) || (val === value)); + if (result !== undefined) { + cnt++; + } + } + } + }); + if (cnt > max) { + max = cnt; + element = el; + } + } + }); + + } + return element; + } + private getMarkersLayerHeight() { const rowHeight = 20; const scrollbarHeight = 10; @@ -533,6 +592,14 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent node.id === entry?.id); + if (foundNode) { + let parentId: number | undefined = foundNode.parentId; + const ids: number[] = []; + while (parentId && parentId >= 0) { + ids.push(parentId); + foundNode = this.state.timegraphTree.find(node => node.id === parentId); + parentId = foundNode?.parentId; + } + + let newList = [...this.state.collapsedNodes]; + ids.forEach(parentIds => { + const exist = this.state.collapsedNodes.find(expandId => expandId === parentIds); + if (exist !== undefined) { + newList = newList.filter(collapsed => parentIds !== collapsed); + } + }); + const retVal = newList.length === this.state.collapsedNodes.length; + this.setState({ collapsedNodes: newList }, this.updateTotalHeight); + return retVal; + } + } + + private selectAndReveal(item: TimeGraphEntry) { + const rowIndex = getIndexOfNode(item.id, listToTree(this.state.timegraphTree, this.state.columns), this.state.collapsedNodes); + this.chartLayer.selectAndReveal(rowIndex); + } + } diff --git a/packages/react-components/src/components/utils/filter-tree/utils.tsx b/packages/react-components/src/components/utils/filter-tree/utils.tsx index 348c13fad..30afdcfa1 100644 --- a/packages/react-components/src/components/utils/filter-tree/utils.tsx +++ b/packages/react-components/src/components/utils/filter-tree/utils.tsx @@ -57,3 +57,8 @@ export const getAllExpandedNodeIds = (nodes: TreeNode[],collapsedNodes: number[] }); return visibleIds; }; + +export const getIndexOfNode = (id: number, nodes: TreeNode[], collapsedNodes: number[]): number => { + const ids = getAllExpandedNodeIds(nodes, collapsedNodes); + return ids.findIndex(eId => eId === id); +};