Revert "Revert "feat(PIT): Point In Time Revamp""

This commit is contained in:
Maidul Islam
2025-05-28 20:56:49 -04:00
committed by GitHub
parent 66a5691ffd
commit 41d7987a6e
91 changed files with 10070 additions and 90 deletions
@@ -0,0 +1,70 @@
import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
import { ProjectPermissionCan } from "@app/components/permissions";
import { PageHeader } from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
import { useWorkspace } from "@app/context";
import {
ProjectPermissionCommitsActions,
ProjectPermissionSub
} from "@app/context/ProjectPermissionContext/types";
import { ProjectType } from "@app/hooks/api/workspace/types";
import { CommitHistoryTab } from "./components/CommitHistoryTab";
export const CommitsPage = () => {
const envSlug = useParams({
from: ROUTE_PATHS.SecretManager.CommitsPage.id,
select: (el) => el.environment
});
const { currentWorkspace } = useWorkspace();
const navigate = useNavigate();
const folderId = useParams({
from: ROUTE_PATHS.SecretManager.CommitsPage.id,
select: (el) => el.folderId
});
const routerQueryParams: { secretPath?: string } = useSearch({
from: ROUTE_PATHS.SecretManager.CommitsPage.id
});
const secretPath = routerQueryParams?.secretPath || "/";
const handleSelectCommit = (commitId: string) => {
navigate({
to: `/${ProjectType.SecretManager}/$projectId/commits/$environment/$folderId/$commitId` as const,
params: {
projectId: currentWorkspace.id,
folderId,
environment: envSlug,
commitId
},
search: (query) => ({
...query,
secretPath
})
});
};
return (
<div className="mx-auto flex h-full w-full max-w-7xl justify-center bg-bunker-800 py-4 text-white">
<div className="w-full max-w-[75vw]">
<PageHeader
title="Commits"
description="Track, inspect, and restore your secrets and folders with confidence. View the complete history of changes made to your environment, examine specific modifications at each commit point, and preview the exact impact before rolling back to previous states."
/>
<ProjectPermissionCan
renderGuardBanner
I={ProjectPermissionCommitsActions.Read}
a={ProjectPermissionSub.Commits}
>
<CommitHistoryTab
onSelectCommit={handleSelectCommit}
projectId={currentWorkspace.id}
environment={envSlug}
secretPath={secretPath}
/>
</ProjectPermissionCan>
</div>
</div>
);
};