Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions backend/src/ee/services/pit/pit-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,27 @@ export const pitServiceFactory = ({
}

if (policy) {
// When a policy exists, secret changes go through approval workflow
// but folder changes should still be committed immediately since they're not affected by approval policies
let commitId: string | undefined;
if (commitChanges.length > 0) {
const commit = await folderCommitService.createCommit(
{
actor: {
type: actor || ActorType.PLATFORM,
metadata: {
id: actorId
}
},
message,
folderId: targetFolder.id,
changes: commitChanges
},
trx
);
commitId = commit?.id;
}

if (
(changes.secrets?.create?.length ?? 0) > 0 ||
(changes.secrets?.update?.length ?? 0) > 0 ||
Expand Down Expand Up @@ -724,11 +745,13 @@ export const pitServiceFactory = ({
});
return {
approvalId: approval.id,
commitId,
folderChanges,
secretMutationEvents
};
}
return {
commitId,
folderChanges,
secretMutationEvents
};
Expand Down
56 changes: 56 additions & 0 deletions frontend/src/components/secrets/diff/DiffContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { twMerge } from "tailwind-merge";

export interface DiffContainerProps {
variant?: "added" | "removed";
children: React.ReactNode;
containerRef?: React.RefObject<HTMLDivElement>;
className?: string;
isSingleLine?: boolean;
}

/**
* Styled container with consistent backgrounds for diff views
*/
export const DiffContainer = ({
variant,
children,
containerRef,
className,
isSingleLine = false
}: DiffContainerProps) => {
const getBackgroundColor = () => {
if (!variant) return undefined;
return variant === "removed" ? "#120808" : "#081208";
};

const backgroundColor = getBackgroundColor();

if (isSingleLine) {
return (
<div
className={twMerge(
"relative rounded-lg border border-mineshaft-600 p-2",
!variant && "bg-bunker-800",
className
)}
style={backgroundColor ? { backgroundColor } : undefined}
>
{children}
</div>
);
}

return (
<div
ref={containerRef}
className={twMerge(
"relative max-h-96 thin-scrollbar overflow-x-auto overflow-y-auto rounded-lg border border-mineshaft-600 p-2",
!variant && "bg-bunker-800",
className
)}
style={backgroundColor ? { backgroundColor } : undefined}
>
<div className="w-max min-w-full">{children}</div>
</div>
);
};
Loading
Loading