This is an automated email from the ASF dual-hosted git repository.
andytaylor pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis-console.git
The following commit(s) were added to refs/heads/main by this push:
new ae23c42 ARTEMIS-5410 - Enable sorting by clicking on the column name
ae23c42 is described below
commit ae23c424fa63d1f6d81e286735da5b87cb26e034
Author: GChuf <[email protected]>
AuthorDate: Wed Apr 16 20:43:05 2025 +0200
ARTEMIS-5410 - Enable sorting by clicking on the column name
---
.../src/table/ArtemisTable.tsx | 37 ++++++++++++++++------
1 file changed, 27 insertions(+), 10 deletions(-)
diff --git
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/table/ArtemisTable.tsx
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/table/ArtemisTable.tsx
index c775540..655b68d 100644
---
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/table/ArtemisTable.tsx
+++
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/table/ArtemisTable.tsx
@@ -445,16 +445,33 @@ const operationOptions = [
{toolbarItems}
<InnerScrollContainer>
<Table variant="compact" aria-label="Data Table" id='data-table'>
- <Thead>
- <Tr >
- {columns.map((column, id) => {
- if (column.visible) {
- return <Th key={id}>{column.name}</Th>
- } else return ''
- }
- )}
- </Tr>
- </Thead>
+ <Thead>
+ <Tr>
+ {columns.map((column, id) => {
+ if (!column.visible) return null;
+
+ const isSorted = column.id === activeSort.id;
+ const direction = isSorted ? activeSort.order : undefined;
+ const nextDirection =
+ isSorted && activeSort.order === SortDirection.ASCENDING
+ ? SortDirection.DESCENDING
+ : SortDirection.ASCENDING;
+ return (
+ <Th
+ key={id}
+ sort={{
+ sortBy: {
+ index: id,
+ direction: direction === SortDirection.ASCENDING ? 'asc' :
'desc'
+ },
+ onSort: () => updateActiveSort(column.id, nextDirection),
+ columnIndex: id
+ }}
+ >{column.name}</Th>
+ );
+ })}
+ </Tr>
+ </Thead>
<Tbody>
{rows.map((row, rowIndex) => (
<Tr key={rowIndex}>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact