diff --git a/src/components/tables/CellGenericFormat.jsx b/src/components/tables/CellGenericFormat.jsx
index d4c7a7cfbf41..465a7dd25f37 100644
--- a/src/components/tables/CellGenericFormat.jsx
+++ b/src/components/tables/CellGenericFormat.jsx
@@ -7,6 +7,7 @@ import {
} from '@fortawesome/free-solid-svg-icons'
import { CBadge, CTooltip } from '@coreui/react'
import CellBoolean from 'src/components/tables/CellBoolean.jsx'
+import cellTable from './CellTable'
const IconWarning = () =>
const IconError = () =>
@@ -56,6 +57,7 @@ export const cellGenericFormatter =
return {CellTip(cell)}
}
if (Array.isArray(cell) || typeof cell === 'object') {
- return CellTip(JSON.stringify(cell))
+ //return CellTip(JSON.stringify(cell))
+ return cellTable(row, cell)
}
}
diff --git a/src/components/tables/CellTable.jsx b/src/components/tables/CellTable.jsx
index e8d31ced8256..c8720b9e0f00 100644
--- a/src/components/tables/CellTable.jsx
+++ b/src/components/tables/CellTable.jsx
@@ -13,9 +13,23 @@ export default function cellTable(
crossWhenZero = false,
dangerButton = false, // Added 4th parameter for btn-danger class
) {
- const handleTable = ({ row }) => {
+ var columnProp = ''
+ if (propertyName) {
+ columnProp = row[propertyName]
+ } else {
+ columnProp = column
+ }
+ if (!Array.isArray(columnProp) && typeof columnProp === 'object') {
+ columnProp = Object.entries(columnProp).map((row) => {
+ return { Name: row[0], Value: row[1] }
+ })
+ }
+ console.log(Array.isArray(columnProp))
+
+ const handleTable = ({ columnProp }) => {
const QueryColumns = []
- const columns = Object.keys(row[propertyName][0]).map((key) => {
+
+ const columns = Object.keys(columnProp[0]).map((key) => {
QueryColumns.push({
name: key,
selector: (row) => row[key],
@@ -24,8 +38,9 @@ export default function cellTable(
cell: cellGenericFormatter(),
})
})
+
ModalService.open({
- data: row[propertyName],
+ data: columnProp,
componentType: 'table',
componentProps: {
columns: QueryColumns,
@@ -36,15 +51,15 @@ export default function cellTable(
})
}
- if (typeof row[propertyName] === 'boolean') {
- if (row[propertyName]) {
+ if (typeof columnProp === 'boolean') {
+ if (columnProp) {
return
}
return
}
- if (!row[propertyName] || !Array.isArray(row[propertyName]) || row[propertyName].length === 0) {
- if (row[propertyName] === undefined) {
+ if (!columnProp || !Array.isArray(columnProp) || columnProp.length === 0) {
+ if (columnProp === undefined) {
return
}
if (checkWhenZero) {
@@ -60,8 +75,13 @@ export default function cellTable(
const buttonClassName = dangerButton ? 'btn-danger' : ''
return (
- handleTable({ row })}>
- {row[propertyName].length} Items
+ handleTable({ columnProp })}
+ >
+ {columnProp.length} Items
)
}