Skip to content

Commit

Permalink
Updated sorting events tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
VladislavBryukhanov committed May 18, 2022
1 parent ef0847b commit c3df2e9
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type TProps = {

type TState = {
hoveredRowKey: number;
tableSorting?: Pick<SorterResult<ServiceOpsMetrics>, 'columnKey' | 'order'>;
tableSorting: Pick<SorterResult<ServiceOpsMetrics>, 'columnKey' | 'order'>;
};

const tableTitles = new Map([
Expand Down Expand Up @@ -65,6 +65,10 @@ function formatTimeValue(value: number) {
export class OperationTableDetails extends React.PureComponent<TProps, TState> {
state: TState = {
hoveredRowKey: -1,
tableSorting: {
order: 'descend',
columnKey: 'impact',
},
};

render() {
Expand Down Expand Up @@ -231,9 +235,9 @@ export class OperationTableDetails extends React.PureComponent<TProps, TState> {
}}
onChange={(pagination, filters, { columnKey, order }) => {
if (!isEqual({ columnKey, order }, this.state.tableSorting)) {
const trackingValue = columnKey ? tableTitles.get(columnKey)! : '_';
const clickedColumn = tableTitles.get(columnKey || this.state.tableSorting.columnKey);

trackSortOperations(trackingValue);
trackSortOperations(clickedColumn!);
this.setState({ tableSorting: { columnKey, order } });
}
}}
Expand Down

0 comments on commit c3df2e9

Please sign in to comment.