Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(pam-rdp): satisfy strict eslint rules

bernie-g7c80cec4c9db
diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx
index c044a3a38d..5059c61154 100644
--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx
+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx
@@ -57,7 +57,7 @@ export const PamSessionLogsSection = ({ session, scrollToLogIndex }: Props) => {
// Warm the lazy chunk so Suspense doesn't fall back on first mount.
useEffect(() => {
if (isRdpSession) {
- void importRdpReplayView();
+ importRdpReplayView().catch(() => undefined);
}
}, [isRdpSession]);
@@ -93,32 +93,28 @@ export const PamSessionLogsSection = ({ session, scrollToLogIndex }: Props) => {
)}
{isSSHSession && hasLogs && <TerminalEventView events={logs as TTerminalEvent[]} />}
{isHttpSession && hasLogs && <HttpEventView events={logs as THttpEvent[]} />}
- {isRdpSession &&
- (hasLogs ? (
- <Suspense
- fallback={
- <div className="flex grow flex-col items-center justify-center gap-2">
- <Lottie
- isAutoPlay
- icon="infisical_loading"
- className="pointer-events-none size-12"
- />
- <span className="text-sm text-muted">Loading session recording</span>
- </div>
- }
- >
- <RdpReplayView
- events={logs as TTerminalEvent[]}
- isStreaming={isLoading}
- totalDurationMs={isLegacyOrNoChunks ? undefined : playback.totalDurationMs}
- />
- </Suspense>
- ) : isLoading ? (
- <div className="flex grow flex-col items-center justify-center gap-2">
- <Lottie isAutoPlay icon="infisical_loading" className="pointer-events-none size-12" />
- <span className="text-sm text-muted">Loading session recording</span>
- </div>
- ) : null)}
+ {isRdpSession && hasLogs && (
+ <Suspense
+ fallback={
+ <div className="flex grow flex-col items-center justify-center gap-2">
+ <Lottie isAutoPlay icon="infisical_loading" className="pointer-events-none size-12" />
+ <span className="text-sm text-muted">Loading session recording</span>
+ </div>
+ }
+ >
+ <RdpReplayView
+ events={logs as TTerminalEvent[]}
+ isStreaming={isLoading}
+ totalDurationMs={isLegacyOrNoChunks ? undefined : playback.totalDurationMs}
+ />
+ </Suspense>
+ )}
+ {isRdpSession && !hasLogs && isLoading && (
+ <div className="flex grow flex-col items-center justify-center gap-2">
+ <Lottie isAutoPlay icon="infisical_loading" className="pointer-events-none size-12" />
+ <span className="text-sm text-muted">Loading session recording</span>
+ </div>
+ )}
{isAwsIamSession && (
<div className="flex grow items-center justify-center text-muted">
<div className="text-center">
diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/RdpReplayView/rdpReplayPlayer.ts b/frontend/src/pages/pam/PamSessionsByIDPage/components/RdpReplayView/rdpReplayPlayer.ts
index f9569103ff..9f383e0ff0 100644
--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/RdpReplayView/rdpReplayPlayer.ts
+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/RdpReplayView/rdpReplayPlayer.ts
@@ -255,19 +255,20 @@ export class RdpReplayPlayer {
let boundsExpanded = false;
for (let i = 0; i < count; i += 1) {
const r = this.decoder.dirty_rect(i);
- if (!r) continue;
- this.ctx.putImageData(fullImage, 0, 0, r.x, r.y, r.w, r.h);
- const right = r.x + r.w;
- const bottom = r.y + r.h;
- if (right > this.contentMaxX) {
- this.contentMaxX = right;
- boundsExpanded = true;
- }
- if (bottom > this.contentMaxY) {
- this.contentMaxY = bottom;
- boundsExpanded = true;
+ if (r) {
+ this.ctx.putImageData(fullImage, 0, 0, r.x, r.y, r.w, r.h);
+ const right = r.x + r.w;
+ const bottom = r.y + r.h;
+ if (right > this.contentMaxX) {
+ this.contentMaxX = right;
+ boundsExpanded = true;
+ }
+ if (bottom > this.contentMaxY) {
+ this.contentMaxY = bottom;
+ boundsExpanded = true;
+ }
+ r.free();
}
- r.free();
}
if (boundsExpanded) {
this.callbacks.onContentBoundsChange(this.contentMaxX, this.contentMaxY);