Skip to content

Commit

Permalink
Merge pull request #4124 from relative-ci/sort-by-actual-not-absolute…
Browse files Browse the repository at this point in the history
…-value-rltv-894

fix(ui): MetricsTable - sort by actual value
  • Loading branch information
vio committed Dec 30, 2023
2 parents 688f358 + 92cd233 commit e51326b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const BASELINE_TITLE = 'Baseline';
export const CURRENT_TITLE = 'Current';

export const SORT_ABSOLUTE_VALUE = 'absolute value';
export const SORT_ABSOLUTE_CHANGE = 'absolute change';
export const SORT_PERCENTUAL_CHANGE = 'absolute percentual change';
export const SORT_VALUE = 'value';
export const SORT_CHANGE = 'change';
export const SORT_PERCENTUAL_CHANGE = 'percentual change';

export const EMPTY_MESSAGE = 'No items found.';
export const SHOW_ALL = 'Show all';
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/components/metrics-table/metrics-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const SumColumn = ({ rows, isBaseline, runIndex, updateSort, sort }: ColumnSumPr
<SortButton
fieldPath={fieldPath}
fieldName="value"
label="absolute value"
label={I18N.SORT_VALUE}
updateSort={updateSort}
sort={sort}
>
Expand All @@ -105,7 +105,7 @@ const SumColumn = ({ rows, isBaseline, runIndex, updateSort, sort }: ColumnSumPr
<SortButton
fieldPath={fieldPath}
fieldName="delta"
label="absolute change"
label={I18N.SORT_CHANGE}
updateSort={updateSort}
sort={sort}
>
Expand All @@ -118,7 +118,7 @@ const SumColumn = ({ rows, isBaseline, runIndex, updateSort, sort }: ColumnSumPr
<SortButton
fieldPath={fieldPath}
fieldName="deltaPercentage"
label="absolute percentual change"
label={I18N.SORT_PERCENTUAL_CHANGE}
updateSort={updateSort}
sort={sort}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/hooks/rows-sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const getSortFn =
return getCustomSort(item);
}

return Math.abs(get(item, fieldPath) || 0);
return get(item, fieldPath) || 0;
};

export const useRowsSort = ({
Expand Down

0 comments on commit e51326b

Please sign in to comment.