Skip to content

Commit

Permalink
v5.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
novykh committed Jul 12, 2024
1 parent 2350d09 commit cea06b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netdata/charts",
"version": "5.3.7",
"version": "5.3.8",
"description": "Netdata frontend SDK and chart utilities",
"main": "dist/index.js",
"module": "dist/es6/index.js",
Expand Down
17 changes: 15 additions & 2 deletions src/components/table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const Dimensions = () => {

const chart = useChart()
const groups = chart.getDimensionGroups()
const tableColumns = chart.getAttribute("tableColumns")
const { tableColumns, tableSortBy } = chart.getAttributes()

const [rowGroups, contextGroups, labels] = useMemo(() => {
let forRows = []
Expand Down Expand Up @@ -147,6 +147,19 @@ const Dimensions = () => {
contextGroups,
})

const sortBy = useMemo(() => {
if (!tableSortBy || tableSortBy.length > 1 || !contextGroups) return tableSortBy

const [first] = tableSortBy
if (!first || !contextGroups[first.id] || !Object.keys(contextGroups[first.id]))
return tableSortBy

return Object.keys(contextGroups[first.id]).map(id => ({
id: `value${first.id}${id}`,
desc: first.desc,
}))
}, [tableSortBy, contextGroups])

const hoverRef = useHover(
{
onHover: chart.focus,
Expand Down Expand Up @@ -188,7 +201,7 @@ const Dimensions = () => {
// onRowSelected={onItemClick}
// onSearch={noop}
// meta={meta}
// sortBy={sortBy}
sortBy={sortBy}
// rowSelection={rowSelection}
// onSortingChange={onSortByChange}
// expanded={expanded}
Expand Down

0 comments on commit cea06b2

Please sign in to comment.