mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-10 07:58:15 -05:00
misc: fixed log clipping and added idempotency to session end
This commit is contained in:
@@ -152,6 +152,13 @@ export const pamSessionServiceFactory = ({
|
||||
OrgPermissionSubjects.Gateway
|
||||
);
|
||||
|
||||
if (session.status === PamSessionStatus.Ended) {
|
||||
return {
|
||||
session,
|
||||
projectId: project.id
|
||||
};
|
||||
}
|
||||
|
||||
if (session.status !== PamSessionStatus.Active) {
|
||||
throw new BadRequestError({ message: "Cannot end sessions that are not active" });
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import ms from "ms";
|
||||
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
import { Button, FormLabel, Input, Modal, ModalClose, ModalContent } from "@app/components/v2";
|
||||
import { TPamAccount } from "@app/hooks/api/pam";
|
||||
import { PamResourceType, TPamAccount } from "@app/hooks/api/pam";
|
||||
|
||||
type Props = {
|
||||
account?: TPamAccount;
|
||||
@@ -19,7 +19,10 @@ export const PamAccessAccountModal = ({ isOpen, onOpenChange, account }: Props)
|
||||
const isDurationValid = useMemo(() => duration && ms(duration || "1s") > 0, [duration]);
|
||||
|
||||
const command = useMemo(
|
||||
() => (account ? `infisical pam access ${account.id} --duration ${duration}` : ""),
|
||||
() =>
|
||||
account && account.resource.resourceType === PamResourceType.Postgres
|
||||
? `infisical pam db access-account ${account.id} --duration ${duration}`
|
||||
: "",
|
||||
[account, duration]
|
||||
);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export const PamSessionLogsSection = ({ session }: Props) => {
|
||||
<div className="flex items-center border-b border-mineshaft-400 pb-4">
|
||||
<h3 className="text-lg font-semibold text-mineshaft-100">Session Logs</h3>
|
||||
</div>
|
||||
<div className="flex grow flex-col gap-4 text-xs">
|
||||
<div className="flex grow flex-col gap-4 overflow-y-auto text-xs">
|
||||
{session.commandLogs.length > 0 ? (
|
||||
session.commandLogs.map((log) => (
|
||||
<div key={log.timestamp} className="flex flex-col">
|
||||
@@ -22,8 +22,12 @@ export const PamSessionLogsSection = ({ session }: Props) => {
|
||||
<span>{new Date(log.timestamp).toLocaleString()}</span>
|
||||
</div>
|
||||
|
||||
<div className="whitespace-pre-wrap font-mono">{log.input}</div>
|
||||
<div className="whitespace-pre-wrap font-mono text-bunker-300">{log.output}</div>
|
||||
<div className="overflow-hidden whitespace-pre-wrap break-all font-mono">
|
||||
{log.input}
|
||||
</div>
|
||||
<div className="overflow-hidden whitespace-pre-wrap break-all font-mono text-bunker-300">
|
||||
{log.output}
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user