+
-
diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx
index a25db4c3c..b0a2f9890 100644
--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx
+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx
@@ -1,5 +1,6 @@
-import { faTerminal } from "@fortawesome/free-solid-svg-icons";
+import { faChevronRight, faChevronDown } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useState } from "react";
import { TPamSession } from "@app/hooks/api/pam";
@@ -8,28 +9,63 @@ type Props = {
};
export const PamSessionLogsSection = ({ session }: Props) => {
+ const [expandedLogTimestamps, setExpandedLogTimestamps] = useState
>(new Set());
+
+ const toggleExpand = (timestamp: string) => {
+ setExpandedLogTimestamps((prev) => {
+ const newSet = new Set(prev);
+ if (newSet.has(timestamp)) {
+ newSet.delete(timestamp);
+ } else {
+ newSet.add(timestamp);
+ }
+ return newSet;
+ });
+ };
+
return (
-
+
Session Logs
-
+
{session.commandLogs.length > 0 ? (
- session.commandLogs.map((log) => (
-
-
-
- {new Date(log.timestamp).toLocaleString()}
-
+ session.commandLogs.map((log) => {
+ const isExpanded = expandedLogTimestamps.has(log.timestamp);
+ return (
+
toggleExpand(log.timestamp)}
+ >
+
+
+
+ {new Date(log.timestamp).toLocaleString()}
+
+
-
- {log.input}
+
+ {log.input}
+
+
+ {isExpanded && log.output && (
+
+ {log.output}
+
+ )}
-
- {log.output}
-
-
- ))
+ );
+ })
) : (
No session logs