diff --git a/src/plugins/adminAuditLog/components/AuditLog.js b/src/plugins/adminAuditLog/components/AuditLog.js index ad34157..6c54757 100644 --- a/src/plugins/adminAuditLog/components/AuditLog.js +++ b/src/plugins/adminAuditLog/components/AuditLog.js @@ -20,7 +20,7 @@ import { useTranslation } from "react-i18next"; import { auditLog } from "@ractf/api"; import { - PageHead, Card, ModalSpinner + PageHead, Card, ModalSpinner, TreeWrap, TreeValue, Tree } from "@ractf/ui-kit"; @@ -39,6 +39,19 @@ export default () => { loadItems(); }, []); + const RecursiveObjectTree = ({obj}) => + Object.entries(obj).map(([k, v]) => + typeof(v) === "object" ? + + + : + + ); + + const ObjectTree = ({obj}) => + + ; + return <> @@ -61,26 +74,25 @@ export default () => { } else if (item.action === "update_model") { return - {details._username} updated the following fields on {details.model_name} with ID {details.model_id}:
- {Object.entries(details.updated_fields).map(([field_name, values]) => - <>{field_name}: from {String(values.old)} to {String(values.new)}.
) - } + {details._username} updated the following fields on a + {details.model_name} with ID {details.model_id}:
+ +
; } else if (item.action === "create_model") { return {details._username} created a {details.model_name}:
- {Object.entries(details.model_fields).map(([field_name, value]) => - <>{field_name}: {String(value)}.
) - } + +
; } else if (item.action === "destroy_model") { return - {details._username} deleted {details.model_name} with ID {details.model_id} which had the following fields:
- {Object.entries(details.model_fields).map(([field_name, value]) => - <>{field_name}: {String(value)}.
) - } + {details._username} deleted a {details.model_name} + with ID {details.model_id} which had the following fields:
+ +
; // ...Otherwise, fall back on translations.