feat: removed last bit of workspace in frontend. Fatality!

This commit is contained in:
=
2025-09-16 00:08:41 +05:30
parent 37a80fa1ac
commit ac80242749
356 changed files with 1788 additions and 1890 deletions
@@ -57,7 +57,7 @@ import {
ProjectPermissionSub,
useProjectPermission,
useSubscription,
useWorkspace
useProject
} from "@app/context";
import {
ProjectPermissionCommitsActions,
@@ -109,9 +109,6 @@ type TSecOverwriteOpt = { update: TParsedEnv; create: TParsedEnv };
type Props = {
// switch the secrets type as it gets decrypted after api call
environment: string;
// @depreciated will be moving all these details to zustand
workspaceId: string;
projectSlug: string;
secretPath?: string;
filter: Filter;
tags?: WsTag[];
@@ -142,8 +139,6 @@ type Props = {
export const ActionBar = ({
environment,
workspaceId,
projectSlug,
secretPath = "/",
filter,
tags = [],
@@ -164,6 +159,7 @@ export const ActionBar = ({
hasPathPolicies,
onClearFilters
}: Props) => {
const { projectId, currentProject } = useProject();
const { handlePopUpOpen, handlePopUpToggle, handlePopUpClose, popUp } = usePopUp([
"addFolder",
"addDynamicSecret",
@@ -196,7 +192,6 @@ export const ActionBar = ({
const { reset: resetSelectedSecret } = useSelectedSecretActions();
const isMultiSelectActive = Boolean(Object.keys(selectedSecrets).length);
const { currentWorkspace } = useWorkspace();
const { permission } = useProjectPermission();
const handleFolderCreate = async (folderName: string, description: string | null) => {
@@ -214,7 +209,7 @@ export const ActionBar = ({
};
addPendingChange(pendingFolderCreate, {
workspaceId,
projectId,
environment,
secretPath
});
@@ -227,7 +222,7 @@ export const ActionBar = ({
name: folderName,
path: secretPath,
environment,
projectId: workspaceId,
projectId,
description
});
handlePopUpClose("addFolder");
@@ -247,7 +242,7 @@ export const ActionBar = ({
const handleSecretDownload = async () => {
try {
const { secrets: localSecrets, imports: localImportedSecrets } = await fetchProjectSecrets({
workspaceId,
projectId,
expandSecretReferences: true,
includeImports: true,
environment,
@@ -317,7 +312,7 @@ export const ActionBar = ({
try {
await deleteBatchSecretV3({
secretPath,
workspaceId,
projectId,
environment,
secrets: bulkDeletedSecrets.map(({ key }) => ({ secretKey: key, type: SecretType.Shared }))
});
@@ -348,13 +343,12 @@ export const ActionBar = ({
try {
const secretsToMove = Object.values(selectedSecrets);
const { isDestinationUpdated, isSourceUpdated } = await moveSecrets({
projectSlug,
shouldOverwrite,
sourceEnvironment: environment,
sourceSecretPath: secretPath,
destinationEnvironment,
destinationSecretPath,
projectId: workspaceId,
projectId,
secretIds: secretsToMove.map((sec) => sec.id)
});
@@ -448,7 +442,7 @@ export const ActionBar = ({
const { secrets: batchSecrets } = await fetchDashboardProjectSecretsByKeys({
secretPath: normalizedPath,
environment,
projectId: workspaceId,
projectId,
keys: batch
});
@@ -566,7 +560,7 @@ export const ActionBar = ({
name: folderName,
path: parentPath,
environment,
projectId: workspaceId
projectId
});
createdFolders.add(fullPath);
@@ -598,7 +592,7 @@ export const ActionBar = ({
Object.entries(groupedCreateSecrets).map(([path, secrets]) =>
createSecretBatch({
secretPath: path,
workspaceId,
projectId,
environment,
secrets
})
@@ -628,7 +622,7 @@ export const ActionBar = ({
Object.entries(groupedUpdateSecrets).map(([path, secrets]) =>
updateSecretBatch({
secretPath: path,
workspaceId,
projectId,
environment,
secrets
})
@@ -638,13 +632,12 @@ export const ActionBar = ({
// Invalidate appropriate queries to refresh UI
queryClient.invalidateQueries({
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
queryKey: secretKeys.getProjectSecret({ projectId, environment, secretPath })
});
queryClient.invalidateQueries({});
queryKey: dashboardKeys.getDashboardSecrets({ projectId, secretPath });
queryClient.invalidateQueries({
queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
});
queryClient.invalidateQueries({
queryKey: secretApprovalRequestKeys.count({ workspaceId })
queryKey: secretApprovalRequestKeys.count({ projectId })
});
// Close the modal and show notification
@@ -677,8 +670,8 @@ export const ActionBar = ({
className="w-2/5"
value={filter.searchFilter}
onChange={onSearchChange}
environments={[currentWorkspace.environments.find((env) => env.slug === environment)!]}
projectId={workspaceId}
environments={[currentProject.environments.find((env) => env.slug === environment)!]}
projectId={projectId}
tags={tags}
/>
<div>
@@ -1134,8 +1127,8 @@ export const ActionBar = ({
{/* all the side triggers from actions like modals etc */}
<CreateSecretImportForm
environment={environment}
workspaceId={workspaceId}
secretPath={secretPath}
projectId={projectId}
onUpgradePlan={() => handlePopUpOpen("upgradePlan")}
isOpen={popUp.addSecretImport.isOpen}
onClose={() => handlePopUpClose("addSecretImport")}
@@ -1144,7 +1137,7 @@ export const ActionBar = ({
<CreateDynamicSecretForm
isOpen={popUp.addDynamicSecret.isOpen}
onToggle={(isOpen) => handlePopUpToggle("addDynamicSecret", isOpen)}
projectSlug={projectSlug}
projectSlug={currentProject.slug}
environments={[{ slug: environment, name: environment, id: "not-used" }]}
secretPath={secretPath}
isSingleEnvironmentMode
@@ -1190,8 +1183,8 @@ export const ActionBar = ({
onToggle={(isOpen) => handlePopUpToggle("replicateFolder", isOpen)}
onParsedEnv={handleParsedEnvMultiFolder}
environment={environment}
environments={currentWorkspace.environments}
workspaceId={workspaceId}
environments={currentProject.environments}
projectId={projectId}
secretPath={secretPath}
/>
{subscription && (