diff --git a/Client/src/Components/StatusTable/index.jsx b/Client/src/Components/StatusTable/index.jsx
index 71d2b7641..ffe0b6e8a 100644
--- a/Client/src/Components/StatusTable/index.jsx
+++ b/Client/src/Components/StatusTable/index.jsx
@@ -44,10 +44,11 @@ const StyledTableRow = styled(TableRow)(({ theme }) => ({
/**
* Customized table component displaying incident history.
* @param {object} props - The props object.
- * @param {array} props.data - The array of data objects containing name, date, and message.
+ * @param {array} props.data - The array of data objects containing JSX elements for name, and strings for date and message.
+ * @param {array} props.columns - The array of column headers and alignments.
* @returns {JSX.Element} The JSX element representing the customized table.
*/
-export default function StatusTable({ data }) {
+export default function StatusTable({ data, columns }) {
const theme = useTheme();
return (
@@ -66,19 +67,27 @@ export default function StatusTable({ data }) {
- Status
- Date & Time
- Message
+ {columns.map((column, index) => (
+
+ {column.header}
+
+ ))}
- {data.map((row, index) => (
-
-
- {row.name}
-
- {row.date}
- {row.message}
+ {data.map((row, rowIndex) => (
+
+ {columns.map((column, colIndex) => (
+
+ {column.id === 'name' ? (
+
+ {row.name}
+
+ ) : (
+ row[column.id]
+ )}
+
+ ))}
))}
@@ -89,9 +98,12 @@ export default function StatusTable({ data }) {
}
StatusTable.propTypes = {
- data: PropTypes.arrayOf(PropTypes.shape({
- name: PropTypes.node.isRequired,
- date: PropTypes.string.isRequired,
- message: PropTypes.string.isRequired,
- })).isRequired,
+ data: PropTypes.arrayOf(PropTypes.object).isRequired,
+ columns: PropTypes.arrayOf(
+ PropTypes.shape({
+ id: PropTypes.string.isRequired,
+ header: PropTypes.node.isRequired,
+ align: PropTypes.oneOf(['left', 'right', 'center']),
+ })
+ ).isRequired,
};
diff --git a/Client/src/Pages/Incidents/index.jsx b/Client/src/Pages/Incidents/index.jsx
index 599950eea..4bb75a53d 100644
--- a/Client/src/Pages/Incidents/index.jsx
+++ b/Client/src/Pages/Incidents/index.jsx
@@ -65,6 +65,12 @@ const sampleData = [
{ name: , date: '2024-03-14 21:41:09', message: 'HTTP 350 - NOK' },
];
+const columns = [
+ { id: 'name', header: 'Status' },
+ { id: 'date', header: 'Date & Time' },
+ { id: 'message', header: 'Message' },
+];
+
/**
* Customized table component displaying incident history with a filter.
* @returns {JSX.Element} The JSX element representing the customized table with a filter.
@@ -90,7 +96,7 @@ export default function CustomizedTables() {
-
+
);
}