diff --git a/package.json b/package.json
index 3a9ab3bfa..f486ac4eb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "harperdb-studio",
- "version": "4.7.1",
+ "version": "4.8.1",
"description": "A UI for HarperDB",
"deploymentUrl": "studio.harperdb.io",
"private": true,
diff --git a/src/components/shared/DataTableHeader.js b/src/components/shared/DataTableHeader.js
index aa2f33740..16dc9104e 100644
--- a/src/components/shared/DataTableHeader.js
+++ b/src/components/shared/DataTableHeader.js
@@ -1,8 +1,19 @@
import React from 'react';
import { Row, Col } from 'reactstrap';
-const DataTableHeader = ({ headerGroups, onSortedChange, sorted, showFilter }) =>
- headerGroups.map((headerGroup) => {
+const DataTableHeader = ({ headerGroups, onSortedChange, sorted, showFilter, dynamicAttributesFromDataTable, tableDescriptionAttributes }) => {
+
+ const isIndexedAttribute = (columnId) => {
+ let isIndexed = false;
+ tableDescriptionAttributes.forEach((attr) => {
+ if (attr.attribute === columnId && (attr.is_primary_key || attr.indexed)) {
+ isIndexed = true;
+ }
+ });
+ return isIndexed;
+ }
+
+ return headerGroups.map((headerGroup) => {
const { key, ...rest } = headerGroup.getHeaderGroupProps();
return (
@@ -10,24 +21,30 @@ const DataTableHeader = ({ headerGroups, onSortedChange, sorted, showFilter }) =
{headerGroup.headers.map((column) => (
onSortedChange([{ id: column.id, desc: sorted[0]?.id === column.id ? !sorted[0]?.desc : false }])}
- className={`${sorted[0]?.id === column.id ? 'sorted' : ''} ${sorted[0]?.desc ? 'desc' : 'asc'} ${column.id.indexOf('hdb-narrow') !== -1 ? 'action' : ''} px-1`}
+ onClick={() => {
+ if (dynamicAttributesFromDataTable && !dynamicAttributesFromDataTable.includes(column.id) && isIndexedAttribute(column.id)) {
+ onSortedChange([{ id: column.id, desc: sorted[0]?.id === column.id ? !sorted[0]?.desc : false }])
+ }
+ }}
+ className={`${sorted[0]?.id === column.id ? 'sorted' : ''} ${sorted[0]?.desc ? 'desc' : 'asc'} ${column.id.indexOf('hdb-narrow') !== -1 ? 'action' : ''} px-1 ${dynamicAttributesFromDataTable && !dynamicAttributesFromDataTable.includes(column.id) && isIndexedAttribute(column.id) ? '' : 'disabled-column'}`}
>
{column.render('Header')}
))}
- {showFilter && (
-
- {headerGroup.headers.map((column) => (
-
- {column.render('Filter')}
-
- ))}
-
- )}
-
+ {
+ showFilter && (
+
+ {headerGroup.headers.map((column) => (
+
+ {column.render('Filter')}
+
+ ))}
+
+ )
+ }
+
);
});
-
+}
export default DataTableHeader;