From 837c1b3b2b56c2307b0c8f1c12f29a8914d24cf8 Mon Sep 17 00:00:00 2001 From: x032205 Date: Sat, 4 Oct 2025 04:09:03 -0400 Subject: [PATCH] improve PAM session log rows --- .../PamSessionByIDPage.tsx | 6 +- .../components/PamSessionLogsSection.tsx | 68 ++++++++++++++----- 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsx index 12574a054..b82c6b6e7 100644 --- a/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsx +++ b/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsx @@ -21,16 +21,16 @@ const Page = () => { return (
{session && ( -
+
-
+
-
+
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