From 837c1b3b2b56c2307b0c8f1c12f29a8914d24cf8 Mon Sep 17 00:00:00 2001 From: x032205 Date: Sat, 4 Oct 2025 04:09:03 -0400 Subject: [PATCH 1/2] 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 From 7ad73f8b483d9bfbd94dada4910489132d156730 Mon Sep 17 00:00:00 2001 From: x032205 Date: Sat, 4 Oct 2025 21:49:48 -0400 Subject: [PATCH 2/2] Fix type check --- .../components/PamSessionLogsSection.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx index b0a2f9890..0e3854164 100644 --- a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx +++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx @@ -1,6 +1,6 @@ -import { faChevronRight, faChevronDown } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useState } from "react"; +import { faChevronDown, faChevronRight } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { TPamSession } from "@app/hooks/api/pam"; @@ -33,10 +33,11 @@ export const PamSessionLogsSection = ({ session }: Props) => { session.commandLogs.map((log) => { const isExpanded = expandedLogTimestamps.has(log.timestamp); return ( -
toggleExpand(log.timestamp)} > @@ -63,7 +64,7 @@ export const PamSessionLogsSection = ({ session }: Props) => { {log.output}
)} -
+ ); }) ) : (