Skip to content

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

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

=ac80242749ba
diff --git a/frontend/src/components/navigation/NavHeader.tsx b/frontend/src/components/navigation/NavHeader.tsx
index 1283c02d14..b16015680d 100644
--- a/frontend/src/components/navigation/NavHeader.tsx
+++ b/frontend/src/components/navigation/NavHeader.tsx
@@ -4,7 +4,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Link, useParams } from "@tanstack/react-router";
import { twMerge } from "tailwind-merge";
-import { useOrganization, useWorkspace } from "@app/context";
+import { useOrganization, useProject } from "@app/context";
import { useToggle } from "@app/hooks";
import { createNotification } from "../notifications";
@@ -51,7 +51,7 @@ export default function NavHeader({
isProtectedBranch = false,
protectionPolicyName
}: Props): JSX.Element {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { currentOrg } = useOrganization();
const [isCopied, { timedToggle: toggleIsCopied }] = useToggle(false);
@@ -79,7 +79,7 @@ export default function NavHeader({
<>
<FontAwesomeIcon icon={faAngleRight} className="ml-3 mr-3 text-xs text-gray-400" />
<div className="truncate text-sm font-semibold text-bunker-300">
- {currentWorkspace?.name}
+ {currentProject?.name}
</div>
</>
)}
@@ -93,7 +93,7 @@ export default function NavHeader({
{pageName === "Secrets" ? (
<Link
to="/projects/secret-management/$projectId/overview"
- params={{ projectId: currentWorkspace.id }}
+ params={{ projectId: currentProject.id }}
className="text-sm font-semibold text-primary/80 hover:text-primary"
>
{pageName}
@@ -129,7 +129,7 @@ export default function NavHeader({
<FontAwesomeIcon icon={faAngleRight} className="ml-3 mr-1.5 text-xs text-gray-400" />
<Link
to="/projects/secret-management/$projectId/secrets/$envSlug"
- params={{ projectId: currentWorkspace.id, envSlug: routerEnvSlug }}
+ params={{ projectId: currentProject.id, envSlug: routerEnvSlug }}
className="text-sm font-semibold text-primary/80 hover:text-primary"
>
{userAvailableEnvs?.find(({ slug }) => slug === currentEnv)?.name}
@@ -192,7 +192,7 @@ export default function NavHeader({
<Link
to="/projects/secret-management/$projectId/secrets/$envSlug"
params={{
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
envSlug: routerEnvSlug || ""
}}
search={(query) => ({ ...query, secretPath: newSecretPath })}
diff --git a/frontend/src/components/permissions/AccessTree/hooks/index.ts b/frontend/src/components/permissions/AccessTree/hooks/index.ts
index 717bdaf3a7..b02e6a9d66 100644
--- a/frontend/src/components/permissions/AccessTree/hooks/index.ts
+++ b/frontend/src/components/permissions/AccessTree/hooks/index.ts
@@ -3,7 +3,7 @@ import { useFormContext, useWatch } from "react-hook-form";
import { MongoAbility, MongoQuery } from "@casl/ability";
import { Edge, Node, useEdgesState, useNodesState } from "@xyflow/react";
-import { ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionSub, useProject } from "@app/context";
import { ProjectPermissionSet } from "@app/context/ProjectPermissionContext";
import { useListProjectEnvironmentsFolders } from "@app/hooks/api/secretFolders/queries";
import { TSecretFolderWithPath } from "@app/hooks/api/secretFolders/types";
@@ -36,15 +36,15 @@ export const useAccessTree = (
searchPath: string,
subject: ProjectPermissionSub
) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { secretName, setSecretName, setViewMode, viewMode } = useAccessTreeContext();
const { control } = useFormContext<AccessTreeForm>();
const metadata = useWatch({ control, name: "metadata" });
const [nodes, setNodes] = useNodesState<Node>([]);
const [edges, setEdges] = useEdgesState<Edge>([]);
- const [environment, setEnvironment] = useState(currentWorkspace.environments[0]?.slug ?? "");
+ const [environment, setEnvironment] = useState(currentProject.environments[0]?.slug ?? "");
const { data: environmentsFolders, isPending } = useListProjectEnvironmentsFolders(
- currentWorkspace.id
+ currentProject.id
);
const [levelFolderMap, setLevelFolderMap] = useState<LevelFolderMap>({});
@@ -279,7 +279,7 @@ export const useAccessTree = (
environment,
setEnvironment,
isLoading: isPending,
- environments: currentWorkspace.environments,
+ environments: currentProject.environments,
secretName,
setSecretName,
viewMode,
diff --git a/frontend/src/components/project/ProjectOverviewChangeSection.tsx b/frontend/src/components/project/ProjectOverviewChangeSection.tsx
index 0f88ec2e91..852253bb36 100644
--- a/frontend/src/components/project/ProjectOverviewChangeSection.tsx
+++ b/frontend/src/components/project/ProjectOverviewChangeSection.tsx
@@ -6,7 +6,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, FormControl, Input, TextArea } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useUpdateProject } from "@app/hooks/api";
const baseFormSchema = z.object({
@@ -37,35 +37,35 @@ type Props = {
};
export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync, isPending } = useUpdateProject();
const { handleSubmit, control, reset, watch } = useForm<BaseFormData | FormDataWithSlug>({
resolver: zodResolver(showSlugField ? formSchemaWithSlug : baseFormSchema)
});
- const currentSlug = showSlugField ? watch("slug") : currentWorkspace?.slug;
+ const currentSlug = showSlugField ? watch("slug") : currentProject?.slug;
useEffect(() => {
- if (currentWorkspace) {
+ if (currentProject) {
reset({
- name: currentWorkspace.name,
- description: currentWorkspace.description ?? "",
- ...(showSlugField && { slug: currentWorkspace.slug })
+ name: currentProject.name,
+ description: currentProject.description ?? "",
+ ...(showSlugField && { slug: currentProject.slug })
});
}
- }, [currentWorkspace, showSlugField]);
+ }, [currentProject, showSlugField]);
const onFormSubmit = async (data: BaseFormData | FormDataWithSlug) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
await mutateAsync({
- projectID: currentWorkspace.id,
+ projectId: currentProject.id,
newProjectName: data.name,
newProjectDescription: data.description,
...(showSlugField &&
"slug" in data && {
- newSlug: data.slug !== currentWorkspace.slug ? data.slug : undefined
+ newSlug: data.slug !== currentProject.slug ? data.slug : undefined
})
});
@@ -105,7 +105,7 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) =
variant="outline_bg"
size="sm"
onClick={() => {
- navigator.clipboard.writeText(currentWorkspace?.id || "");
+ navigator.clipboard.writeText(currentProject?.id || "");
createNotification({
text: "Copied project ID to clipboard",
type: "success"
diff --git a/frontend/src/components/projects/NewProjectModal.tsx b/frontend/src/components/projects/NewProjectModal.tsx
index 1bbe9f6f1c..f097ae428a 100644
--- a/frontend/src/components/projects/NewProjectModal.tsx
+++ b/frontend/src/components/projects/NewProjectModal.tsx
@@ -34,10 +34,10 @@ import {
useUser
} from "@app/context";
import { getProjectHomePage, getProjectLottieIcon } from "@app/helpers/project";
-import { useCreateWorkspace, useGetExternalKmsList, useGetUserWorkspaces } from "@app/hooks/api";
+import { useCreateWorkspace, useGetExternalKmsList, useGetUserProjects } from "@app/hooks/api";
import { INTERNAL_KMS_KEY_ID } from "@app/hooks/api/kms/types";
import { InfisicalProjectTemplate, useListProjectTemplates } from "@app/hooks/api/projectTemplates";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
const formSchema = z.object({
name: z.string().trim().min(1, "Required").max(64, "Too long, maximum length is 64 characters"),
@@ -89,7 +89,7 @@ const NewProjectForm = ({ onOpenChange }: NewProjectFormProps) => {
const { permission } = useOrgPermission();
const { user } = useUser();
const createWs = useCreateWorkspace();
- const { refetch: refetchWorkspaces } = useGetUserWorkspaces();
+ const { refetch: refetchWorkspaces } = useGetUserProjects();
const { subscription } = useSubscription();
const canReadProjectTemplates = permission.can(
diff --git a/frontend/src/components/secret-rotations-v2/CreateSecretRotationV2Modal.tsx b/frontend/src/components/secret-rotations-v2/CreateSecretRotationV2Modal.tsx
index f5b9a39b39..7813ed3c9f 100644
--- a/frontend/src/components/secret-rotations-v2/CreateSecretRotationV2Modal.tsx
+++ b/frontend/src/components/secret-rotations-v2/CreateSecretRotationV2Modal.tsx
@@ -7,12 +7,12 @@ import { SecretRotationV2ModalHeader } from "@app/components/secret-rotations-v2
import { SecretRotationV2Select } from "@app/components/secret-rotations-v2/SecretRotationV2Select";
import { Modal, ModalContent } from "@app/components/v2";
import { SecretRotation, TSecretRotationV2 } from "@app/hooks/api/secretRotationsV2";
-import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { ProjectEnv } from "@app/hooks/api/projects/types";
type SharedProps = {
secretPath: string;
environment?: string;
- environments?: WorkspaceEnv[];
+ environments?: ProjectEnv[];
};
type Props = {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConfigurationFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConfigurationFields.tsx
index 1906b743d6..e518752c40 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConfigurationFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConfigurationFields.tsx
@@ -9,14 +9,14 @@ import {
IS_ROTATION_DUAL_CREDENTIALS,
SECRET_ROTATION_MAP
} from "@app/helpers/secretRotationsV2";
-import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { ProjectEnv } from "@app/hooks/api/projects/types";
import { TSecretRotationV2Form } from "./schemas";
import { SecretRotationV2ConnectionField } from "./SecretRotationV2ConnectionField";
type Props = {
isUpdate: boolean;
- environments?: WorkspaceEnv[];
+ environments?: ProjectEnv[];
};
export const SecretRotationV2ConfigurationFields = ({ isUpdate, environments }: Props) => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2Form.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2Form.tsx
index d931d9d3c1..793443a9ee 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2Form.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2Form.tsx
@@ -11,7 +11,7 @@ import { SecretRotationV2ParametersFields } from "@app/components/secret-rotatio
import { SecretRotationV2ReviewFields } from "@app/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields";
import { SecretRotationV2SecretsMappingFields } from "@app/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields";
import { Button } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { IS_ROTATION_DUAL_CREDENTIALS, SECRET_ROTATION_MAP } from "@app/helpers/secretRotationsV2";
import {
SecretRotation,
@@ -22,7 +22,7 @@ import {
useCreateSecretRotationV2,
useUpdateSecretRotationV2
} from "@app/hooks/api/secretRotationsV2/mutations";
-import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { ProjectEnv } from "@app/hooks/api/projects/types";
import { SecretRotationV2FormSchema, TSecretRotationV2Form } from "./schemas";
@@ -32,7 +32,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
environment?: string;
- environments?: WorkspaceEnv[];
+ environments?: ProjectEnv[];
secretRotation?: TSecretRotationV2;
};
@@ -68,7 +68,7 @@ export const SecretRotationV2Form = ({
}: Props) => {
const createSecretRotation = useCreateSecretRotationV2();
const updateSecretRotation = useUpdateSecretRotationV2();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { name: rotationType } = SECRET_ROTATION_MAP[type];
const [selectedTabIndex, setSelectedTabIndex] = useState(0);
@@ -80,7 +80,7 @@ export const SecretRotationV2Form = ({
defaultValues: secretRotation
? {
...secretRotation,
- environment: currentWorkspace?.environments.find((env) => env.slug === envSlug),
+ environment: currentProject?.environments.find((env) => env.slug === envSlug),
secretPath
}
: {
@@ -91,7 +91,7 @@ export const SecretRotationV2Form = ({
hours: 0,
minutes: 0
},
- environment: currentWorkspace?.environments.find((env) => env.slug === envSlug),
+ environment: currentProject?.environments.find((env) => env.slug === envSlug),
secretPath,
...(rotationOption!.template as object) // can't infer type since we don't know which specific type it is
},
@@ -115,7 +115,7 @@ export const SecretRotationV2Form = ({
connectionId: connection.id,
environment: environment.slug,
- projectId: currentWorkspace.id
+ projectId: currentProject.id
});
try {
const rotation = await mutation;
diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceForm.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceForm.tsx
index b1ea0b5597..948cfcdc12 100644
--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceForm.tsx
+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceForm.tsx
@@ -6,7 +6,7 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { Button } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { SECRET_SCANNING_DATA_SOURCE_MAP } from "@app/helpers/secretScanningV2";
import {
SecretScanningDataSource,
@@ -39,7 +39,7 @@ const FORM_TABS: { name: string; key: string; fields: (keyof TSecretScanningData
export const SecretScanningDataSourceForm = ({ type, onComplete, onCancel, dataSource }: Props) => {
const createDataSource = useCreateSecretScanningDataSource();
const updateDataSource = useUpdateSecretScanningDataSource();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { name: sourceType } = SECRET_SCANNING_DATA_SOURCE_MAP[type];
const [selectedTabIndex, setSelectedTabIndex] = useState(0);
@@ -63,7 +63,7 @@ export const SecretScanningDataSourceForm = ({ type, onComplete, onCancel, dataS
: createDataSource.mutateAsync({
...formData,
connectionId: connection?.id,
- projectId: currentWorkspace.id
+ projectId: currentProject.id
});
try {
const source = await mutation;
diff --git a/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx b/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx
index 8a1be69c49..8e5a0ebf4a 100644
--- a/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx
+++ b/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx
@@ -8,7 +8,7 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Switch } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { SECRET_SYNC_MAP } from "@app/helpers/secretSyncs";
import {
SecretSync,
@@ -41,7 +41,7 @@ const FORM_TABS: { name: string; key: string; fields: (keyof TSecretSyncForm)[]
export const CreateSecretSyncForm = ({ destination, onComplete, onCancel }: Props) => {
const createSecretSync = useCreateSecretSync();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { name: destinationName } = SECRET_SYNC_MAP[destination];
const [showConfirmation, setShowConfirmation] = useState(false);
@@ -70,7 +70,7 @@ export const CreateSecretSyncForm = ({ destination, onComplete, onCancel }: Prop
...formData,
connectionId: connection.id,
environment: environment.slug,
- projectId: currentWorkspace.id
+ projectId: currentProject.id
});
createNotification({
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncSourceFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncSourceFields.tsx
index 850ebbc801..8aa6d4fe2d 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncSourceFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncSourceFields.tsx
@@ -4,7 +4,7 @@ import { subject } from "@casl/ability";
import { FilterableSelect, FormControl } from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
-import { useProjectPermission, useWorkspace } from "@app/context";
+import { useProjectPermission, useProject } from "@app/context";
import {
ProjectPermissionSecretSyncActions,
ProjectPermissionSub
@@ -16,7 +16,7 @@ export const SecretSyncSourceFields = () => {
const { control, watch, setError, clearErrors } = useFormContext<TSecretSyncForm>();
const { permission } = useProjectPermission();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const selectedEnvironment = watch("environment");
const selectedSecretPath = watch("secretPath");
@@ -48,7 +48,7 @@ export const SecretSyncSourceFields = () => {
</p>
<Controller
- defaultValue={currentWorkspace.environments[0]}
+ defaultValue={currentProject.environments[0]}
control={control}
name="environment"
render={({ field: { value, onChange }, fieldState: { error } }) => (
@@ -56,7 +56,7 @@ export const SecretSyncSourceFields = () => {
<FilterableSelect
value={value}
onChange={onChange}
- options={currentWorkspace.environments}
+ options={currentProject.environments}
placeholder="Select environment..."
getOptionLabel={(option) => option?.name}
getOptionValue={(option) => option?.id}
diff --git a/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx b/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx
index a9542c90cd..ada7411459 100644
--- a/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx
+++ b/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx
@@ -13,7 +13,7 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { FormControl, FormLabel, SecretInput, Spinner, Tooltip } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useGetSecretReferenceTree } from "@app/hooks/api";
import { ApiErrorTypes, TApiErrors, TSecretReferenceTraceNode } from "@app/hooks/api/types";
@@ -89,8 +89,8 @@ export const SecretReferenceNode = ({
};
export const SecretReferenceTree = ({ secretPath, environment, secretKey }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data, isPending, isError, error } = useGetSecretReferenceTree({
secretPath,
diff --git a/frontend/src/components/tags/CreateTagModal/CreateTagModal.tsx b/frontend/src/components/tags/CreateTagModal/CreateTagModal.tsx
index b1773b2e39..d48b7d95fb 100644
--- a/frontend/src/components/tags/CreateTagModal/CreateTagModal.tsx
+++ b/frontend/src/components/tags/CreateTagModal/CreateTagModal.tsx
@@ -15,7 +15,7 @@ import {
ModalContent,
Tooltip
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateWsTag } from "@app/hooks/api";
import { slugSchema } from "@app/lib/schemas";
@@ -115,11 +115,10 @@ export const CreateTagModal = ({ isOpen, onToggle }: Props): JSX.Element => {
}
});
- const { currentWorkspace } = useWorkspace();
- const workspaceId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { mutateAsync: createWsTag } = useCreateWsTag();
-
const [showHexInput, setShowHexInput] = useState<boolean>(false);
const selectedTagColor = watch("color", secretTagsColors[0].hex);
@@ -130,7 +129,7 @@ export const CreateTagModal = ({ isOpen, onToggle }: Props): JSX.Element => {
const onFormSubmit = async ({ slug, color }: FormData) => {
try {
await createWsTag({
- workspaceID: workspaceId,
+ projectId,
tagColor: color,
tagSlug: slug
});
diff --git a/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx b/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx
index ee2f196b13..82da9b8c89 100644
--- a/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx
+++ b/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx
@@ -3,7 +3,7 @@ import { faFolder, faKey, faLayerGroup } from "@fortawesome/free-solid-svg-icons
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import * as Popover from "@radix-ui/react-popover";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useDebounce, useToggle } from "@app/hooks";
import { useGetProjectFolders, useGetProjectSecrets } from "@app/hooks/api";
@@ -76,8 +76,8 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
},
ref
) => {
- const { currentWorkspace } = useWorkspace();
- const workspaceId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const [debouncedValue] = useDebounce(value, 100);
@@ -101,7 +101,7 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
let predicate = suggestionSourceValue;
if (isDeep) {
const [envSlug, ...folderPaths] = suggestionSourceValue.split(".");
- const isValidEnvSlug = currentWorkspace?.environments.find((e) => e.slug === envSlug);
+ const isValidEnvSlug = currentProject?.environments.find((e) => e.slug === envSlug);
suggestionSourceEnv = isValidEnvSlug ? envSlug : undefined;
suggestionSourceSecretPath = `/${folderPaths.slice(0, -1)?.join("/")}`;
predicate = folderPaths[folderPaths.length - 1];
@@ -125,7 +125,7 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
viewSecretValue: false,
environment: suggestionSource.environment || "",
secretPath: suggestionSource.secretPath || "",
- workspaceId,
+ projectId,
options: {
enabled: isPopupOpen
}
@@ -133,7 +133,7 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
const { data: folders } = useGetProjectFolders({
environment: suggestionSource.environment || "",
path: suggestionSource.secretPath || "",
- projectId: workspaceId,
+ projectId: projectId,
options: {
enabled: isPopupOpen
}
@@ -148,7 +148,7 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
if (!suggestionSource.isDeep) {
// At first level only environments and secrets
- (currentWorkspace?.environments || []).forEach(({ name, slug }) => {
+ (currentProject?.environments || []).forEach(({ name, slug }) => {
if (name.toLowerCase().startsWith(predicate))
suggestionsArr.push({
label: name,
@@ -176,7 +176,7 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
});
});
return suggestionsArr;
- }, [secrets, folders, currentWorkspace?.environments, isPopupOpen, suggestionSource.value]);
+ }, [secrets, folders, currentProject?.environments, isPopupOpen, suggestionSource.value]);
const handleSuggestionSelect = (selectIndex?: number) => {
const selectedSuggestion =
diff --git a/frontend/src/components/v2/SecretPathInput/SecretPathInput.tsx b/frontend/src/components/v2/SecretPathInput/SecretPathInput.tsx
index a1d4fb2a26..a4b33fd382 100644
--- a/frontend/src/components/v2/SecretPathInput/SecretPathInput.tsx
+++ b/frontend/src/components/v2/SecretPathInput/SecretPathInput.tsx
@@ -4,7 +4,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import * as Popover from "@radix-ui/react-popover";
import { twMerge } from "tailwind-merge";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useDebounce } from "@app/hooks";
import { useGetFoldersByEnv } from "@app/hooks/api";
@@ -35,11 +35,11 @@ export const SecretPathInput = ({
const [highlightedIndex, setHighlightedIndex] = useState(-1);
const [debouncedInputValue] = useDebounce(inputValue, 200);
- const { currentWorkspace } = useWorkspace();
- const workspaceId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const workspaceId = currentProject?.id || "";
const { folderNames: folders } = useGetFoldersByEnv({
path: secretPath,
- environments: [environment || currentWorkspace?.environments?.[0].slug || ""],
+ environments: [environment || currentProject?.environments?.[0].slug || ""],
projectId: workspaceId
});
diff --git a/frontend/src/context/ProjectPermissionContext/ProjectPermissionContext.tsx b/frontend/src/context/ProjectPermissionContext/ProjectPermissionContext.tsx
index a824f6fa64..871d5c338d 100644
--- a/frontend/src/context/ProjectPermissionContext/ProjectPermissionContext.tsx
+++ b/frontend/src/context/ProjectPermissionContext/ProjectPermissionContext.tsx
@@ -22,8 +22,8 @@ export const useProjectPermission = () => {
const {
data: { permission, membership, assumedPrivilegeDetails }
} = useSuspenseQuery({
- queryKey: roleQueryKeys.getUserProjectPermissions({ workspaceId: projectId }),
- queryFn: () => fetchUserProjectPermissions({ workspaceId: projectId }),
+ queryKey: roleQueryKeys.getUserProjectPermissions({ projectId }),
+ queryFn: () => fetchUserProjectPermissions({ projectId }),
staleTime: Infinity,
select: (data) => {
const rule = unpackRules<RawRuleOf<MongoAbility<ProjectPermissionSet>>>(data.permissions);
diff --git a/frontend/src/context/WorkspaceContext/WorkspaceContext.tsx b/frontend/src/context/WorkspaceContext/WorkspaceContext.tsx
index 9d3aadd5db..7256741ef6 100644
--- a/frontend/src/context/WorkspaceContext/WorkspaceContext.tsx
+++ b/frontend/src/context/WorkspaceContext/WorkspaceContext.tsx
@@ -2,9 +2,9 @@ import { useSuspenseQuery } from "@tanstack/react-query";
import { useParams } from "@tanstack/react-router";
import { projectKeys } from "@app/hooks/api";
-import { fetchWorkspaceById } from "@app/hooks/api/workspace/queries";
+import { fetchProjectById } from "@app/hooks/api/projects/queries";
-export const useWorkspace = () => {
+export const useProject = () => {
const params = useParams({
strict: false
});
@@ -12,11 +12,11 @@ export const useWorkspace = () => {
throw new Error("Missing project id");
}
- const { data: currentWorkspace } = useSuspenseQuery({
- queryKey: projectKeys.getWorkspaceById(params.projectId),
- queryFn: () => fetchWorkspaceById(params.projectId as string),
+ const { data: currentProject } = useSuspenseQuery({
+ queryKey: projectKeys.getProjectById(params.projectId),
+ queryFn: () => fetchProjectById(params.projectId as string),
staleTime: Infinity
});
- return { currentWorkspace };
+ return { currentProject, projectId: currentProject.id };
};
diff --git a/frontend/src/context/WorkspaceContext/index.tsx b/frontend/src/context/WorkspaceContext/index.tsx
index b0c25d4dab..6e4b5ce69f 100644
--- a/frontend/src/context/WorkspaceContext/index.tsx
+++ b/frontend/src/context/WorkspaceContext/index.tsx
@@ -1 +1 @@
-export { useWorkspace } from "./WorkspaceContext";
+export { useProject } from "./WorkspaceContext";
diff --git a/frontend/src/context/index.tsx b/frontend/src/context/index.tsx
index bfb504664d..1659027db8 100644
--- a/frontend/src/context/index.tsx
+++ b/frontend/src/context/index.tsx
@@ -29,4 +29,4 @@ export {
export { useServerConfig } from "./ServerConfigContext";
export { useSubscription } from "./SubscriptionContext";
export { useUser } from "./UserContext";
-export { useWorkspace } from "./WorkspaceContext";
+export { useProject } from "./WorkspaceContext";
diff --git a/frontend/src/helpers/project.ts b/frontend/src/helpers/project.ts
index 7c91855560..d2dbce2c68 100644
--- a/frontend/src/helpers/project.ts
+++ b/frontend/src/helpers/project.ts
@@ -1,6 +1,6 @@
import { apiRequest } from "@app/config/request";
-import { createWorkspace } from "@app/hooks/api/workspace/queries";
-import { ProjectType, WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { createWorkspace } from "@app/hooks/api/projects/queries";
+import { ProjectType, ProjectEnv } from "@app/hooks/api/projects/types";
const secretsToBeAdded = [
{
@@ -74,7 +74,7 @@ export const getProjectBaseURL = (type: ProjectType) => {
// @ts-expect-error akhilmhdh: will remove this later
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-export const getProjectHomePage = (type: ProjectType, environments: WorkspaceEnv[]) => {
+export const getProjectHomePage = (type: ProjectType, environments: ProjectEnv[]) => {
switch (type) {
case ProjectType.SecretManager:
return "/projects/secret-management/$projectId/overview" as const;
diff --git a/frontend/src/hooks/api/accessApproval/types.ts b/frontend/src/hooks/api/accessApproval/types.ts
index 5063f4fffd..954d2b6bc4 100644
--- a/frontend/src/hooks/api/accessApproval/types.ts
+++ b/frontend/src/hooks/api/accessApproval/types.ts
@@ -1,7 +1,7 @@
import { EnforcementLevel, PolicyType } from "../policies/enums";
import { TProjectPermission } from "../roles/types";
import { ApprovalStatus } from "../secretApprovalRequest/types";
-import { WorkspaceEnv } from "../workspace/types";
+import { ProjectEnv } from "../projects/types";
export type TAccessApprovalPolicy = {
id: string;
@@ -9,7 +9,7 @@ export type TAccessApprovalPolicy = {
approvals: number;
secretPath: string;
workspace: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
projectId: string;
policyType: PolicyType;
approversRequired: boolean;
diff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsx
index 186a8e5394..3ced13cf02 100644
--- a/frontend/src/hooks/api/auditLogs/constants.tsx
+++ b/frontend/src/hooks/api/auditLogs/constants.tsx
@@ -20,7 +20,7 @@ export const eventToNameMap: { [K in EventType]: string } = {
[EventType.CREATE_SECRET]: "Create secret",
[EventType.UPDATE_SECRET]: "Update secret",
[EventType.DELETE_SECRET]: "Delete secret",
- [EventType.GET_WORKSPACE_KEY]: "Read project key",
+ [EventType.GET_PROJECT_KEY]: "Read project key",
[EventType.AUTHORIZE_INTEGRATION]: "Authorize integration",
[EventType.UPDATE_INTEGRATION_AUTH]: "Update integration auth",
[EventType.UNAUTHORIZE_INTEGRATION]: "Unauthorize integration",
@@ -45,8 +45,8 @@ export const eventToNameMap: { [K in EventType]: string } = {
[EventType.CREATE_ENVIRONMENT]: "Create environment",
[EventType.UPDATE_ENVIRONMENT]: "Update environment",
[EventType.DELETE_ENVIRONMENT]: "Delete environment",
- [EventType.ADD_WORKSPACE_MEMBER]: "Add member",
- [EventType.REMOVE_WORKSPACE_MEMBER]: "Remove member",
+ [EventType.ADD_PROJECT_MEMBER]: "Add member",
+ [EventType.REMOVE_PROJECT_MEMBER]: "Remove member",
[EventType.CREATE_FOLDER]: "Create folder",
[EventType.UPDATE_FOLDER]: "Update folder",
[EventType.DELETE_FOLDER]: "Delete folder",
@@ -58,8 +58,8 @@ export const eventToNameMap: { [K in EventType]: string } = {
[EventType.CREATE_SECRET_IMPORT]: "Create secret import",
[EventType.UPDATE_SECRET_IMPORT]: "Update secret import",
[EventType.DELETE_SECRET_IMPORT]: "Delete secret import",
- [EventType.UPDATE_USER_WORKSPACE_DENIED_PERMISSIONS]: "Update denied permissions",
- [EventType.UPDATE_USER_WORKSPACE_ROLE]: "Update user role",
+ [EventType.UPDATE_USER_PROJECT_DENIED_PERMISSIONS]: "Update denied permissions",
+ [EventType.UPDATE_USER_PROJECT_ROLE]: "Update user role",
[EventType.CREATE_CA]: "Create CA",
[EventType.GET_CA]: "Get CA",
[EventType.UPDATE_CA]: "Update CA",
diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx
index 4fe8948dd8..002e43287b 100644
--- a/frontend/src/hooks/api/auditLogs/enums.tsx
+++ b/frontend/src/hooks/api/auditLogs/enums.tsx
@@ -26,7 +26,7 @@ export enum EventType {
CREATE_SECRET = "create-secret",
UPDATE_SECRET = "update-secret",
DELETE_SECRET = "delete-secret",
- GET_WORKSPACE_KEY = "get-workspace-key",
+ GET_PROJECT_KEY = "get-project-key",
AUTHORIZE_INTEGRATION = "authorize-integration",
UPDATE_INTEGRATION_AUTH = "update-integration-auth",
UNAUTHORIZE_INTEGRATION = "unauthorize-integration",
@@ -58,8 +58,8 @@ export enum EventType {
CREATE_ENVIRONMENT = "create-environment",
UPDATE_ENVIRONMENT = "update-environment",
DELETE_ENVIRONMENT = "delete-environment",
- ADD_WORKSPACE_MEMBER = "add-workspace-member",
- REMOVE_WORKSPACE_MEMBER = "remove-workspace-member",
+ ADD_PROJECT_MEMBER = "add-project-member",
+ REMOVE_PROJECT_MEMBER = "remove-project-member",
CREATE_FOLDER = "create-folder",
UPDATE_FOLDER = "update-folder",
DELETE_FOLDER = "delete-folder",
@@ -71,8 +71,8 @@ export enum EventType {
CREATE_SECRET_IMPORT = "create-secret-import",
UPDATE_SECRET_IMPORT = "update-secret-import",
DELETE_SECRET_IMPORT = "delete-secret-import",
- UPDATE_USER_WORKSPACE_ROLE = "update-user-workspace-role",
- UPDATE_USER_WORKSPACE_DENIED_PERMISSIONS = "update-user-workspace-denied-permissions",
+ UPDATE_USER_PROJECT_ROLE = "update-user-project-role",
+ UPDATE_USER_PROJECT_DENIED_PERMISSIONS = "update-user-project-denied-permissions",
CREATE_CA = "create-certificate-authority",
GET_CA = "get-certificate-authority",
UPDATE_CA = "update-certificate-authority",
diff --git a/frontend/src/hooks/api/auditLogs/types.tsx b/frontend/src/hooks/api/auditLogs/types.tsx
index 1ca819e606..f09924d263 100644
--- a/frontend/src/hooks/api/auditLogs/types.tsx
+++ b/frontend/src/hooks/api/auditLogs/types.tsx
@@ -129,7 +129,7 @@ interface DeleteSecretEvent {
}
interface GetWorkspaceKeyEvent {
- type: EventType.GET_WORKSPACE_KEY;
+ type: EventType.GET_PROJECT_KEY;
metadata: {
keyId: string;
};
@@ -361,7 +361,7 @@ interface DeleteEnvironmentEvent {
}
interface AddWorkspaceMemberEvent {
- type: EventType.ADD_WORKSPACE_MEMBER;
+ type: EventType.ADD_PROJECT_MEMBER;
metadata: {
userId: string;
email: string;
@@ -369,7 +369,7 @@ interface AddWorkspaceMemberEvent {
}
interface RemoveWorkspaceMemberEvent {
- type: EventType.REMOVE_WORKSPACE_MEMBER;
+ type: EventType.REMOVE_PROJECT_MEMBER;
metadata: {
userId: string;
email: string;
@@ -500,7 +500,7 @@ interface DeleteSecretImportEvent {
}
interface UpdateUserRole {
- type: EventType.UPDATE_USER_WORKSPACE_ROLE;
+ type: EventType.UPDATE_USER_PROJECT_ROLE;
metadata: {
userId: string;
email: string;
@@ -510,7 +510,7 @@ interface UpdateUserRole {
}
interface UpdateUserDeniedPermissions {
- type: EventType.UPDATE_USER_WORKSPACE_DENIED_PERMISSIONS;
+ type: EventType.UPDATE_USER_PROJECT_DENIED_PERMISSIONS;
metadata: {
userId: string;
email: string;
diff --git a/frontend/src/hooks/api/auth/queries.tsx b/frontend/src/hooks/api/auth/queries.tsx
index cb7e3f64c7..6275d81412 100644
--- a/frontend/src/hooks/api/auth/queries.tsx
+++ b/frontend/src/hooks/api/auth/queries.tsx
@@ -6,7 +6,7 @@ import { SessionStorageKeys } from "@app/const";
import { organizationKeys } from "../organization/queries";
import { setAuthToken } from "../reactQuery";
-import { workspaceKeys } from "../workspace";
+import { projectKeys } from "../projects";
import {
CompleteAccountDTO,
CompleteAccountSignupDTO,
@@ -101,7 +101,7 @@ export const useSelectOrganization = () => {
},
onSuccess: () => {
queryClient.invalidateQueries({
- queryKey: [organizationKeys.getUserOrganizations, workspaceKeys.getAllUserWorkspace]
+ queryKey: [organizationKeys.getUserOrganizations, projectKeys.getAllUserProjects]
});
}
});
diff --git a/frontend/src/hooks/api/ca/mutations.tsx b/frontend/src/hooks/api/ca/mutations.tsx
index f6204d4fc4..a14a0244b9 100644
--- a/frontend/src/hooks/api/ca/mutations.tsx
+++ b/frontend/src/hooks/api/ca/mutations.tsx
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { workspaceKeys } from "../workspace";
+import { projectKeys } from "../projects";
import { CaType } from "./enums";
import { caKeys } from "./queries";
import {
@@ -118,8 +118,8 @@ export const useImportCaCertificate = (projectId: string) => {
);
return data;
},
- onSuccess: (_, { caId, projectSlug }) => {
- queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) });
+ onSuccess: (_, { caId }) => {
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectCas({ projectId }) });
queryClient.invalidateQueries({ queryKey: caKeys.getCaCerts(caId) });
queryClient.invalidateQueries({ queryKey: caKeys.getCaCert(caId) });
queryClient.invalidateQueries({
@@ -142,7 +142,7 @@ export const useCreateCertificate = () => {
},
onSuccess: (_, { projectSlug }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.forWorkspaceCertificates(projectSlug)
+ queryKey: projectKeys.forProjectCertificates(projectSlug)
});
}
});
@@ -158,8 +158,8 @@ export const useRenewCa = () => {
);
return data;
},
- onSuccess: (_, { caId, projectSlug }) => {
- queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) });
+ onSuccess: ({ projectId }, { caId }) => {
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectCas({ projectId }) });
queryClient.invalidateQueries({ queryKey: caKeys.getCaById(caId) });
queryClient.invalidateQueries({ queryKey: caKeys.getCaCert(caId) });
queryClient.invalidateQueries({ queryKey: caKeys.getCaCerts(caId) });
diff --git a/frontend/src/hooks/api/ca/types.ts b/frontend/src/hooks/api/ca/types.ts
index 336688ca4d..0443dd5e99 100644
--- a/frontend/src/hooks/api/ca/types.ts
+++ b/frontend/src/hooks/api/ca/types.ts
@@ -182,4 +182,5 @@ export type TRenewCaResponse = {
certificate: string;
certificateChain: string;
serialNumber: string;
+ projectId: string;
};
diff --git a/frontend/src/hooks/api/certificateTemplates/mutations.tsx b/frontend/src/hooks/api/certificateTemplates/mutations.tsx
index d1069e7e67..24a7d0e5f2 100644
--- a/frontend/src/hooks/api/certificateTemplates/mutations.tsx
+++ b/frontend/src/hooks/api/certificateTemplates/mutations.tsx
@@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { caKeys } from "../ca/queries";
-import { workspaceKeys } from "../workspace";
+import { projectKeys } from "../projects";
import { certTemplateKeys } from "./queries";
import {
TCertificateTemplate,
@@ -29,7 +29,7 @@ export const useCreateCertTemplate = () => {
},
onSuccess: ({ caId }, { projectId }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceCertificateTemplates(projectId)
+ queryKey: projectKeys.getProjectCertificateTemplates(projectId)
});
queryClient.invalidateQueries({ queryKey: caKeys.getCaCertTemplates(caId) });
}
@@ -49,7 +49,7 @@ export const useUpdateCertTemplate = () => {
},
onSuccess: ({ caId }, { projectId, id }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceCertificateTemplates(projectId)
+ queryKey: projectKeys.getProjectCertificateTemplates(projectId)
});
queryClient.invalidateQueries({ queryKey: certTemplateKeys.getCertTemplateById(id) });
queryClient.invalidateQueries({ queryKey: caKeys.getCaCertTemplates(caId) });
@@ -68,7 +68,7 @@ export const useDeleteCertTemplate = () => {
},
onSuccess: ({ caId }, { projectId, id }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceCertificateTemplates(projectId)
+ queryKey: projectKeys.getProjectCertificateTemplates(projectId)
});
queryClient.invalidateQueries({ queryKey: certTemplateKeys.getCertTemplateById(id) });
queryClient.invalidateQueries({ queryKey: caKeys.getCaCertTemplates(caId) });
diff --git a/frontend/src/hooks/api/certificates/mutations.tsx b/frontend/src/hooks/api/certificates/mutations.tsx
index 12f8e834bd..77a3dab72c 100644
--- a/frontend/src/hooks/api/certificates/mutations.tsx
+++ b/frontend/src/hooks/api/certificates/mutations.tsx
@@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { pkiSubscriberKeys } from "../pkiSubscriber/queries";
-import { workspaceKeys } from "../workspace";
+import { projectKeys } from "../projects";
import {
TCertificate,
TDeleteCertDTO,
@@ -25,7 +25,7 @@ export const useDeleteCert = () => {
},
onSuccess: (_, { projectSlug }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.forWorkspaceCertificates(projectSlug)
+ queryKey: projectKeys.forProjectCertificates(projectSlug)
});
}
});
@@ -47,7 +47,7 @@ export const useRevokeCert = () => {
},
onSuccess: (_, { projectSlug }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.forWorkspaceCertificates(projectSlug)
+ queryKey: projectKeys.forProjectCertificates(projectSlug)
});
queryClient.invalidateQueries({
queryKey: pkiSubscriberKeys.allPkiSubscriberCertificates()
@@ -68,7 +68,7 @@ export const useImportCertificate = () => {
},
onSuccess: (_, { projectSlug }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.forWorkspaceCertificates(projectSlug)
+ queryKey: projectKeys.forProjectCertificates(projectSlug)
});
}
});
diff --git a/frontend/src/hooks/api/identities/types.ts b/frontend/src/hooks/api/identities/types.ts
index c16c61c577..9634164aaa 100644
--- a/frontend/src/hooks/api/identities/types.ts
+++ b/frontend/src/hooks/api/identities/types.ts
@@ -1,7 +1,7 @@
import { OrderByDirection } from "../generic/types";
import { OrgIdentityOrderBy } from "../organization/types";
import { TOrgRole } from "../roles/types";
-import { ProjectUserMembershipTemporaryMode, Project } from "../workspace/types";
+import { ProjectUserMembershipTemporaryMode, Project } from "../projects/types";
import { IdentityAuthMethod, IdentityJwtConfigurationType } from "./enums";
export type IdentityTrustedIp = {
diff --git a/frontend/src/hooks/api/index.tsx b/frontend/src/hooks/api/index.tsx
index 78dcd3b793..002c03cec8 100644
--- a/frontend/src/hooks/api/index.tsx
+++ b/frontend/src/hooks/api/index.tsx
@@ -1,5 +1,5 @@
-export * from "./accessApproval";
export * from "./admin";
+export * from "./accessApproval";
export * from "./apiKeys";
export * from "./assumePrivileges";
export * from "./auditLogs";
@@ -20,7 +20,6 @@ export * from "./identityProjectAdditionalPrivilege";
export * from "./incidentContacts";
export * from "./integrationAuth";
export * from "./integrations";
-export * from "./keys";
export * from "./kms";
export * from "./ldapConfig";
export * from "./oidcConfig";
@@ -54,4 +53,4 @@ export * from "./trustedIps";
export * from "./users";
export * from "./webhooks";
export * from "./workflowIntegrations";
-export * from "./workspace";
+export * from "./projects";
diff --git a/frontend/src/hooks/api/integrationAuth/queries.tsx b/frontend/src/hooks/api/integrationAuth/queries.tsx
index 044ec8d2af..f6c936480a 100644
--- a/frontend/src/hooks/api/integrationAuth/queries.tsx
+++ b/frontend/src/hooks/api/integrationAuth/queries.tsx
@@ -3,7 +3,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { TReactQueryOptions } from "@app/types/reactQuery";
-import { workspaceKeys } from "../workspace";
+import { projectKeys } from "../projects";
import {
App,
BitbucketEnvironment,
@@ -970,7 +970,7 @@ export const useAuthorizeIntegration = () => {
},
onSuccess: (res) => {
queryClient.invalidateQueries({
- queryKey: { queryKey: workspaceKeys.getWorkspaceAuthorization(res.workspace) }
+ queryKey: { queryKey: projectKeys.getProjectAuthorization(res.workspace) }
});
}
});
@@ -1016,7 +1016,7 @@ export const useSaveIntegrationAccessToken = () => {
},
onSuccess: (res) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceAuthorization(res.workspace)
+ queryKey: projectKeys.getProjectAuthorization(res.workspace)
});
}
});
@@ -1035,10 +1035,10 @@ export const useDeleteIntegrationAuths = () => {
),
onSuccess: (_, { workspaceId }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceAuthorization(workspaceId)
+ queryKey: projectKeys.getProjectAuthorization(workspaceId)
});
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceIntegrations(workspaceId)
+ queryKey: projectKeys.getProjectIntegrations(workspaceId)
});
}
});
@@ -1052,10 +1052,10 @@ export const useDeleteIntegrationAuth = () => {
mutationFn: ({ id }) => apiRequest.delete(`/api/v1/integration-auth/${id}`),
onSuccess: (_, { workspaceId }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceAuthorization(workspaceId)
+ queryKey: projectKeys.getProjectAuthorization(workspaceId)
});
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceIntegrations(workspaceId)
+ queryKey: projectKeys.getProjectIntegrations(workspaceId)
});
}
});
diff --git a/frontend/src/hooks/api/integrations/queries.tsx b/frontend/src/hooks/api/integrations/queries.tsx
index a439f8caa1..69519a5a48 100644
--- a/frontend/src/hooks/api/integrations/queries.tsx
+++ b/frontend/src/hooks/api/integrations/queries.tsx
@@ -3,7 +3,7 @@ import { useMutation, useQuery, useQueryClient, UseQueryOptions } from "@tanstac
import { createNotification } from "@app/components/notifications";
import { apiRequest } from "@app/config/request";
-import { workspaceKeys } from "../workspace";
+import { projectKeys } from "../projects";
import {
IntegrationMetadataSyncMode,
TCloudIntegration,
@@ -121,7 +121,7 @@ export const useCreateIntegration = () => {
},
onSuccess: (res) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceIntegrations(res.workspace)
+ queryKey: projectKeys.getProjectIntegrations(res.workspace)
});
}
});
@@ -141,10 +141,10 @@ export const useDeleteIntegration = () => {
),
onSuccess: (_, { workspaceId }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceIntegrations(workspaceId)
+ queryKey: projectKeys.getProjectIntegrations(workspaceId)
});
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceAuthorization(workspaceId)
+ queryKey: projectKeys.getProjectAuthorization(workspaceId)
});
}
});
diff --git a/frontend/src/hooks/api/migration/mutations.tsx b/frontend/src/hooks/api/migration/mutations.tsx
index 1827979545..b2694b4587 100644
--- a/frontend/src/hooks/api/migration/mutations.tsx
+++ b/frontend/src/hooks/api/migration/mutations.tsx
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { workspaceKeys } from "../workspace";
+import { projectKeys } from "../projects";
export const useImportEnvKey = () => {
const queryClient = useQueryClient();
@@ -34,7 +34,7 @@ export const useImportEnvKey = () => {
},
onSuccess: () => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getAllUserWorkspace()
+ queryKey: projectKeys.getAllUserProjects()
});
}
});
diff --git a/frontend/src/hooks/api/pkiAlerts/mutations.tsx b/frontend/src/hooks/api/pkiAlerts/mutations.tsx
index 34397c1412..df48a6aab3 100644
--- a/frontend/src/hooks/api/pkiAlerts/mutations.tsx
+++ b/frontend/src/hooks/api/pkiAlerts/mutations.tsx
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { workspaceKeys } from "../workspace";
+import { projectKeys } from "../projects";
import { pkiAlertKeys } from "./queries";
import { TCreatePkiAlertDTO, TDeletePkiAlertDTO, TPkiAlert, TUpdatePkiAlertDTO } from "./types";
@@ -14,7 +14,7 @@ export const useCreatePkiAlert = () => {
return alert;
},
onSuccess: (_, { projectId }) => {
- queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspacePkiAlerts(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectPkiAlerts(projectId) });
}
});
};
@@ -30,7 +30,7 @@ export const useUpdatePkiAlert = () => {
return alert;
},
onSuccess: (_, { projectId, alertId }) => {
- queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspacePkiAlerts(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectPkiAlerts(projectId) });
queryClient.invalidateQueries({ queryKey: pkiAlertKeys.getPkiAlertById(alertId) });
}
});
@@ -44,7 +44,7 @@ export const useDeletePkiAlert = () => {
return alert;
},
onSuccess: (_, { projectId, alertId }) => {
- queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspacePkiAlerts(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectPkiAlerts(projectId) });
queryClient.invalidateQueries({ queryKey: pkiAlertKeys.getPkiAlertById(alertId) });
}
});
diff --git a/frontend/src/hooks/api/pkiCollections/mutations.tsx b/frontend/src/hooks/api/pkiCollections/mutations.tsx
index af1f0af185..a06afcd091 100644
--- a/frontend/src/hooks/api/pkiCollections/mutations.tsx
+++ b/frontend/src/hooks/api/pkiCollections/mutations.tsx
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { workspaceKeys } from "../workspace";
+import { projectKeys } from "../projects";
import { pkiCollectionKeys } from "./queries";
import {
TAddItemToPkiCollectionDTO,
@@ -26,7 +26,7 @@ export const useCreatePkiCollection = () => {
},
onSuccess: (_, { projectId }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspacePkiCollections(projectId)
+ queryKey: projectKeys.getProjectPkiCollections(projectId)
});
}
});
@@ -44,7 +44,7 @@ export const useUpdatePkiCollection = () => {
},
onSuccess: (_, { projectId, collectionId }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspacePkiCollections(projectId)
+ queryKey: projectKeys.getProjectPkiCollections(projectId)
});
queryClient.invalidateQueries({
queryKey: pkiCollectionKeys.getPkiCollectionById(collectionId)
@@ -64,7 +64,7 @@ export const useDeletePkiCollection = () => {
},
onSuccess: (_, { projectId, collectionId }) => {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspacePkiCollections(projectId)
+ queryKey: projectKeys.getProjectPkiCollections(projectId)
});
queryClient.invalidateQueries({
queryKey: pkiCollectionKeys.getPkiCollectionById(collectionId)
diff --git a/frontend/src/hooks/api/pkiSubscriber/mutations.tsx b/frontend/src/hooks/api/pkiSubscriber/mutations.tsx
index 17b53004be..57d086780a 100644
--- a/frontend/src/hooks/api/pkiSubscriber/mutations.tsx
+++ b/frontend/src/hooks/api/pkiSubscriber/mutations.tsx
@@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { TCreateCertificateResponse } from "../ca/types";
-import { projectKeys } from "../workspace/query-keys";
+import { projectKeys } from "../projects/query-keys";
import { pkiSubscriberKeys } from "./queries";
import {
TCreatePkiSubscriberDTO,
@@ -22,7 +22,7 @@ export const useCreatePkiSubscriber = () => {
},
onSuccess: ({ projectId, name }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspacePkiSubscribers(projectId)
+ queryKey: projectKeys.getProjectPkiSubscribers(projectId)
});
queryClient.invalidateQueries({
queryKey: pkiSubscriberKeys.getPkiSubscriber({
@@ -46,7 +46,7 @@ export const useUpdatePkiSubscriber = () => {
},
onSuccess: ({ projectId, name }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspacePkiSubscribers(projectId)
+ queryKey: projectKeys.getProjectPkiSubscribers(projectId)
});
queryClient.invalidateQueries({
queryKey: pkiSubscriberKeys.getPkiSubscriber({
@@ -74,7 +74,7 @@ export const useDeletePkiSubscriber = () => {
},
onSuccess: ({ name, projectId }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspacePkiSubscribers(projectId)
+ queryKey: projectKeys.getProjectPkiSubscribers(projectId)
});
queryClient.invalidateQueries({
queryKey: pkiSubscriberKeys.getPkiSubscriber({
diff --git a/frontend/src/hooks/api/projectTemplates/types.ts b/frontend/src/hooks/api/projectTemplates/types.ts
index f5ff22dffe..d58e80f53e 100644
--- a/frontend/src/hooks/api/projectTemplates/types.ts
+++ b/frontend/src/hooks/api/projectTemplates/types.ts
@@ -1,6 +1,6 @@
import { TProjectRole } from "@app/hooks/api/roles/types";
-import { ProjectType } from "../workspace/types";
+import { ProjectType } from "../projects/types";
export type TProjectTemplate = {
id: string;
diff --git a/frontend/src/hooks/api/workspace/index.tsx b/frontend/src/hooks/api/projects/index.tsx
similarity index 96%
rename from frontend/src/hooks/api/workspace/index.tsx
rename to frontend/src/hooks/api/projects/index.tsx
index a75789da53..7297c7362d 100644
--- a/frontend/src/hooks/api/workspace/index.tsx
+++ b/frontend/src/hooks/api/projects/index.tsx
@@ -18,7 +18,7 @@ export {
useGetProjectSshConfig,
useGetUpgradeProjectStatus,
useGetUserWorkspaceMemberships,
- useGetUserWorkspaces,
+ useGetUserProjects,
useGetWorkspaceAuthorizations,
useGetWorkspaceById,
useGetWorkspaceIdentityMembershipDetails,
@@ -41,7 +41,6 @@ export {
useListWorkspaceSshHostGroups,
useListWorkspaceSshHosts,
useSearchProjects,
- useToggleAutoCapitalization,
useUpdateIdentityWorkspaceRole,
useUpdateProject,
useUpdateUserWorkspaceRole,
diff --git a/frontend/src/hooks/api/workspace/mutations.tsx b/frontend/src/hooks/api/projects/mutations.tsx
similarity index 90%
rename from frontend/src/hooks/api/workspace/mutations.tsx
rename to frontend/src/hooks/api/projects/mutations.tsx
index bde2666a95..e2a80ff536 100644
--- a/frontend/src/hooks/api/workspace/mutations.tsx
+++ b/frontend/src/hooks/api/projects/mutations.tsx
@@ -32,7 +32,7 @@ export const useAddGroupToWorkspace = () => {
},
onSuccess: (_, { projectId }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceGroupMemberships(projectId)
+ queryKey: projectKeys.getProjectGroupMemberships(projectId)
});
}
});
@@ -52,10 +52,10 @@ export const useUpdateGroupWorkspaceRole = () => {
},
onSuccess: (_, { projectId, groupId }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceGroupMemberships(projectId)
+ queryKey: projectKeys.getProjectGroupMemberships(projectId)
});
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceGroupMembershipDetails(projectId, groupId)
+ queryKey: projectKeys.getProjectGroupMembershipDetails(projectId, groupId)
});
}
});
@@ -79,7 +79,7 @@ export const useDeleteGroupFromWorkspace = () => {
},
onSuccess: (_, { projectId, username }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceGroupMemberships(projectId)
+ queryKey: projectKeys.getProjectGroupMemberships(projectId)
});
if (username) {
@@ -96,7 +96,7 @@ export const useLeaveProject = () => {
return apiRequest.delete(`/api/v1/projects/${projectId}/leave`);
},
onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserWorkspace() });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserProjects() });
}
});
};
@@ -109,7 +109,7 @@ export const useMigrateProjectToV3 = () => {
},
onSuccess: () => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getAllUserWorkspace()
+ queryKey: projectKeys.getAllUserProjects()
});
}
});
diff --git a/frontend/src/hooks/api/workspace/queries.tsx b/frontend/src/hooks/api/projects/queries.tsx
similarity index 82%
rename from frontend/src/hooks/api/workspace/queries.tsx
rename to frontend/src/hooks/api/projects/queries.tsx
index 4f21ebb5e9..f7a4313fa3 100644
--- a/frontend/src/hooks/api/workspace/queries.tsx
+++ b/frontend/src/hooks/api/projects/queries.tsx
@@ -35,21 +35,18 @@ import {
ProjectType,
TGetUpgradeProjectStatusDTO,
TListProjectIdentitiesDTO,
- ToggleAutoCapitalizationDTO,
- ToggleDeleteProjectProtectionDTO,
TProjectSshConfig,
TSearchProjectsDTO,
TUpdateWorkspaceIdentityRoleDTO,
TUpdateWorkspaceUserRoleDTO,
UpdateAuditLogsRetentionDTO,
UpdateEnvironmentDTO,
- UpdatePitVersionLimitDTO,
UpdateProjectDTO,
Project,
- WorkspaceEnv
+ ProjectEnv
} from "./types";
-export const fetchWorkspaceById = async (projectId: string) => {
+export const fetchProjectById = async (projectId: string) => {
const { data } = await apiRequest.get<{ project: Project }>(`/api/v1/projects/${projectId}`);
return data.project;
@@ -82,7 +79,7 @@ export const useUpgradeProject = () => {
},
onSuccess: () => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getAllUserWorkspace()
+ queryKey: projectKeys.getAllUserProjects()
});
}
});
@@ -113,7 +110,7 @@ const fetchUserWorkspaces = async (includeRoles?: boolean, type?: ProjectType |
export const useGetWorkspaceIndexStatus = (projectId: string) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceIndexStatus(projectId),
+ queryKey: projectKeys.getProjectIndexStatus(projectId),
queryFn: () => fetchWorkspaceIndexStatus(projectId),
enabled: true
});
@@ -124,14 +121,14 @@ export const useGetWorkspaceById = (
dto?: { refetchInterval?: number | false }
) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceById(projectId),
- queryFn: () => fetchWorkspaceById(projectId),
+ queryKey: projectKeys.getProjectById(projectId),
+ queryFn: () => fetchProjectById(projectId),
enabled: Boolean(projectId),
refetchInterval: dto?.refetchInterval
});
};
-export const useGetUserWorkspaces = ({
+export const useGetUserProjects = ({
includeRoles,
options = {}
}: {
@@ -139,14 +136,14 @@ export const useGetUserWorkspaces = ({
options?: { enabled?: boolean };
} = {}) =>
useQuery({
- queryKey: projectKeys.getAllUserWorkspace(),
+ queryKey: projectKeys.getAllUserProjects(),
queryFn: () => fetchUserWorkspaces(includeRoles),
...options
});
export const useSearchProjects = ({ options, ...dto }: TSearchProjectsDTO) =>
useQuery({
- queryKey: projectKeys.searchWorkspace(dto),
+ queryKey: projectKeys.searchProject(dto),
queryFn: async () => {
const { data } = await apiRequest.post<{
projects: (Project & { isMember: boolean })[];
@@ -169,7 +166,7 @@ const fetchUserWorkspaceMemberships = async (orgId: string) => {
// to get all userids in an org with the project they are part of
export const useGetUserWorkspaceMemberships = (orgId: string) =>
useQuery({
- queryKey: projectKeys.getWorkspaceMemberships(orgId),
+ queryKey: projectKeys.getProjectMemberships(orgId),
queryFn: () => fetchUserWorkspaceMemberships(orgId),
enabled: Boolean(orgId)
});
@@ -187,7 +184,7 @@ export const useGetWorkspaceAuthorizations = <TData = IntegrationAuth[],>(
select?: (data: IntegrationAuth[]) => TData
) =>
useQuery({
- queryKey: projectKeys.getWorkspaceAuthorization(projectId),
+ queryKey: projectKeys.getProjectAuthorization(projectId),
queryFn: () => fetchWorkspaceAuthorization(projectId),
enabled: Boolean(projectId),
select
@@ -202,7 +199,7 @@ export const fetchWorkspaceIntegrations = async (projectId: string) => {
export const useGetWorkspaceIntegrations = (projectId: string) =>
useQuery({
- queryKey: projectKeys.getWorkspaceIntegrations(projectId),
+ queryKey: projectKeys.getProjectIntegrations(projectId),
queryFn: () => fetchWorkspaceIntegrations(projectId),
enabled: Boolean(projectId),
refetchInterval: 4000
@@ -228,7 +225,7 @@ export const useCreateWorkspace = () => {
}),
onSuccess: () => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getAllUserWorkspace()
+ queryKey: projectKeys.getAllUserProjects()
});
}
});
@@ -239,8 +236,9 @@ export const useUpdateProject = () => {
return useMutation<Project, object, UpdateProjectDTO>({
mutationFn: async ({
- projectID,
+ projectId: projectID,
newProjectName,
+ hasDeleteProtection,
newProjectDescription,
newSlug,
secretSharing,
@@ -259,67 +257,14 @@ export const useUpdateProject = () => {
showSnapshotsLegacy,
secretDetectionIgnoreValues,
autoCapitalization,
- pitVersionLimit
+ pitVersionLimit,
+ hasDeleteProtection
}
);
return data.project;
},
onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserWorkspace() });
- }
- });
-};
-
-export const useToggleAutoCapitalization = () => {
- const queryClient = useQueryClient();
-
- return useMutation<Project, object, ToggleAutoCapitalizationDTO>({
- mutationFn: async ({ projectID, state }) => {
- const { data } = await apiRequest.post<{ project: Project }>(
- `/api/v1/projects/${projectID}/auto-capitalization`,
- {
- autoCapitalization: state
- }
- );
- return data.project;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserWorkspace() });
- }
- });
-};
-
-export const useToggleDeleteProjectProtection = () => {
- const queryClient = useQueryClient();
-
- return useMutation<Project, object, ToggleDeleteProjectProtectionDTO>({
- mutationFn: async ({ projectID, state }) => {
- const { data } = await apiRequest.post<{ project: Project }>(
- `/api/v1/projects/${projectID}/delete-protection`,
- {
- hasDeleteProtection: state
- }
- );
- return data.project;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserWorkspace() });
- }
- });
-};
-
-export const useUpdateWorkspaceVersionLimit = () => {
- const queryClient = useQueryClient();
-
- return useMutation<Project, object, UpdatePitVersionLimitDTO>({
- mutationFn: async ({ projectSlug, pitVersionLimit }) => {
- const { data } = await apiRequest.put(`/api/v1/projects/${projectSlug}/version-limit`, {
- pitVersionLimit
- });
- return data.project;
- },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserWorkspace() });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserProjects() });
}
});
};
@@ -338,7 +283,7 @@ export const useUpdateWorkspaceAuditLogsRetention = () => {
return data.project;
},
onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserWorkspace() });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserProjects() });
}
});
};
@@ -352,7 +297,7 @@ export const useDeleteWorkspace = () => {
return data.project;
},
onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserWorkspace() });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getAllUserProjects() });
queryClient.invalidateQueries({
queryKey: ["org-admin-projects"]
});
@@ -363,9 +308,9 @@ export const useDeleteWorkspace = () => {
export const useCreateWsEnvironment = () => {
const queryClient = useQueryClient();
- return useMutation<WorkspaceEnv, WorkspaceEnv, CreateEnvironmentDTO>({
+ return useMutation<ProjectEnv, ProjectEnv, CreateEnvironmentDTO>({
mutationFn: async ({ projectId, name, slug }) => {
- const { data } = await apiRequest.post<{ environment: WorkspaceEnv }>(
+ const { data } = await apiRequest.post<{ environment: ProjectEnv }>(
`/api/v1/projects/${projectId}/environments`,
{
name,
@@ -376,7 +321,7 @@ export const useCreateWsEnvironment = () => {
},
onSuccess: () => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getAllUserWorkspace()
+ queryKey: projectKeys.getAllUserProjects()
});
}
});
@@ -395,7 +340,7 @@ export const useUpdateWsEnvironment = () => {
},
onSuccess: () => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getAllUserWorkspace()
+ queryKey: projectKeys.getAllUserProjects()
});
}
});
@@ -410,7 +355,7 @@ export const useDeleteWsEnvironment = () => {
},
onSuccess: () => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getAllUserWorkspace()
+ queryKey: projectKeys.getAllUserProjects()
});
}
});
@@ -422,7 +367,7 @@ export const useGetWorkspaceUsers = (
roles?: string[]
) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceUsers(projectId, includeGroupMembers, roles),
+ queryKey: projectKeys.getProjectUsers(projectId, includeGroupMembers, roles),
queryFn: async () => {
const {
data: { users }
@@ -443,7 +388,7 @@ export const useGetWorkspaceUsers = (
export const useGetWorkspaceUserDetails = (projectId: string, membershipId: string) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceUserDetails(projectId, membershipId),
+ queryKey: projectKeys.getProjectUserDetails(projectId, membershipId),
queryFn: async () => {
const {
data: { membership }
@@ -476,7 +421,7 @@ export const useDeleteUserFromWorkspace = () => {
return deletedMembership;
},
onSuccess: (_, { orgId, projectId }) => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getWorkspaceUsers(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectUsers(projectId) });
queryClient.invalidateQueries({
queryKey: userKeys.allOrgMembershipProjectMemberships(orgId)
});
@@ -499,9 +444,9 @@ export const useUpdateUserWorkspaceRole = () => {
return membership;
},
onSuccess: (_, { projectId, membershipId }) => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getWorkspaceUsers(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectUsers(projectId) });
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceUserDetails(projectId, membershipId)
+ queryKey: projectKeys.getProjectUserDetails(projectId, membershipId)
});
}
});
@@ -532,7 +477,7 @@ export const useAddIdentityToWorkspace = () => {
},
onSuccess: (_, { identityId, projectId }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceIdentityMemberships(projectId)
+ queryKey: projectKeys.getProjectIdentityMemberships(projectId)
});
queryClient.invalidateQueries({
queryKey: identitiesKeys.getIdentityProjectMemberships(identityId)
@@ -558,13 +503,13 @@ export const useUpdateIdentityWorkspaceRole = () => {
},
onSuccess: (_, { identityId, projectId }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceIdentityMemberships(projectId)
+ queryKey: projectKeys.getProjectIdentityMemberships(projectId)
});
queryClient.invalidateQueries({
queryKey: identitiesKeys.getIdentityProjectMemberships(identityId)
});
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceIdentityMembershipDetails(projectId, identityId)
+ queryKey: projectKeys.getProjectIdentityMembershipDetails(projectId, identityId)
});
}
});
@@ -583,7 +528,7 @@ export const useDeleteIdentityFromWorkspace = () => {
},
onSuccess: (_, { identityId, projectId }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceIdentityMemberships(projectId)
+ queryKey: projectKeys.getProjectIdentityMemberships(projectId)
});
queryClient.invalidateQueries({
queryKey: identitiesKeys.getIdentityProjectMemberships(identityId)
@@ -606,13 +551,13 @@ export const useGetWorkspaceIdentityMemberships = (
TProjectIdentitiesList,
unknown,
TProjectIdentitiesList,
- ReturnType<typeof projectKeys.getWorkspaceIdentityMembershipsWithParams>
+ ReturnType<typeof projectKeys.getProjectIdentityMembershipsWithParams>
>,
"queryKey" | "queryFn"
>
) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceIdentityMembershipsWithParams({
+ queryKey: projectKeys.getProjectIdentityMembershipsWithParams({
projectId,
offset,
limit,
@@ -643,7 +588,7 @@ export const useGetWorkspaceIdentityMemberships = (
export const useGetWorkspaceIdentityMembershipDetails = (projectId: string, identityId: string) => {
return useQuery({
enabled: Boolean(projectId && identityId),
- queryKey: projectKeys.getWorkspaceIdentityMembershipDetails(projectId, identityId),
+ queryKey: projectKeys.getProjectIdentityMembershipDetails(projectId, identityId),
queryFn: async () => {
const {
data: { identityMembership }
@@ -658,7 +603,7 @@ export const useGetWorkspaceIdentityMembershipDetails = (projectId: string, iden
export const useGetWorkspaceGroupMembershipDetails = (projectId: string, groupId: string) => {
return useQuery({
enabled: Boolean(projectId && groupId),
- queryKey: projectKeys.getWorkspaceGroupMembershipDetails(projectId, groupId),
+ queryKey: projectKeys.getProjectGroupMembershipDetails(projectId, groupId),
queryFn: async () => {
const {
data: { groupMembership }
@@ -672,7 +617,7 @@ export const useGetWorkspaceGroupMembershipDetails = (projectId: string, groupId
export const useListWorkspaceGroups = (projectId: string) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceGroupMemberships(projectId),
+ queryKey: projectKeys.getProjectGroupMemberships(projectId),
queryFn: async () => {
const {
data: { groupMemberships }
@@ -693,7 +638,7 @@ export const useListWorkspaceCas = ({
status?: CaStatus;
}) => {
return useQuery({
- queryKey: projectKeys.specificWorkspaceCas({
+ queryKey: projectKeys.specificProjectCas({
projectId,
status
}),
@@ -726,7 +671,7 @@ export const useListWorkspaceCertificates = ({
limit: number;
}) => {
return useQuery({
- queryKey: projectKeys.specificWorkspaceCertificates({
+ queryKey: projectKeys.specificProjectCertificates({
projectId,
offset,
limit
@@ -754,7 +699,7 @@ export const useListWorkspaceCertificates = ({
export const useListWorkspacePkiAlerts = ({ projectId }: { projectId: string }) => {
return useQuery({
- queryKey: projectKeys.getWorkspacePkiAlerts(projectId),
+ queryKey: projectKeys.getProjectPkiAlerts(projectId),
queryFn: async () => {
const {
data: { alerts }
@@ -768,7 +713,7 @@ export const useListWorkspacePkiAlerts = ({ projectId }: { projectId: string })
export const useListWorkspacePkiCollections = ({ projectId }: { projectId: string }) => {
return useQuery({
- queryKey: projectKeys.getWorkspacePkiCollections(projectId),
+ queryKey: projectKeys.getProjectPkiCollections(projectId),
queryFn: async () => {
const {
data: { collections }
@@ -784,7 +729,7 @@ export const useListWorkspacePkiCollections = ({ projectId }: { projectId: strin
export const useListWorkspaceCertificateTemplates = ({ projectId }: { projectId: string }) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceCertificateTemplates(projectId),
+ queryKey: projectKeys.getProjectCertificateTemplates(projectId),
queryFn: async () => {
const {
data: { certificateTemplates }
@@ -808,7 +753,7 @@ export const useListWorkspaceSshCertificates = ({
projectId: string;
}) => {
return useQuery({
- queryKey: projectKeys.specificWorkspaceSshCertificates({
+ queryKey: projectKeys.specificProjectSshCertificates({
offset,
limit,
projectId
@@ -833,7 +778,7 @@ export const useListWorkspaceSshCertificates = ({
export const useListWorkspaceSshCas = (projectId: string) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceSshCas(projectId),
+ queryKey: projectKeys.getProjectSshCas(projectId),
queryFn: async () => {
const {
data: { cas }
@@ -848,7 +793,7 @@ export const useListWorkspaceSshCas = (projectId: string) => {
export const useListWorkspaceSshHosts = (projectId: string) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceSshHosts(projectId),
+ queryKey: projectKeys.getProjectSshHosts(projectId),
queryFn: async () => {
const {
data: { hosts }
@@ -861,7 +806,7 @@ export const useListWorkspaceSshHosts = (projectId: string) => {
export const useListWorkspacePkiSubscribers = (projectId: string) => {
return useQuery({
- queryKey: projectKeys.getWorkspacePkiSubscribers(projectId),
+ queryKey: projectKeys.getProjectPkiSubscribers(projectId),
queryFn: async () => {
const {
data: { subscribers }
@@ -876,7 +821,7 @@ export const useListWorkspacePkiSubscribers = (projectId: string) => {
export const useListWorkspaceSshHostGroups = (projectId: string) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceSshHostGroups(projectId),
+ queryKey: projectKeys.getProjectSshHostGroups(projectId),
queryFn: async () => {
const {
data: { groups }
@@ -891,7 +836,7 @@ export const useListWorkspaceSshHostGroups = (projectId: string) => {
export const useListWorkspaceSshCertificateTemplates = (projectId: string) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceSshCertificateTemplates(projectId),
+ queryKey: projectKeys.getProjectSshCertificateTemplates(projectId),
queryFn: async () => {
const { data } = await apiRequest.get<{ certificateTemplates: TSshCertificateTemplate[] }>(
`/api/v1/projects/${projectId}/ssh-certificate-templates`
@@ -910,7 +855,7 @@ export const useGetWorkspaceWorkflowIntegrationConfig = ({
integration: WorkflowIntegrationPlatform;
}) => {
return useQuery({
- queryKey: projectKeys.getWorkspaceWorkflowIntegrationConfig(projectId, integration),
+ queryKey: projectKeys.getProjectWorkflowIntegrationConfig(projectId, integration),
queryFn: async () => {
const { data } = await apiRequest
.get<ProjectWorkflowIntegrationConfig>(
diff --git a/frontend/src/hooks/api/projects/query-keys.tsx b/frontend/src/hooks/api/projects/query-keys.tsx
new file mode 100644
index 0000000000..38aa888be3
--- /dev/null
+++ b/frontend/src/hooks/api/projects/query-keys.tsx
@@ -0,0 +1,78 @@
+import { TListProjectIdentitiesDTO, TSearchProjectsDTO } from "./types";
+
+import type { CaStatus } from "../ca";
+import { WorkflowIntegrationPlatform } from "../workflowIntegrations/types";
+
+export const projectKeys = {
+ getProjectById: (projectId: string) => ["projects", { projectId }] as const,
+ getProjectSecrets: (projectId: string) => [{ projectId }, "project-secrets"] as const,
+ getProjectIndexStatus: (projectId: string) => [{ projectId }, "project-index-status"] as const,
+ getProjectUpgradeStatus: (projectId: string) => [{ projectId }, "project-upgrade-status"],
+ getProjectMemberships: (orgId: string) => [{ orgId }, "project-memberships"],
+ getProjectAuthorization: (projectId: string) => [{ projectId }, "project-authorizations"],
+ getProjectIntegrations: (projectId: string) => [{ projectId }, "project-integrations"],
+ getAllUserProjects: () => ["projects"] as const,
+ getProjectAuditLogs: (projectId: string) => [{ projectId }, "project-audit-logs"] as const,
+ getProjectUsers: (
+ projectId: string,
+ includeGroupMembers: boolean = false,
+ roles: string[] = []
+ ) => [{ projectId, includeGroupMembers, roles }, "project-users"] as const,
+ getProjectUserDetails: (projectId: string, membershipId: string) =>
+ [{ projectId, membershipId }, "project-user-details"] as const,
+ getProjectIdentityMemberships: (projectId: string) =>
+ [{ projectId }, "project-identity-memberships"] as const,
+ getProjectIdentityMembershipDetails: (projectId: string, identityId: string) =>
+ [{ projectId, identityId }, "project-identity-membership-details"] as const,
+ // allows invalidation using above key without knowing params
+ getProjectIdentityMembershipsWithParams: ({ projectId, ...params }: TListProjectIdentitiesDTO) =>
+ [...projectKeys.getProjectIdentityMemberships(projectId), params] as const,
+ searchProject: (dto: TSearchProjectsDTO) => ["search-projects", dto] as const,
+ getProjectGroupMemberships: (projectId: string) => [{ projectId }, "project-groups"] as const,
+ getProjectGroupMembershipDetails: (projectId: string, groupId: string) =>
+ [{ projectId, groupId }, "project-group-membership-details"] as const,
+ getProjectCas: ({ projectId }: { projectId: string }) => [{ projectId }, "project-cas"] as const,
+ specificProjectCas: ({ projectId, status }: { projectId: string; status?: CaStatus }) =>
+ [...projectKeys.getProjectCas({ projectId }), { status }] as const,
+ allProjectCertificates: () => ["project-certificates"] as const,
+ forProjectCertificates: (projectId: string) =>
+ [...projectKeys.allProjectCertificates(), projectId] as const,
+ specificProjectCertificates: ({
+ projectId,
+ offset,
+ limit
+ }: {
+ projectId: string;
+ offset: number;
+ limit: number;
+ }) => [...projectKeys.forProjectCertificates(projectId), { offset, limit }] as const,
+ getProjectPkiAlerts: (projectId: string) => [{ projectId }, "project-pki-alerts"] as const,
+ getProjectPkiSubscribers: (projectId: string) =>
+ [{ projectId }, "project-pki-subscribers"] as const,
+ getProjectPkiCollections: (projectId: string) =>
+ [{ projectId }, "project-pki-collections"] as const,
+ getProjectCertificateTemplates: (projectId: string) =>
+ [{ projectId }, "project-certificate-templates"] as const,
+ getProjectWorkflowIntegrationConfig: (
+ projectId: string,
+ integration: WorkflowIntegrationPlatform
+ ) => [{ projectId, integration }, "project-workflow-integration-config"] as const,
+ getProjectSshCas: (projectId: string) => [{ projectId }, "project-ssh-cas"] as const,
+ allProjectSshCertificates: (projectId: string) =>
+ [{ projectId }, "project-ssh-certificates"] as const,
+ getProjectSshHosts: (projectId: string) => [{ projectId }, "project-ssh-hosts"] as const,
+ getProjectSshHostGroups: (projectId: string) =>
+ [{ projectId }, "project-ssh-host-groups"] as const,
+ specificProjectSshCertificates: ({
+ offset,
+ limit,
+ projectId
+ }: {
+ offset: number;
+ limit: number;
+ projectId: string;
+ }) => [...projectKeys.allProjectSshCertificates(projectId), { offset, limit }] as const,
+ getProjectSshCertificateTemplates: (projectId: string) =>
+ [{ projectId }, "project-ssh-certificate-templates"] as const,
+ getProjectSshConfig: (projectId: string) => [{ projectId }, "project-ssh-config"] as const
+};
diff --git a/frontend/src/hooks/api/workspace/types.ts b/frontend/src/hooks/api/projects/types.ts
similarity index 96%
rename from frontend/src/hooks/api/workspace/types.ts
rename to frontend/src/hooks/api/projects/types.ts
index 7c8da4d4b5..5901a0116e 100644
--- a/frontend/src/hooks/api/workspace/types.ts
+++ b/frontend/src/hooks/api/projects/types.ts
@@ -31,7 +31,7 @@ export type Project = {
upgradeStatus: string | null;
updatedAt: string;
autoCapitalization: boolean;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
pitVersionLimit: number;
auditLogsRetentionDays: number;
slug: string;
@@ -43,13 +43,13 @@ export type Project = {
secretDetectionIgnoreValues: string[];
};
-export type WorkspaceEnv = {
+export type ProjectEnv = {
id: string;
name: string;
slug: string;
};
-export type WorkspaceTag = { id: string; name: string; slug: string };
+export type ProjectTag = { id: string; name: string; slug: string };
export type NameWorkspaceSecretsDTO = {
projectId: string;
@@ -76,7 +76,7 @@ export type CreateWorkspaceDTO = {
};
export type UpdateProjectDTO = {
- projectID: string;
+ projectId: string;
newProjectName?: string;
newProjectDescription?: string;
newSlug?: string;
@@ -85,6 +85,7 @@ export type UpdateProjectDTO = {
secretDetectionIgnoreValues?: string[];
pitVersionLimit?: number;
autoCapitalization?: boolean;
+ hasDeleteProtection?: boolean;
};
export type UpdatePitVersionLimitDTO = { projectSlug: string; pitVersionLimit: number };
diff --git a/frontend/src/hooks/api/secretApproval/types.ts b/frontend/src/hooks/api/secretApproval/types.ts
index 6b4aeba63b..ac912c401b 100644
--- a/frontend/src/hooks/api/secretApproval/types.ts
+++ b/frontend/src/hooks/api/secretApproval/types.ts
@@ -1,11 +1,11 @@
import { EnforcementLevel } from "../policies/enums";
-import { WorkspaceEnv } from "../workspace/types";
+import { ProjectEnv } from "../projects/types";
export type TSecretApprovalPolicy = {
id: string;
project: string;
name: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
secretPath?: string;
approvals: number;
approvers: Approver[];
diff --git a/frontend/src/hooks/api/secretFolders/types.ts b/frontend/src/hooks/api/secretFolders/types.ts
index dc9bce70f6..5772fb1baa 100644
--- a/frontend/src/hooks/api/secretFolders/types.ts
+++ b/frontend/src/hooks/api/secretFolders/types.ts
@@ -1,4 +1,4 @@
-import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { ProjectEnv } from "@app/hooks/api/projects/types";
export enum ReservedFolders {
SecretReplication = "__reserve_replication_"
@@ -22,7 +22,7 @@ export type TSecretFolder = {
export type TSecretFolderWithPath = TSecretFolder & { path: string };
export type TProjectEnvironmentsFolders = {
- [key: string]: WorkspaceEnv & { folders: TSecretFolderWithPath[] };
+ [key: string]: ProjectEnv & { folders: TSecretFolderWithPath[] };
};
export type TGetProjectFoldersDTO = {
diff --git a/frontend/src/hooks/api/secretImports/types.ts b/frontend/src/hooks/api/secretImports/types.ts
index d950c2ca26..a64bf5af0a 100644
--- a/frontend/src/hooks/api/secretImports/types.ts
+++ b/frontend/src/hooks/api/secretImports/types.ts
@@ -1,11 +1,11 @@
import { SecretV3Raw } from "../secrets/types";
-import { WorkspaceEnv } from "../workspace/types";
+import { ProjectEnv } from "../projects/types";
export type TSecretImport = {
id: string;
folderId: string;
importPath: string;
- importEnv: WorkspaceEnv;
+ importEnv: ProjectEnv;
position: string;
createdAt: string;
updatedAt: string;
@@ -25,7 +25,7 @@ export type TGetImportedFoldersByEnvDTO = {
export type TImportedSecrets = {
environment: string;
- environmentInfo: WorkspaceEnv;
+ environmentInfo: ProjectEnv;
secretPath: string;
folderId: string;
secrets: SecretV3Raw[];
diff --git a/frontend/src/hooks/api/secretRotation/types.ts b/frontend/src/hooks/api/secretRotation/types.ts
index 19c4cdcdf4..c5f939c5c6 100644
--- a/frontend/src/hooks/api/secretRotation/types.ts
+++ b/frontend/src/hooks/api/secretRotation/types.ts
@@ -1,4 +1,4 @@
-import { WorkspaceEnv } from "../workspace/types";
+import { ProjectEnv } from "../projects/types";
export enum TProviderFunctionTypes {
HTTP = "http",
@@ -80,7 +80,7 @@ export type TSecretRotation = {
customProvider: string;
workspace: string;
envId: string;
- environment: WorkspaceEnv;
+ environment: ProjectEnv;
secretPath: string;
outputs: Array<{
key: string;
diff --git a/frontend/src/hooks/api/secretSnapshots/types.ts b/frontend/src/hooks/api/secretSnapshots/types.ts
index 82c04253b7..9b1f954805 100644
--- a/frontend/src/hooks/api/secretSnapshots/types.ts
+++ b/frontend/src/hooks/api/secretSnapshots/types.ts
@@ -1,5 +1,5 @@
import { SecretVersions } from "../secrets/types";
-import { WorkspaceEnv } from "../types";
+import { ProjectEnv } from "../types";
export type TSecretSnapshot = {
id: string;
@@ -13,7 +13,7 @@ export type TSnapshotData = Omit<TSecretSnapshot, "secretVersions"> & {
id: string;
secretVersions: (SecretVersions & { isRotatedSecret?: boolean })[];
folderVersion: Array<{ name: string; id: string }>;
- environment: WorkspaceEnv;
+ environment: ProjectEnv;
};
export type TSnapshotDataProps = {
diff --git a/frontend/src/hooks/api/secrets/mutations.tsx b/frontend/src/hooks/api/secrets/mutations.tsx
index 0dfc5db25f..cfd2dc9219 100644
--- a/frontend/src/hooks/api/secrets/mutations.tsx
+++ b/frontend/src/hooks/api/secrets/mutations.tsx
@@ -333,11 +333,11 @@ export const useMoveSecrets = ({
mutationFn: async ({
sourceEnvironment,
sourceSecretPath,
- projectSlug,
destinationEnvironment,
destinationSecretPath,
secretIds,
- shouldOverwrite
+ shouldOverwrite,
+ projectId
}) => {
const { data } = await apiRequest.post<{
isSourceUpdated: boolean;
@@ -345,11 +345,11 @@ export const useMoveSecrets = ({
}>("/api/v4/secrets/move", {
sourceEnvironment,
sourceSecretPath,
- projectSlug,
destinationEnvironment,
destinationSecretPath,
secretIds,
- shouldOverwrite
+ shouldOverwrite,
+ projectId
});
return data;
diff --git a/frontend/src/hooks/api/secrets/types.ts b/frontend/src/hooks/api/secrets/types.ts
index 95855992a4..327d3659dc 100644
--- a/frontend/src/hooks/api/secrets/types.ts
+++ b/frontend/src/hooks/api/secrets/types.ts
@@ -227,7 +227,6 @@ export type TDeleteSecretBatchDTO = {
};
export type TMoveSecretsDTO = {
- projectSlug: string;
projectId: string;
sourceEnvironment: string;
sourceSecretPath: string;
diff --git a/frontend/src/hooks/api/sshCa/mutations.tsx b/frontend/src/hooks/api/sshCa/mutations.tsx
index 11d7fa8f55..fc6c43ef40 100644
--- a/frontend/src/hooks/api/sshCa/mutations.tsx
+++ b/frontend/src/hooks/api/sshCa/mutations.tsx
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { projectKeys } from "../workspace/query-keys";
+import { projectKeys } from "../projects/query-keys";
import {
TCreateSshCaDTO,
TDeleteSshCaDTO,
@@ -28,7 +28,7 @@ export const useCreateSshCa = () => {
return ca;
},
onSuccess: ({ projectId }) => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getWorkspaceSshCas(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectSshCas(projectId) });
}
});
};
@@ -43,7 +43,7 @@ export const useUpdateSshCa = () => {
return ca;
},
onSuccess: ({ projectId }, { caId }) => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getWorkspaceSshCas(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectSshCas(projectId) });
queryClient.invalidateQueries({ queryKey: sshCaKeys.getSshCaById(caId) });
}
});
@@ -59,7 +59,7 @@ export const useDeleteSshCa = () => {
return ca;
},
onSuccess: ({ projectId }) => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getWorkspaceSshCas(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectSshCas(projectId) });
}
});
};
@@ -76,7 +76,7 @@ export const useSignSshKey = () => {
},
onSuccess: (_, { projectId }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.allWorkspaceSshCertificates(projectId)
+ queryKey: projectKeys.allProjectSshCertificates(projectId)
});
}
});
@@ -94,7 +94,7 @@ export const useIssueSshCreds = () => {
},
onSuccess: (_, { projectId }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.allWorkspaceSshCertificates(projectId)
+ queryKey: projectKeys.allProjectSshCertificates(projectId)
});
}
});
diff --git a/frontend/src/hooks/api/sshHost/mutations.tsx b/frontend/src/hooks/api/sshHost/mutations.tsx
index 0ebfd087e6..0c1b67103a 100644
--- a/frontend/src/hooks/api/sshHost/mutations.tsx
+++ b/frontend/src/hooks/api/sshHost/mutations.tsx
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { projectKeys } from "../workspace/query-keys";
+import { projectKeys } from "../projects/query-keys";
import { TCreateSshHostDTO, TDeleteSshHostDTO, TSshHost, TUpdateSshHostDTO } from "./types";
export const useCreateSshHost = () => {
@@ -13,7 +13,7 @@ export const useCreateSshHost = () => {
return host;
},
onSuccess: ({ projectId }) => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getWorkspaceSshHosts(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectSshHosts(projectId) });
}
});
};
@@ -26,7 +26,7 @@ export const useUpdateSshHost = () => {
return host;
},
onSuccess: ({ projectId }) => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getWorkspaceSshHosts(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectSshHosts(projectId) });
}
});
};
@@ -39,7 +39,7 @@ export const useDeleteSshHost = () => {
return host;
},
onSuccess: ({ projectId }) => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getWorkspaceSshHosts(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectSshHosts(projectId) });
}
});
};
diff --git a/frontend/src/hooks/api/sshHostGroup/mutations.tsx b/frontend/src/hooks/api/sshHostGroup/mutations.tsx
index b06089809d..fa9eebb07e 100644
--- a/frontend/src/hooks/api/sshHostGroup/mutations.tsx
+++ b/frontend/src/hooks/api/sshHostGroup/mutations.tsx
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { projectKeys } from "../workspace/query-keys";
+import { projectKeys } from "../projects/query-keys";
import { sshHostGroupKeys } from "./queries";
import {
TCreateSshHostGroupDTO,
@@ -20,7 +20,7 @@ export const useCreateSshHostGroup = () => {
},
onSuccess: ({ projectId, id }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceSshHostGroups(projectId)
+ queryKey: projectKeys.getProjectSshHostGroups(projectId)
});
queryClient.invalidateQueries({
queryKey: sshHostGroupKeys.getSshHostGroupById(id)
@@ -41,10 +41,10 @@ export const useUpdateSshHostGroup = () => {
},
onSuccess: ({ projectId }, { sshHostGroupId }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceSshHostGroups(projectId)
+ queryKey: projectKeys.getProjectSshHostGroups(projectId)
});
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceSshHosts(projectId)
+ queryKey: projectKeys.getProjectSshHosts(projectId)
});
queryClient.invalidateQueries({
queryKey: sshHostGroupKeys.getSshHostGroupById(sshHostGroupId)
@@ -64,10 +64,10 @@ export const useDeleteSshHostGroup = () => {
},
onSuccess: ({ projectId }, { sshHostGroupId }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceSshHostGroups(projectId)
+ queryKey: projectKeys.getProjectSshHostGroups(projectId)
});
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceSshHosts(projectId)
+ queryKey: projectKeys.getProjectSshHosts(projectId)
});
queryClient.invalidateQueries({
queryKey: sshHostGroupKeys.getSshHostGroupById(sshHostGroupId)
diff --git a/frontend/src/hooks/api/tags/queries.tsx b/frontend/src/hooks/api/tags/queries.tsx
index 0bd4b09a9d..1ef75554d4 100644
--- a/frontend/src/hooks/api/tags/queries.tsx
+++ b/frontend/src/hooks/api/tags/queries.tsx
@@ -28,7 +28,7 @@ export const useCreateWsTag = () => {
const queryClient = useQueryClient();
return useMutation<WsTag, object, CreateTagDTO>({
- mutationFn: async ({ projectID, tagColor, tagSlug }) => {
+ mutationFn: async ({ projectId: projectID, tagColor, tagSlug }) => {
const { data } = await apiRequest.post<{ projectTag: WsTag }>(
`/api/v1/projects/${projectID}/tags`,
{
diff --git a/frontend/src/hooks/api/tags/types.ts b/frontend/src/hooks/api/tags/types.ts
index c0994b92c7..09ac221473 100644
--- a/frontend/src/hooks/api/tags/types.ts
+++ b/frontend/src/hooks/api/tags/types.ts
@@ -13,7 +13,7 @@ export type WsTag = {
export type WorkspaceTag = { id: string; name: string; slug: string };
export type CreateTagDTO = {
- projectID: string;
+ projectId: string;
tagSlug: string;
tagColor: string;
};
diff --git a/frontend/src/hooks/api/types.ts b/frontend/src/hooks/api/types.ts
index 99c991c358..deae94ff6e 100644
--- a/frontend/src/hooks/api/types.ts
+++ b/frontend/src/hooks/api/types.ts
@@ -36,10 +36,10 @@ export type {
ToggleAutoCapitalizationDTO,
UpdateEnvironmentDTO,
UpdateProjectDTO,
- Project as Workspace,
- WorkspaceEnv,
- WorkspaceTag
-} from "./workspace/types";
+ Project,
+ ProjectEnv,
+ ProjectTag
+} from "./projects/types";
export enum ApiErrorTypes {
ValidationError = "ValidationFailure",
diff --git a/frontend/src/hooks/api/users/mutation.tsx b/frontend/src/hooks/api/users/mutation.tsx
index adc37fd42d..7acfb8fe08 100644
--- a/frontend/src/hooks/api/users/mutation.tsx
+++ b/frontend/src/hooks/api/users/mutation.tsx
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { projectKeys } from "../workspace";
+import { projectKeys } from "../projects";
import { userKeys } from "./query-keys";
import { AddUserToWsDTONonE2EE } from "./types";
@@ -18,7 +18,7 @@ export const useAddUserToWsNonE2EE = () => {
return data;
},
onSuccess: (_, { orgId, projectId }) => {
- queryClient.invalidateQueries({ queryKey: projectKeys.getWorkspaceUsers(projectId) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectUsers(projectId) });
queryClient.invalidateQueries({
queryKey: userKeys.allOrgMembershipProjectMemberships(orgId)
});
diff --git a/frontend/src/hooks/api/users/queries.tsx b/frontend/src/hooks/api/users/queries.tsx
index 77289fee64..a2f86d6d30 100644
--- a/frontend/src/hooks/api/users/queries.tsx
+++ b/frontend/src/hooks/api/users/queries.tsx
@@ -10,7 +10,7 @@ import { MfaMethod } from "../auth/types";
import { TGroupWithProjectMemberships } from "../groups/types";
import { setAuthToken } from "../reactQuery";
import { subscriptionQueryKeys } from "../subscriptions/queries";
-import { workspaceKeys } from "../workspace";
+import { projectKeys } from "../projects";
import { userKeys } from "./query-keys";
import {
AddUserToOrgDTO,
@@ -197,10 +197,10 @@ export const useAddUsersToOrg = () => {
projects?.forEach((project) => {
if (project.slug) {
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getWorkspaceGroupMemberships(project.slug)
+ queryKey: projectKeys.getProjectGroupMemberships(project.slug)
});
}
- queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceUsers(project.id) });
+ queryClient.invalidateQueries({ queryKey: projectKeys.getProjectUsers(project.id) });
});
}
});
diff --git a/frontend/src/hooks/api/users/types.ts b/frontend/src/hooks/api/users/types.ts
index 5a90d4b646..a59965dfc0 100644
--- a/frontend/src/hooks/api/users/types.ts
+++ b/frontend/src/hooks/api/users/types.ts
@@ -1,5 +1,5 @@
import { MfaMethod } from "../auth/types";
-import { ProjectType, ProjectUserMembershipTemporaryMode } from "../workspace/types";
+import { ProjectType, ProjectUserMembershipTemporaryMode } from "../projects/types";
export enum AuthMethod {
EMAIL = "email",
diff --git a/frontend/src/hooks/api/workflowIntegrations/mutation.tsx b/frontend/src/hooks/api/workflowIntegrations/mutation.tsx
index 1a3927eff6..d362c7b826 100644
--- a/frontend/src/hooks/api/workflowIntegrations/mutation.tsx
+++ b/frontend/src/hooks/api/workflowIntegrations/mutation.tsx
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { projectKeys } from "../workspace/query-keys";
+import { projectKeys } from "../projects/query-keys";
import { workflowIntegrationKeys } from "./queries";
import {
TCheckMicrosoftTeamsIntegrationInstallationStatusDTO,
@@ -126,7 +126,7 @@ export const useUpdateProjectWorkflowIntegrationConfig = () => {
},
onSuccess: (_, { projectId: workspaceId, integration }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceWorkflowIntegrationConfig(workspaceId, integration)
+ queryKey: projectKeys.getProjectWorkflowIntegrationConfig(workspaceId, integration)
});
}
});
@@ -145,7 +145,7 @@ export const useDeleteProjectWorkflowIntegration = () => {
},
onSuccess: (_, { projectId, integration }) => {
queryClient.invalidateQueries({
- queryKey: projectKeys.getWorkspaceWorkflowIntegrationConfig(projectId, integration)
+ queryKey: projectKeys.getProjectWorkflowIntegrationConfig(projectId, integration)
});
}
});
diff --git a/frontend/src/hooks/api/workspace/query-keys.tsx b/frontend/src/hooks/api/workspace/query-keys.tsx
deleted file mode 100644
index fe17dc68dc..0000000000
--- a/frontend/src/hooks/api/workspace/query-keys.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-import { TListProjectIdentitiesDTO, TSearchProjectsDTO } from "@app/hooks/api/workspace/types";
-
-import type { CaStatus } from "../ca";
-import { WorkflowIntegrationPlatform } from "../workflowIntegrations/types";
-
-export const projectKeys = {
- getWorkspaceById: (projectId: string) => ["projects", { projectId }] as const,
- getWorkspaceSecrets: (projectId: string) => [{ projectId }, "project-secrets"] as const,
- getWorkspaceIndexStatus: (projectId: string) => [{ projectId }, "project-index-status"] as const,
- getProjectUpgradeStatus: (projectId: string) => [{ projectId }, "project-upgrade-status"],
- getWorkspaceMemberships: (orgId: string) => [{ orgId }, "project-memberships"],
- getWorkspaceAuthorization: (projectId: string) => [{ projectId }, "project-authorizations"],
- getWorkspaceIntegrations: (projectId: string) => [{ projectId }, "project-integrations"],
- getAllUserWorkspace: () => ["projects"] as const,
- getWorkspaceAuditLogs: (projectId: string) => [{ projectId }, "project-audit-logs"] as const,
- getWorkspaceUsers: (
- projectId: string,
- includeGroupMembers: boolean = false,
- roles: string[] = []
- ) => [{ projectId, includeGroupMembers, roles }, "project-users"] as const,
- getWorkspaceUserDetails: (projectId: string, membershipId: string) =>
- [{ projectId, membershipId }, "project-user-details"] as const,
- getWorkspaceIdentityMemberships: (projectId: string) =>
- [{ projectId }, "project-identity-memberships"] as const,
- getWorkspaceIdentityMembershipDetails: (projectId: string, identityId: string) =>
- [{ projectId, identityId }, "project-identity-membership-details"] as const,
- // allows invalidation using above key without knowing params
- getWorkspaceIdentityMembershipsWithParams: ({
- projectId,
- ...params
- }: TListProjectIdentitiesDTO) =>
- [...projectKeys.getWorkspaceIdentityMemberships(projectId), params] as const,
- searchWorkspace: (dto: TSearchProjectsDTO) => ["search-projects", dto] as const,
- getWorkspaceGroupMemberships: (projectId: string) => [{ projectId }, "project-groups"] as const,
- getWorkspaceGroupMembershipDetails: (projectId: string, groupId: string) =>
- [{ projectId, groupId }, "project-group-membership-details"] as const,
- getWorkspaceCas: ({ projectId }: { projectId: string }) =>
- [{ projectId }, "project-cas"] as const,
- specificWorkspaceCas: ({ projectId, status }: { projectId: string; status?: CaStatus }) =>
- [...projectKeys.getWorkspaceCas({ projectId }), { status }] as const,
- allWorkspaceCertificates: () => ["project-certificates"] as const,
- forWorkspaceCertificates: (projectId: string) =>
- [...projectKeys.allWorkspaceCertificates(), projectId] as const,
- specificWorkspaceCertificates: ({
- projectId,
- offset,
- limit
- }: {
- projectId: string;
- offset: number;
- limit: number;
- }) => [...projectKeys.forWorkspaceCertificates(projectId), { offset, limit }] as const,
- getWorkspacePkiAlerts: (projectId: string) => [{ projectId }, "project-pki-alerts"] as const,
- getWorkspacePkiSubscribers: (projectId: string) =>
- [{ projectId }, "project-pki-subscribers"] as const,
- getWorkspacePkiCollections: (projectId: string) =>
- [{ projectId }, "project-pki-collections"] as const,
- getWorkspaceCertificateTemplates: (projectId: string) =>
- [{ projectId }, "project-certificate-templates"] as const,
- getWorkspaceWorkflowIntegrationConfig: (
- projectId: string,
- integration: WorkflowIntegrationPlatform
- ) => [{ projectId, integration }, "project-workflow-integration-config"] as const,
- getWorkspaceSshCas: (projectId: string) => [{ projectId }, "project-ssh-cas"] as const,
- allWorkspaceSshCertificates: (projectId: string) =>
- [{ projectId }, "project-ssh-certificates"] as const,
- getWorkspaceSshHosts: (projectId: string) => [{ projectId }, "project-ssh-hosts"] as const,
- getWorkspaceSshHostGroups: (projectId: string) =>
- [{ projectId }, "project-ssh-host-groups"] as const,
- specificWorkspaceSshCertificates: ({
- offset,
- limit,
- projectId
- }: {
- offset: number;
- limit: number;
- projectId: string;
- }) => [...projectKeys.allWorkspaceSshCertificates(projectId), { offset, limit }] as const,
- getWorkspaceSshCertificateTemplates: (projectId: string) =>
- [{ projectId }, "project-ssh-certificate-templates"] as const,
- getProjectSshConfig: (projectId: string) => [{ projectId }, "project-ssh-config"] as const
-};
diff --git a/frontend/src/hooks/useGetProjectTypeFromRoute.tsx b/frontend/src/hooks/useGetProjectTypeFromRoute.tsx
index 3156216dbf..972671a96d 100644
--- a/frontend/src/hooks/useGetProjectTypeFromRoute.tsx
+++ b/frontend/src/hooks/useGetProjectTypeFromRoute.tsx
@@ -1,7 +1,7 @@
import { useMemo } from "react";
import { useRouterState } from "@tanstack/react-router";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
export const useGetProjectTypeFromRoute = () => {
const { location } = useRouterState();
diff --git a/frontend/src/hooks/usePathAccessPolicies.tsx b/frontend/src/hooks/usePathAccessPolicies.tsx
index 1fbc5fd520..82fc50bc33 100644
--- a/frontend/src/hooks/usePathAccessPolicies.tsx
+++ b/frontend/src/hooks/usePathAccessPolicies.tsx
@@ -1,6 +1,6 @@
import { useMemo } from "react";
-import { useSubscription, useWorkspace } from "@app/context";
+import { useSubscription, useProject } from "@app/context";
import { useGetAccessApprovalPolicies } from "@app/hooks/api";
const matchesPath = (folderPath: string, pattern: string) => {
@@ -37,10 +37,10 @@ type Params = {
};
export const usePathAccessPolicies = ({ secretPath, environment }: Params) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { subscription } = useSubscription();
const { data: policies } = useGetAccessApprovalPolicies({
- projectSlug: currentWorkspace.slug,
+ projectSlug: currentProject.slug,
options: {
enabled: subscription.secretApproval
}
diff --git a/frontend/src/layouts/KmsLayout/KmsLayout.tsx b/frontend/src/layouts/KmsLayout/KmsLayout.tsx
index c34bc3626e..953e2c3db8 100644
--- a/frontend/src/layouts/KmsLayout/KmsLayout.tsx
+++ b/frontend/src/layouts/KmsLayout/KmsLayout.tsx
@@ -4,12 +4,12 @@ import { Link, Outlet } from "@tanstack/react-router";
import { motion } from "framer-motion";
import { Lottie, Menu, MenuGroup, MenuItem } from "@app/components/v2";
-import { useProjectPermission, useWorkspace } from "@app/context";
+import { useProjectPermission, useProject } from "@app/context";
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const KmsLayout = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
return (
@@ -34,7 +34,7 @@ export const KmsLayout = () => {
<Link
to="/projects/kms/$projectId/overview"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -51,7 +51,7 @@ export const KmsLayout = () => {
<Link
to="/projects/kms/$projectId/kmip"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -70,7 +70,7 @@ export const KmsLayout = () => {
<Link
to="/projects/kms/$projectId/access-management"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -87,7 +87,7 @@ export const KmsLayout = () => {
<Link
to="/projects/kms/$projectId/audit-logs"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -104,7 +104,7 @@ export const KmsLayout = () => {
<Link
to="/projects/kms/$projectId/settings"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx
index e9bb6a902a..2f339a870a 100644
--- a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx
@@ -40,7 +40,7 @@ import { envConfig } from "@app/config/env";
import { useOrganization, useSubscription, useUser } from "@app/context";
import { isInfisicalCloud } from "@app/helpers/platform";
import { useToggle } from "@app/hooks";
-import { useGetOrganizations, useLogoutUser, workspaceKeys } from "@app/hooks/api";
+import { useGetOrganizations, useLogoutUser, projectKeys } from "@app/hooks/api";
import { authKeys, selectOrganization } from "@app/hooks/api/auth/queries";
import { MfaMethod } from "@app/hooks/api/auth/types";
import { getAuthToken } from "@app/hooks/api/reactQuery";
@@ -135,7 +135,7 @@ export const Navbar = () => {
const handleOrgChange = async (orgId: string) => {
queryClient.removeQueries({ queryKey: authKeys.getAuthToken });
- queryClient.removeQueries({ queryKey: workspaceKeys.getAllUserWorkspace() });
+ queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() });
const { token, isMfaEnabled, mfaMethod } = await selectOrganization({
organizationId: orgId
diff --git a/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx b/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
index da9b5acdf2..682f4a6ef1 100644
--- a/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
+++ b/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
@@ -16,12 +16,12 @@ import { Link, Outlet } from "@tanstack/react-router";
import { motion } from "framer-motion";
import { Lottie, Menu, MenuGroup, MenuItem } from "@app/components/v2";
-import { useProjectPermission, useWorkspace } from "@app/context";
+import { useProjectPermission, useProject } from "@app/context";
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const PkiManagerLayout = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
const { t } = useTranslation();
@@ -48,7 +48,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/subscribers"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -65,7 +65,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/certificate-templates"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -82,7 +82,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/certificates"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -99,7 +99,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/certificate-authorities"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -116,7 +116,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/alerting"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -135,7 +135,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/access-management"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -152,7 +152,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/audit-logs"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -169,7 +169,7 @@ export const PkiManagerLayout = () => {
<Link
to="/projects/cert-management/$projectId/settings"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
diff --git a/frontend/src/layouts/ProjectLayout/components/AssumePrivilegeModeBanner/AssumePrivilegeModeBanner.tsx b/frontend/src/layouts/ProjectLayout/components/AssumePrivilegeModeBanner/AssumePrivilegeModeBanner.tsx
index 995083ee7f..84a1083752 100644
--- a/frontend/src/layouts/ProjectLayout/components/AssumePrivilegeModeBanner/AssumePrivilegeModeBanner.tsx
+++ b/frontend/src/layouts/ProjectLayout/components/AssumePrivilegeModeBanner/AssumePrivilegeModeBanner.tsx
@@ -2,13 +2,13 @@ import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Button } from "@app/components/v2";
-import { useProjectPermission, useWorkspace } from "@app/context";
+import { useProjectPermission, useProject } from "@app/context";
import { getProjectHomePage } from "@app/helpers/project";
import { useRemoveAssumeProjectPrivilege } from "@app/hooks/api";
import { ActorType } from "@app/hooks/api/auditLogs/enums";
export const AssumePrivilegeModeBanner = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const exitAssumePrivilegeMode = useRemoveAssumeProjectPrivilege();
const { assumedPrivilegeDetails } = useProjectPermission();
@@ -32,15 +32,12 @@ export const AssumePrivilegeModeBanner = () => {
onClick={() => {
exitAssumePrivilegeMode.mutate(
{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
{
onSuccess: () => {
- const url = getProjectHomePage(
- currentWorkspace.type,
- currentWorkspace.environments
- );
- window.location.href = url.replace("$projectId", currentWorkspace.id);
+ const url = getProjectHomePage(currentProject.type, currentProject.environments);
+ window.location.href = url.replace("$projectId", currentProject.id);
}
}
);
diff --git a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx
index f566ab6ef7..e80df4a6ac 100644
--- a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx
+++ b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx
@@ -29,20 +29,20 @@ import {
OrgPermissionSubjects,
useOrganization,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { getProjectHomePage } from "@app/helpers/project";
import { usePopUp } from "@app/hooks";
-import { useGetUserWorkspaces } from "@app/hooks/api";
+import { useGetUserProjects } from "@app/hooks/api";
import { useUpdateUserProjectFavorites } from "@app/hooks/api/users/mutation";
import { useGetUserProjectFavorites } from "@app/hooks/api/users/queries";
-import { Project } from "@app/hooks/api/workspace/types";
+import { Project } from "@app/hooks/api/projects/types";
export const ProjectSelect = () => {
const [searchProject, setSearchProject] = useState("");
- const { currentWorkspace } = useWorkspace();
+ const { currentProject: currentWorkspace } = useProject();
const { currentOrg } = useOrganization();
- const { data: workspaces = [] } = useGetUserWorkspaces();
+ const { data: projects = [] } = useGetUserProjects();
const { data: projectFavorites } = useGetUserProjectFavorites(currentOrg.id);
const { subscription } = useSubscription();
@@ -86,8 +86,8 @@ export const ProjectSelect = () => {
"upgradePlan"
] as const);
- const projects = useMemo(() => {
- const projectOptions = workspaces
+ const projectsSortedByFav = useMemo(() => {
+ const projectOptions = projects
.map((w): Project & { isFavorite: boolean } => ({
...w,
isFavorite: Boolean(projectFavorites?.includes(w.id))
@@ -95,7 +95,7 @@ export const ProjectSelect = () => {
.sort((a, b) => Number(b.isFavorite) - Number(a.isFavorite));
return projectOptions;
- }, [workspaces, projectFavorites, currentWorkspace]);
+ }, [projects, projectFavorites, currentWorkspace]);
return (
<div className="-mr-2 flex w-full items-center gap-1">
@@ -147,7 +147,7 @@ export const ProjectSelect = () => {
/>
</div>
<div className="thin-scrollbar max-h-80 overflow-auto">
- {projects
+ {projectsSortedByFav
?.filter((el) => el.name?.toLowerCase().includes(searchProject.toLowerCase()))
?.map((workspace) => {
return (
diff --git a/frontend/src/layouts/SecretManagerLayout/SecretManagerLayout.tsx b/frontend/src/layouts/SecretManagerLayout/SecretManagerLayout.tsx
index 0584e8e9c5..06e5970791 100644
--- a/frontend/src/layouts/SecretManagerLayout/SecretManagerLayout.tsx
+++ b/frontend/src/layouts/SecretManagerLayout/SecretManagerLayout.tsx
@@ -15,7 +15,7 @@ import { Link, Outlet, useLocation } from "@tanstack/react-router";
import { motion } from "framer-motion";
import { Badge, Lottie, Menu, MenuGroup, MenuItem } from "@app/components/v2";
-import { useProjectPermission, useWorkspace } from "@app/context";
+import { useProjectPermission, useProject } from "@app/context";
import {
useGetAccessRequestsCount,
useGetSecretApprovalRequestCount,
@@ -25,16 +25,15 @@ import {
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const SecretManagerLayout = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject, projectId } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
const { t } = useTranslation();
- const workspaceId = currentWorkspace?.id || "";
- const projectSlug = currentWorkspace?.slug || "";
+ const projectSlug = currentProject?.slug || "";
const location = useLocation();
const { data: secretApprovalReqCount } = useGetSecretApprovalRequestCount({
- workspaceId
+ projectId
});
const { data: accessApprovalRequestCount } = useGetAccessRequestsCount({
projectSlug
@@ -42,7 +41,7 @@ export const SecretManagerLayout = () => {
// we only show the secret rotations v1 tab if they have existing rotations
const { data: secretRotations } = useGetSecretRotations({
- workspaceId,
+ workspaceId: projectId,
options: {
refetchOnMount: false
}
@@ -74,9 +73,9 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/overview"
params={{
- projectId: currentWorkspace.id,
- ...(currentWorkspace.environments.length
- ? { envSlug: currentWorkspace.environments[0]?.slug }
+ projectId: currentProject.id,
+ ...(currentProject.environments.length
+ ? { envSlug: currentProject.environments[0]?.slug }
: {})
}}
>
@@ -85,7 +84,7 @@ export const SecretManagerLayout = () => {
isSelected={
isActive ||
location.pathname.startsWith(
- `/projects/secret-management/${currentWorkspace.id}/overview`
+ `/projects/secret-management/${currentProject.id}/overview`
)
}
>
@@ -101,7 +100,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/integrations"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -119,7 +118,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/secret-rotation"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -137,7 +136,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/approval"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -164,7 +163,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/access-management"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -181,7 +180,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/audit-logs"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -198,7 +197,7 @@ export const SecretManagerLayout = () => {
<Link
to="/projects/secret-management/$projectId/settings"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
diff --git a/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx b/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx
index 265fcc003c..4f4ed345cb 100644
--- a/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx
+++ b/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx
@@ -15,7 +15,7 @@ import {
ProjectPermissionSub,
useProjectPermission,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { ProjectPermissionSecretScanningFindingActions } from "@app/context/ProjectPermissionContext/types";
import { useGetSecretScanningUnresolvedFindingCount } from "@app/hooks/api/secretScanningV2";
@@ -23,14 +23,14 @@ import { useGetSecretScanningUnresolvedFindingCount } from "@app/hooks/api/secre
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const SecretScanningLayout = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
const { permission } = useProjectPermission();
const { subscription } = useSubscription();
const { data: unresolvedFindings } = useGetSecretScanningUnresolvedFindingCount(
- currentWorkspace.id,
+ currentProject.id,
{
enabled:
subscription.secretScanning &&
@@ -64,7 +64,7 @@ export const SecretScanningLayout = () => {
<Link
to="/projects/secret-scanning/$projectId/data-sources"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -81,7 +81,7 @@ export const SecretScanningLayout = () => {
<Link
to="/projects/secret-scanning/$projectId/findings"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -105,7 +105,7 @@ export const SecretScanningLayout = () => {
<Link
to="/projects/secret-scanning/$projectId/access-management"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -122,7 +122,7 @@ export const SecretScanningLayout = () => {
<Link
to="/projects/secret-scanning/$projectId/audit-logs"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -139,7 +139,7 @@ export const SecretScanningLayout = () => {
<Link
to="/projects/secret-scanning/$projectId/settings"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
diff --git a/frontend/src/layouts/SshLayout/SshLayout.tsx b/frontend/src/layouts/SshLayout/SshLayout.tsx
index 9c807723e7..f8aa4f95b4 100644
--- a/frontend/src/layouts/SshLayout/SshLayout.tsx
+++ b/frontend/src/layouts/SshLayout/SshLayout.tsx
@@ -16,13 +16,13 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { AssumePrivilegeModeBanner } from "../ProjectLayout/components/AssumePrivilegeModeBanner";
export const SshLayout = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { assumedPrivilegeDetails } = useProjectPermission();
return (
@@ -47,7 +47,7 @@ export const SshLayout = () => {
<Link
to="/projects/ssh/$projectId/overview"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -70,7 +70,7 @@ export const SshLayout = () => {
<Link
to="/projects/ssh/$projectId/cas"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -93,7 +93,7 @@ export const SshLayout = () => {
<Link
to="/projects/ssh/$projectId/access-management"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -110,7 +110,7 @@ export const SshLayout = () => {
<Link
to="/projects/ssh/$projectId/audit-logs"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
@@ -127,7 +127,7 @@ export const SshLayout = () => {
<Link
to="/projects/ssh/$projectId/settings"
params={{
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}}
>
{({ isActive }) => (
diff --git a/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertModal.tsx b/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertModal.tsx
index 04fafa0b21..5601e48db6 100644
--- a/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertModal.tsx
+++ b/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertModal.tsx
@@ -13,7 +13,7 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
useCreatePkiAlert,
useGetPkiAlertById,
@@ -60,15 +60,15 @@ type Props = {
};
export const PkiAlertModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data: alert } = useGetPkiAlertById(
(popUp?.pkiAlert?.data as { alertId: string })?.alertId || ""
);
const { data: pkiCollections } = useListWorkspacePkiCollections({
- workspaceId: projectId
+ projectId
});
const { mutateAsync: createPkiAlert } = useCreatePkiAlert();
diff --git a/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsSection.tsx b/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsSection.tsx
index 497f10c395..d3aeefab79 100644
--- a/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsSection.tsx
+++ b/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsSection.tsx
@@ -4,7 +4,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, DeleteActionModal } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useDeletePkiAlert } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -12,8 +12,8 @@ import { PkiAlertModal } from "./PkiAlertModal";
import { PkiAlertsTable } from "./PkiAlertsTable";
export const PkiAlertsSection = () => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { mutateAsync: deletePkiAlert } = useDeletePkiAlert();
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
diff --git a/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsTable.tsx b/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsTable.tsx
index b67c5a2c6e..4ddbd46713 100644
--- a/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsTable.tsx
+++ b/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsTable.tsx
@@ -10,7 +10,7 @@ import {
THead,
Tr
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useListWorkspacePkiAlerts } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -24,11 +24,11 @@ type Props = {
};
export const PkiAlertsTable = ({ handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data, isPending } = useListWorkspacePkiAlerts({
- workspaceId: projectId
+ projectId
});
return (
diff --git a/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionModal.tsx b/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionModal.tsx
index 366f51c629..5900a1ba96 100644
--- a/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionModal.tsx
+++ b/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionModal.tsx
@@ -6,7 +6,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
useCreatePkiCollection,
useGetPkiCollectionById,
@@ -28,8 +28,8 @@ type Props = {
export const PkiCollectionModal = ({ popUp, handlePopUpToggle }: Props) => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data: pkiCollection } = useGetPkiCollectionById(
(popUp?.pkiCollection?.data as { collectionId: string })?.collectionId || ""
diff --git a/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionSection.tsx b/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionSection.tsx
index 81f5a86098..66732ad88a 100644
--- a/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionSection.tsx
+++ b/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionSection.tsx
@@ -4,7 +4,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, DeleteActionModal } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useDeletePkiCollection } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -12,8 +12,8 @@ import { PkiCollectionModal } from "./PkiCollectionModal";
import { PkiCollectionTable } from "./PkiCollectionTable";
export const PkiCollectionSection = () => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { mutateAsync: deletePkiCollection } = useDeletePkiCollection();
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
diff --git a/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionTable.tsx b/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionTable.tsx
index ff525b1f4a..ebd86973f5 100644
--- a/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionTable.tsx
+++ b/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionTable.tsx
@@ -19,7 +19,7 @@ import {
THead,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useListWorkspacePkiCollections } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -32,11 +32,11 @@ type Props = {
export const PkiCollectionTable = ({ handlePopUpOpen }: Props) => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data, isPending } = useListWorkspacePkiCollections({
- workspaceId: projectId
+ projectId
});
return (
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx
index 0bf3c44312..4e58592153 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx
@@ -15,7 +15,7 @@ import {
Tooltip
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { CaType, useDeleteCa, useGetCa } from "@app/hooks/api";
import { TInternalCertificateAuthority } from "@app/hooks/api/ca/types";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -30,7 +30,7 @@ import {
} from "./components";
const Page = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate();
const params = useParams({
from: ROUTE_PATHS.CertManager.CertAuthDetailsByIDPage.id
@@ -38,11 +38,11 @@ const Page = () => {
const { caName } = params as { caName: string };
const { data } = useGetCa({
caName,
- projectId: currentWorkspace?.id || "",
+ projectId: currentProject?.id || "",
type: CaType.INTERNAL
}) as { data: TInternalCertificateAuthority };
- const projectId = currentWorkspace?.id || "";
+ const projectId = currentProject?.id || "";
const { mutateAsync: deleteCa } = useDeleteCa();
@@ -55,11 +55,11 @@ const Page = () => {
const onRemoveCaSubmit = async () => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
await deleteCa({
caName,
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
type: CaType.INTERNAL
});
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx
index f12fcfd280..9ee5c1b8ba 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx
@@ -4,7 +4,7 @@ import { format } from "date-fns";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, IconButton, Tooltip } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useTimedReset } from "@app/hooks";
import { CaStatus, CaType, InternalCaType, useGetCa } from "@app/hooks/api";
import { caStatusToNameMap, caTypeToNameMap } from "@app/hooks/api/ca/constants";
@@ -21,7 +21,7 @@ type Props = {
};
export const CaDetailsSection = ({ caName, handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [copyTextId, isCopyingId, setCopyTextId] = useTimedReset<string>({
initialState: "Copy ID to clipboard"
});
@@ -31,7 +31,7 @@ export const CaDetailsSection = ({ caName, handlePopUpOpen }: Props) => {
const { data } = useGetCa({
caName,
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
type: CaType.INTERNAL
});
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaRenewalModal.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaRenewalModal.tsx
index 6f9cf3a1c3..857586a584 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaRenewalModal.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaRenewalModal.tsx
@@ -13,7 +13,7 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
CaRenewalType,
useRenewCa
@@ -45,8 +45,8 @@ type Props = {
};
export const CaRenewalModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectSlug = currentWorkspace?.slug || "";
+ const { currentProject } = useProject();
+ const projectSlug = currentProject?.slug || "";
const popUpData = popUp?.renewCa?.data as {
caId: string;
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/ExternalCaInstallForm.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/ExternalCaInstallForm.tsx
index 6f79cbb246..d737e6c45e 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/ExternalCaInstallForm.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/ExternalCaInstallForm.tsx
@@ -8,7 +8,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, IconButton, TextArea, Tooltip } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useTimedReset } from "@app/hooks";
import { useGetCaCsr, useImportCaCertificate } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -26,7 +26,7 @@ type Props = {
};
export const ExternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [copyTextCaCsr, isCopyingCaCsr, setCopyTextCaCsr] = useTimedReset<string>({
initialState: "Copy to clipboard"
});
@@ -41,7 +41,7 @@ export const ExternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
});
const { data: csr } = useGetCaCsr(caId);
- const { mutateAsync: importCaCertificate } = useImportCaCertificate(currentWorkspace.id);
+ const { mutateAsync: importCaCertificate } = useImportCaCertificate(currentProject.id);
useEffect(() => {
reset();
@@ -49,11 +49,11 @@ export const ExternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
const onFormSubmit = async ({ certificate, certificateChain }: FormData) => {
try {
- if (!csr || !caId || !currentWorkspace?.slug) return;
+ if (!csr || !caId || !currentProject?.slug) return;
await importCaCertificate({
caId,
- projectSlug: currentWorkspace?.slug,
+ projectSlug: currentProject?.slug,
certificate,
certificateChain
});
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/InternalCaInstallForm.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/InternalCaInstallForm.tsx
index 677407dc88..5979d97118 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/InternalCaInstallForm.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/InternalCaInstallForm.tsx
@@ -6,7 +6,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Select, SelectItem } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
CaStatus,
useGetCaById,
@@ -46,16 +46,16 @@ type Props = {
};
export const InternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: cas } = useListWorkspaceCas({
- projectSlug: currentWorkspace?.slug ?? "",
+ projectId: currentProject.id,
status: CaStatus.ACTIVE
});
const { data: ca } = useGetCaById(caId);
const { data: csr } = useGetCaCsr(caId);
const { mutateAsync: signIntermediate } = useSignIntermediate();
- const { mutateAsync: importCaCertificate } = useImportCaCertificate(currentWorkspace.id);
+ const { mutateAsync: importCaCertificate } = useImportCaCertificate(currentProject.id);
const {
control,
@@ -102,7 +102,7 @@ export const InternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
const onFormSubmit = async ({ notAfter, maxPathLength }: FormData) => {
try {
- if (!csr || !caId || !currentWorkspace?.slug) return;
+ if (!csr || !caId || !currentProject?.slug) return;
const { certificate, certificateChain } = await signIntermediate({
caId: parentCaId,
@@ -114,7 +114,7 @@ export const InternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
await importCaCertificate({
caId,
- projectSlug: currentWorkspace?.slug,
+ projectSlug: currentProject?.slug,
certificate,
certificateChain
});
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsx
index d3040576fa..2a976d6823 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsx
@@ -16,7 +16,7 @@ import {
Switch
// DatePicker
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
CaStatus,
CaType,
@@ -84,10 +84,10 @@ const caTypes = [
];
export const CaModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: ca } = useGetCa({
caName: (popUp?.ca?.data as { name: string })?.name || "",
- projectId: currentWorkspace?.id || "",
+ projectId: currentProject?.id || "",
type: CaType.INTERNAL
});
@@ -178,13 +178,13 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => {
configuration
}: FormData) => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
if (ca) {
// update
await updateMutateAsync({
caName: ca.name,
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
name,
type: CaType.INTERNAL,
status,
@@ -193,7 +193,7 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => {
} else {
// create
await createMutateAsync({
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
name,
type,
status,
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx
index 5de6027fa7..ed4e8f8471 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx
@@ -5,7 +5,7 @@ import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, DeleteActionModal } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { CaStatus, CaType, useDeleteCa, useUpdateCa } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -15,7 +15,7 @@ import { CaModal } from "./CaModal";
import { CaTable } from "./CaTable";
export const CaSection = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync: deleteCa } = useDeleteCa();
const { mutateAsync: updateCa } = useUpdateCa();
@@ -30,9 +30,9 @@ export const CaSection = () => {
const onRemoveCaSubmit = async (caName: string) => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
- await deleteCa({ caName, projectId: currentWorkspace.id, type: CaType.INTERNAL });
+ await deleteCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL });
createNotification({
text: "Successfully deleted CA",
@@ -50,9 +50,9 @@ export const CaSection = () => {
const onUpdateCaStatus = async ({ caName, status }: { caName: string; status: CaStatus }) => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
- await updateCa({ caName, projectId: currentWorkspace.id, type: CaType.INTERNAL, status });
+ await updateCa({ caName, projectId: currentProject.id, type: CaType.INTERNAL, status });
createNotification({
text: `Successfully ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx
index 00ab03625a..81fce98c66 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx
@@ -22,7 +22,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { CaStatus, CaType, useListCasByTypeAndProjectId } from "@app/hooks/api";
import {
caStatusToNameMap,
@@ -49,8 +49,8 @@ type Props = {
export const CaTable = ({ handlePopUpOpen }: Props) => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
- const { data, isPending } = useListCasByTypeAndProjectId(CaType.INTERNAL, currentWorkspace.id);
+ const { currentProject } = useProject();
+ const { data, isPending } = useListCasByTypeAndProjectId(CaType.INTERNAL, currentProject.id);
const cas = data as TInternalCertificateAuthority[];
return (
@@ -80,7 +80,7 @@ export const CaTable = ({ handlePopUpOpen }: Props) => {
navigate({
to: "/projects/cert-management/$projectId/ca/$caName",
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
caName: ca.name
}
})
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx
index 68757f5496..ed9c6b9e9e 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx
@@ -16,7 +16,7 @@ import {
SelectItem,
Switch
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";
import {
TAvailableAppConnection,
@@ -127,11 +127,11 @@ const caTypes = [
];
export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: ca, isLoading: isCaLoading } = useGetCa({
caName: (popUp?.ca?.data as { name: string })?.name || "",
- projectId: currentWorkspace?.id || "",
+ projectId: currentProject?.id || "",
type: (popUp?.ca?.data as { type: CaType })?.type || ""
});
@@ -297,7 +297,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
configuration: formConfiguration
}: FormData) => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
let configPayload: any;
@@ -321,7 +321,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
if (ca) {
await updateMutateAsync({
caName: ca.name,
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
name,
type,
status,
@@ -330,7 +330,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
});
} else {
await createMutateAsync({
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
name,
type,
status,
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx
index c8d117e210..7e60b03730 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx
@@ -5,7 +5,7 @@ import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, DeleteActionModal } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { CaStatus, CaType, useDeleteCa, useUpdateCa } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -13,7 +13,7 @@ import { ExternalCaModal } from "./ExternalCaModal";
import { ExternalCaTable } from "./ExternalCaTable";
export const ExternalCaSection = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync: deleteCa } = useDeleteCa();
const { mutateAsync: updateCa } = useUpdateCa();
@@ -26,9 +26,9 @@ export const ExternalCaSection = () => {
const onRemoveCaSubmit = async (caName: string, type: CaType) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
- await deleteCa({ caName, type, projectId: currentWorkspace.id });
+ await deleteCa({ caName, type, projectId: currentProject.id });
createNotification({
text: "Successfully deleted CA",
@@ -54,9 +54,9 @@ export const ExternalCaSection = () => {
status: CaStatus;
}) => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
- await updateCa({ caName: name, type, status, projectId: currentWorkspace.id });
+ await updateCa({ caName: name, type, status, projectId: currentProject.id });
createNotification({
text: `Successfully ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`,
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaTable.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaTable.tsx
index e7b18f4291..a948473e8f 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaTable.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaTable.tsx
@@ -26,7 +26,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { CaStatus, CaType, useListExternalCasByProjectId } from "@app/hooks/api";
import { caStatusToNameMap, getCaStatusBadgeVariant } from "@app/hooks/api/ca/constants";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -44,8 +44,8 @@ type Props = {
};
export const ExternalCaTable = ({ handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const { data, isPending } = useListExternalCasByProjectId(currentWorkspace.id);
+ const { currentProject } = useProject();
+ const { data, isPending } = useListExternalCasByProjectId(currentProject.id);
return (
<div>
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateImportModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateImportModal.tsx
index c4cffe7b01..70b51cbbe5 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateImportModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateImportModal.tsx
@@ -14,7 +14,7 @@ import {
SelectItem,
TextArea
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useGetCert, useImportCertificate, useListWorkspacePkiCollections } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -48,13 +48,13 @@ type TCertificateDetails = {
export const CertificateImportModal = ({ popUp, handlePopUpToggle }: Props) => {
const [certificateDetails, setCertificateDetails] = useState<TCertificateDetails | null>(null);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: cert } = useGetCert(
(popUp?.certificateImport?.data as { serialNumber: string })?.serialNumber || ""
);
const { data } = useListWorkspacePkiCollections({
- workspaceId: currentWorkspace?.id || ""
+ projectId: currentProject?.id || ""
});
const { mutateAsync: importCertificate } = useImportCertificate();
@@ -76,10 +76,10 @@ export const CertificateImportModal = ({ popUp, handlePopUpToggle }: Props) => {
collectionId
}: FormData) => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
const { serialNumber, certificate, certificateChain, privateKey } = await importCertificate({
- projectSlug: currentWorkspace.slug,
+ projectSlug: currentProject.slug,
certificatePem,
privateKeyPem,
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateModal.tsx
index a10743023e..a8509fe174 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateModal.tsx
@@ -22,7 +22,7 @@ import {
SelectItem,
Tooltip
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
CaStatus,
useCreateCertificate,
@@ -89,22 +89,22 @@ const CERT_TEMPLATE_NONE_VALUE = "none";
export const CertificateModal = ({ popUp, handlePopUpToggle }: Props) => {
const [certificateDetails, setCertificateDetails] = useState<TCertificateDetails | null>(null);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: cert } = useGetCert(
(popUp?.certificate?.data as { serialNumber: string })?.serialNumber || ""
);
const { data: cas } = useListWorkspaceCas({
- projectSlug: currentWorkspace?.slug ?? "",
+ projectId: currentProject.id,
status: CaStatus.ACTIVE
});
const { data } = useListWorkspacePkiCollections({
- workspaceId: currentWorkspace?.id || ""
+ projectId: currentProject?.id || ""
});
const { data: templatesData } = useListWorkspaceCertificateTemplates({
- workspaceId: currentWorkspace?.id || ""
+ projectId: currentProject?.id || ""
});
const { mutateAsync: createCertificate } = useCreateCertificate();
@@ -191,12 +191,12 @@ export const CertificateModal = ({ popUp, handlePopUpToggle }: Props) => {
extendedKeyUsages
}: FormData) => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
const { serialNumber, certificate, certificateChain, privateKey } = await createCertificate({
caId: !selectedCertTemplate ? caId : undefined,
certificateTemplateId: selectedCertTemplate ? selectedCertTemplateId : undefined,
- projectSlug: currentWorkspace.slug,
+ projectSlug: currentProject.slug,
pkiCollectionId: collectionId,
friendlyName,
commonName,
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx
index 2f14fda3fc..1d15392960 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx
@@ -4,7 +4,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Modal, ModalContent, Select, SelectItem } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useRevokeCert } from "@app/hooks/api";
import { crlReasons } from "@app/hooks/api/certificates/constants";
import { CrlReason } from "@app/hooks/api/certificates/enums";
@@ -35,7 +35,7 @@ type Props = {
};
export const CertificateRevocationModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync: revokeCertificate } = useRevokeCert();
const {
@@ -49,12 +49,12 @@ export const CertificateRevocationModal = ({ popUp, handlePopUpToggle }: Props)
const onFormSubmit = async ({ revocationReason }: FormData) => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
const { serialNumber } = popUp.revokeCertificate.data as { serialNumber: string };
await revokeCertificate({
- projectSlug: currentWorkspace.slug,
+ projectSlug: currentProject.slug,
serialNumber,
revocationReason
});
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplateModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplateModal.tsx
index d709458f0c..8f547e5735 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplateModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplateModal.tsx
@@ -22,7 +22,7 @@ import {
SelectItem,
Tooltip
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
CaStatus,
useCreateCertTemplate,
@@ -82,7 +82,7 @@ type Props = {
};
export const CertificateTemplateModal = ({ popUp, handlePopUpToggle, caId }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: ca } = useGetCaById(caId);
@@ -91,12 +91,12 @@ export const CertificateTemplateModal = ({ popUp, handlePopUpToggle, caId }: Pro
);
const { data: cas } = useListWorkspaceCas({
- projectSlug: currentWorkspace?.slug ?? "",
+ projectId: currentProject?.id,
status: CaStatus.ACTIVE
});
const { data: collectionsData } = useListWorkspacePkiCollections({
- workspaceId: currentWorkspace?.id || ""
+ projectId: currentProject?.id || ""
});
const { mutateAsync: createCertTemplate } = useCreateCertTemplate();
@@ -155,7 +155,7 @@ export const CertificateTemplateModal = ({ popUp, handlePopUpToggle, caId }: Pro
keyUsages,
extendedKeyUsages
}: FormData) => {
- if (!currentWorkspace?.id) {
+ if (!currentProject?.id) {
return;
}
@@ -163,7 +163,7 @@ export const CertificateTemplateModal = ({ popUp, handlePopUpToggle, caId }: Pro
if (certTemplate) {
await updateCertTemplate({
id: certTemplate.id,
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
pkiCollectionId: collectionId,
caId,
name,
@@ -184,7 +184,7 @@ export const CertificateTemplateModal = ({ popUp, handlePopUpToggle, caId }: Pro
});
} else {
await createCertTemplate({
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
pkiCollectionId: collectionId,
caId,
name,
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplatesSection.tsx
index 0db7ba9237..89f9780e8d 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplatesSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplatesSection.tsx
@@ -12,7 +12,7 @@ import { DeleteActionModal, IconButton } from "@app/components/v2";
import {
ProjectPermissionPkiTemplateActions,
ProjectPermissionSub,
- useWorkspace
+ useProject
} from "@app/context";
import { usePopUp } from "@app/hooks";
import { useDeleteCertTemplate } from "@app/hooks/api";
@@ -33,18 +33,18 @@ export const CertificateTemplatesSection = ({ caId }: Props) => {
"upgradePlan"
] as const);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync: deleteCertTemplate } = useDeleteCertTemplate();
const onRemoveCertificateTemplateSubmit = async (id: string) => {
- if (!currentWorkspace?.id) {
+ if (!currentProject?.id) {
return;
}
try {
await deleteCertTemplate({
id,
- projectId: currentWorkspace.id
+ projectId: currentProject.id
});
createNotification({
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
index 44ddbc8bad..696d077624 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
@@ -7,7 +7,7 @@ import { Button, DeleteActionModal } from "@app/components/v2";
import {
ProjectPermissionCertificateActions,
ProjectPermissionSub,
- useWorkspace
+ useProject
} from "@app/context";
import { useDeleteCert } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -19,7 +19,7 @@ import { CertificateRevocationModal } from "./CertificateRevocationModal";
import { CertificatesTable } from "./CertificatesTable";
export const CertificatesSection = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync: deleteCert } = useDeleteCert();
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
@@ -32,9 +32,9 @@ export const CertificatesSection = () => {
const onRemoveCertificateSubmit = async (serialNumber: string) => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
- await deleteCert({ serialNumber, projectSlug: currentWorkspace.slug });
+ await deleteCert({ serialNumber, projectSlug: currentProject.slug });
createNotification({
text: "Successfully deleted certificate",
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
index 9a204afaca..3cf35ebd62 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
@@ -33,7 +33,7 @@ import {
import {
ProjectPermissionCertificateActions,
ProjectPermissionSub,
- useWorkspace
+ useProject
} from "@app/context";
import { useListWorkspaceCertificates } from "@app/hooks/api";
import { caSupportsCapability } from "@app/hooks/api/ca/constants";
@@ -62,15 +62,15 @@ export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(PER_PAGE_INIT);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data, isPending } = useListWorkspaceCertificates({
- projectId: currentWorkspace?.slug ?? "",
+ projectId: currentProject?.slug ?? "",
offset: (page - 1) * perPage,
limit: perPage
});
// Fetch CA data to determine capabilities
- const { data: caData } = useListCasByProjectId(currentWorkspace?.id ?? "");
+ const { data: caData } = useListCasByProjectId(currentProject?.id ?? "");
// Create mapping from caId to CA type for capability checking
const caCapabilityMap = useMemo(() => {
diff --git a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsx
index 0261d55fd1..c53df83be9 100644
--- a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsx
@@ -16,7 +16,7 @@ import {
Tooltip
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useDeletePkiCollection, useGetPkiCollectionById } from "@app/hooks/api";
import { PkiItemType } from "@app/hooks/api/pkiCollections/constants";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -30,8 +30,8 @@ export const PkiCollectionPage = () => {
from: ROUTE_PATHS.CertManager.PkiCollectionDetailsByIDPage.id
});
const collectionId = params.collectionId as string;
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data } = useGetPkiCollectionById(collectionId);
const { mutateAsync: deletePkiCollection } = useDeletePkiCollection();
diff --git a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/AddPkiCollectionItemModal.tsx b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/AddPkiCollectionItemModal.tsx
index e1b6ebe176..3bcc3dc317 100644
--- a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/AddPkiCollectionItemModal.tsx
+++ b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/AddPkiCollectionItemModal.tsx
@@ -4,7 +4,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Modal, ModalContent, Select, SelectItem } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
CaStatus,
useAddItemToPkiCollection,
@@ -41,15 +41,15 @@ export const AddPkiCollectionItemModal = ({
popUp,
handlePopUpToggle
}: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: cas } = useListWorkspaceCas({
- projectSlug: currentWorkspace?.slug || "",
+ projectId: currentProject?.id || "",
status: CaStatus.ACTIVE
});
const { data } = useListWorkspaceCertificates({
- projectId: currentWorkspace?.slug || "",
+ projectId: currentProject?.slug || "",
offset: 0,
limit: 25
});
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsx
index 04db9861b7..d7d44d4b56 100644
--- a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsx
@@ -19,7 +19,7 @@ import { ROUTE_PATHS } from "@app/const/routes";
import {
ProjectPermissionPkiSubscriberActions,
ProjectPermissionSub,
- useWorkspace
+ useProject
} from "@app/context";
import { useDeletePkiSubscriber, useGetPkiSubscriber } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -29,8 +29,8 @@ import { PkiSubscriberCertificatesSection, PkiSubscriberDetailsSection } from ".
const Page = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace.id;
+ const { currentProject } = useProject();
+ const projectId = currentProject.id;
const subscriberName = useParams({
from: ROUTE_PATHS.CertManager.PkiSubscriberDetailsByIDPage.id,
select: (el) => el.subscriberName
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx
index 62e7337bd3..c6f9f5742d 100644
--- a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx
@@ -28,7 +28,7 @@ import {
ProjectPermissionPkiSubscriberActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { useGetPkiSubscriberCertificates } from "@app/hooks/api";
import { caSupportsCapability } from "@app/hooks/api/ca/constants";
@@ -45,8 +45,8 @@ type Props = {
const PER_PAGE_INIT = 25;
export const PkiSubscriberCertificatesTable = ({ subscriberName, handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace.id;
+ const { currentProject } = useProject();
+ const projectId = currentProject.id;
const { permission } = useProjectPermission();
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(PER_PAGE_INIT);
@@ -64,7 +64,7 @@ export const PkiSubscriberCertificatesTable = ({ subscriberName, handlePopUpOpen
);
// Fetch CA data to determine capabilities
- const { data: caData } = useListCasByProjectId(currentWorkspace.id);
+ const { data: caData } = useListCasByProjectId(currentProject.id);
// Create mapping from caId to CA type for capability checking
const caCapabilityMap = useMemo(() => {
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsx
index 1f15982a4f..8286319fc7 100644
--- a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsx
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsx
@@ -17,7 +17,7 @@ import {
ProjectPermissionPkiSubscriberActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { useTimedReset } from "@app/hooks";
import {
@@ -44,8 +44,8 @@ type TCertificateDetails = {
};
export const PkiSubscriberDetailsSection = ({ subscriberName, handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace.id;
+ const { currentProject } = useProject();
+ const projectId = currentProject.id;
const { permission } = useProjectPermission();
const [certificateDetails, setCertificateDetails] = useState<TCertificateDetails | null>(null);
const [isModalOpen, setIsModalOpen] = useState(false);
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx
index f6deb97cb9..932f3201b4 100644
--- a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx
@@ -22,7 +22,7 @@ import {
TabPanel,
Tabs
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
CaType,
useCreatePkiSubscriber,
@@ -158,8 +158,8 @@ const schema = z
export type FormData = z.infer<typeof schema>;
export const PkiSubscriberModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace.id;
+ const { currentProject } = useProject();
+ const projectId = currentProject.id;
const { data: subscribers } = useListWorkspacePkiSubscribers(projectId);
const { data: cas } = useListCasByProjectId(projectId);
const [tabValue, setTabValue] = useState<FormTab>(FormTab.Configuration);
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsx
index f81636e491..f9680af9bd 100644
--- a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsx
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsx
@@ -7,7 +7,7 @@ import { Button, DeleteActionModal } from "@app/components/v2";
import {
ProjectPermissionPkiSubscriberActions,
ProjectPermissionSub,
- useWorkspace
+ useProject
} from "@app/context";
import { useDeletePkiSubscriber, useUpdatePkiSubscriber } from "@app/hooks/api";
import { PkiSubscriberStatus } from "@app/hooks/api/pkiSubscriber/types";
@@ -17,8 +17,8 @@ import { PkiSubscriberModal } from "./PkiSubscriberModal";
import { PkiSubscribersTable } from "./PkiSubscribersTable";
export const PkiSubscriberSection = () => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace.id;
+ const { currentProject } = useProject();
+ const projectId = currentProject.id;
const { mutateAsync: deletePkiSubscriber } = useDeletePkiSubscriber();
const { mutateAsync: updatePkiSubscriber } = useUpdatePkiSubscriber();
@@ -55,7 +55,7 @@ export const PkiSubscriberSection = () => {
status: PkiSubscriberStatus;
}) => {
try {
- if (!currentWorkspace?.slug) return;
+ if (!currentProject?.slug) return;
await updatePkiSubscriber({ subscriberName, projectId, status });
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx
index d649c43a73..d28c2d3a2c 100644
--- a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx
@@ -30,7 +30,7 @@ import {
import {
ProjectPermissionPkiSubscriberActions,
ProjectPermissionSub,
- useWorkspace
+ useProject
} from "@app/context";
import { useListWorkspacePkiSubscribers } from "@app/hooks/api";
import {
@@ -49,8 +49,8 @@ type Props = {
export const PkiSubscribersTable = ({ handlePopUpOpen }: Props) => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
- const { data, isPending } = useListWorkspacePkiSubscribers(currentWorkspace?.id || "");
+ const { currentProject } = useProject();
+ const { data, isPending } = useListWorkspacePkiSubscribers(currentProject?.id || "");
return (
<div>
<TableContainer>
@@ -77,7 +77,7 @@ export const PkiSubscribersTable = ({ handlePopUpOpen }: Props) => {
navigate({
to: "/projects/cert-management/$projectId/subscribers/$subscriberName",
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
subscriberName: subscriber.name
}
})
diff --git a/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx b/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx
index 4449e9a977..f38fbf0807 100644
--- a/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx
+++ b/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx
@@ -43,7 +43,7 @@ import {
ProjectPermissionPkiTemplateActions,
ProjectPermissionSub,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { usePopUp } from "@app/hooks";
import { useDeleteCertTemplateV2 } from "@app/hooks/api";
@@ -55,7 +55,7 @@ import { PkiTemplateForm } from "./components/PkiTemplateForm";
const PER_PAGE_INIT = 25;
export const PkiTemplateListPage = () => {
const { t } = useTranslation();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(PER_PAGE_INIT);
const { handlePopUpToggle, popUp, handlePopUpOpen, handlePopUpClose } = usePopUp([
@@ -68,7 +68,7 @@ export const PkiTemplateListPage = () => {
const { subscription } = useSubscription();
const { data, isPending } = useListCertificateTemplates({
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
offset: (page - 1) * perPage,
limit: perPage
});
@@ -78,7 +78,7 @@ export const PkiTemplateListPage = () => {
const onRemovePkiSubscriberSubmit = async () => {
try {
const pkiTemplate = await deleteCertTemplate.mutateAsync({
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
templateName: popUp?.deleteTemplate?.data?.name
});
diff --git a/frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsx b/frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsx
index f52c83725f..b8cdbfe1c3 100644
--- a/frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsx
+++ b/frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsx
@@ -18,7 +18,7 @@ import {
Input,
Tooltip
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
useCreateCertTemplateV2,
useListCasByProjectId,
@@ -72,9 +72,9 @@ type Props = {
};
export const PkiTemplateForm = ({ certTemplate, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
- const { data: cas, isPending: isCaLoading } = useListCasByProjectId(currentWorkspace.id);
+ const { data: cas, isPending: isCaLoading } = useListCasByProjectId(currentProject.id);
const { mutateAsync: createCertTemplate } = useCreateCertTemplateV2();
const { mutateAsync: updateCertTemplate } = useUpdateCertTemplateV2();
@@ -124,7 +124,7 @@ export const PkiTemplateForm = ({ certTemplate, handlePopUpToggle }: Props) => {
extendedKeyUsages,
ca
}: FormData) => {
- if (!currentWorkspace?.id) {
+ if (!currentProject?.id) {
return;
}
@@ -132,7 +132,7 @@ export const PkiTemplateForm = ({ certTemplate, handlePopUpToggle }: Props) => {
if (certTemplate) {
await updateCertTemplate({
templateName: certTemplate.name,
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
caName: ca.name,
name,
commonName,
@@ -152,7 +152,7 @@ export const PkiTemplateForm = ({ certTemplate, handlePopUpToggle }: Props) => {
});
} else {
await createCertTemplate({
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
caName: ca.name,
name,
commonName,
diff --git a/frontend/src/pages/cert-manager/layout.tsx b/frontend/src/pages/cert-manager/layout.tsx
index 6b846909e0..ea806d3d33 100644
--- a/frontend/src/pages/cert-manager/layout.tsx
+++ b/frontend/src/pages/cert-manager/layout.tsx
@@ -1,9 +1,9 @@
import { createFileRoute } from "@tanstack/react-router";
import { BreadcrumbTypes } from "@app/components/v2";
-import { workspaceKeys } from "@app/hooks/api";
+import { projectKeys } from "@app/hooks/api";
import { fetchUserProjectPermissions, roleQueryKeys } from "@app/hooks/api/roles/queries";
-import { fetchWorkspaceById } from "@app/hooks/api/workspace/queries";
+import { fetchProjectById } from "@app/hooks/api/projects/queries";
import { PkiManagerLayout } from "@app/layouts/PkiManagerLayout";
import { ProjectSelect } from "@app/layouts/ProjectLayout/components/ProjectSelect";
@@ -13,15 +13,15 @@ export const Route = createFileRoute(
component: PkiManagerLayout,
beforeLoad: async ({ params, context }) => {
const project = await context.queryClient.ensureQueryData({
- queryKey: workspaceKeys.getWorkspaceById(params.projectId),
- queryFn: () => fetchWorkspaceById(params.projectId)
+ queryKey: projectKeys.getProjectById(params.projectId),
+ queryFn: () => fetchProjectById(params.projectId)
});
await context.queryClient.ensureQueryData({
queryKey: roleQueryKeys.getUserProjectPermissions({
- workspaceId: params.projectId
+ projectId: params.projectId
}),
- queryFn: () => fetchUserProjectPermissions({ workspaceId: params.projectId })
+ queryFn: () => fetchUserProjectPermissions({ projectId: params.projectId })
});
return {
diff --git a/frontend/src/pages/kms/KmipPage/components/KmipClientModal.tsx b/frontend/src/pages/kms/KmipPage/components/KmipClientModal.tsx
index 8c959c7b07..7abbee35fc 100644
--- a/frontend/src/pages/kms/KmipPage/components/KmipClientModal.tsx
+++ b/frontend/src/pages/kms/KmipPage/components/KmipClientModal.tsx
@@ -13,7 +13,7 @@ import {
ModalContent,
TextArea
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateKmipClient, useUpdateKmipClient } from "@app/hooks/api/kmip";
import { KmipPermission, TKmipClient } from "@app/hooks/api/kmip/types";
@@ -60,8 +60,8 @@ type FormProps = Pick<Props, "kmipClient"> & {
const KmipClientForm = ({ onComplete, kmipClient }: FormProps) => {
const createKmipClient = useCreateKmipClient();
const updateKmipClient = useUpdateKmipClient();
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace.id;
+ const { currentProject } = useProject();
+ const projectId = currentProject.id;
const isUpdate = !!kmipClient;
const {
diff --git a/frontend/src/pages/kms/KmipPage/components/KmipClientTable.tsx b/frontend/src/pages/kms/KmipPage/components/KmipClientTable.tsx
index bcc49b11a1..6ac060580e 100644
--- a/frontend/src/pages/kms/KmipPage/components/KmipClientTable.tsx
+++ b/frontend/src/pages/kms/KmipPage/components/KmipClientTable.tsx
@@ -41,7 +41,7 @@ import {
ProjectPermissionSub,
useProjectPermission,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import {
getUserTablePreference,
@@ -59,9 +59,9 @@ import { KmipClientCertificateModal } from "./KmipClientCertificateModal";
import { KmipClientModal } from "./KmipClientModal";
export const KmipClientTable = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
- const projectId = currentWorkspace?.id ?? "";
+ const projectId = currentProject?.id ?? "";
const {
offset,
diff --git a/frontend/src/pages/kms/OverviewPage/components/CmekModal.tsx b/frontend/src/pages/kms/OverviewPage/components/CmekModal.tsx
index c43b6c8d0d..93c0102b16 100644
--- a/frontend/src/pages/kms/OverviewPage/components/CmekModal.tsx
+++ b/frontend/src/pages/kms/OverviewPage/components/CmekModal.tsx
@@ -14,7 +14,7 @@ import {
SelectItem,
TextArea
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { keyUsageDefaultOption, kmsKeyUsageOptions } from "@app/helpers/kms";
import {
AllowedEncryptionKeyAlgorithms,
@@ -49,8 +49,8 @@ type FormProps = Pick<Props, "cmek"> & {
const CmekForm = ({ onComplete, cmek }: FormProps) => {
const createCmek = useCreateCmek();
const updateCmek = useUpdateCmek();
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace.id;
+ const { currentProject } = useProject();
+ const projectId = currentProject.id;
const isUpdate = !!cmek;
const {
diff --git a/frontend/src/pages/kms/OverviewPage/components/CmekTable.tsx b/frontend/src/pages/kms/OverviewPage/components/CmekTable.tsx
index e1a2fe7892..2bb6671e55 100644
--- a/frontend/src/pages/kms/OverviewPage/components/CmekTable.tsx
+++ b/frontend/src/pages/kms/OverviewPage/components/CmekTable.tsx
@@ -50,7 +50,7 @@ import {
ProjectPermissionCmekActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { kmsKeyUsageOptions } from "@app/helpers/kms";
import {
@@ -87,10 +87,10 @@ const getStatusBadgeProps = (
};
export const CmekTable = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { permission } = useProjectPermission();
- const projectId = currentWorkspace?.id ?? "";
+ const projectId = currentProject?.id ?? "";
const {
offset,
diff --git a/frontend/src/pages/kms/layout.tsx b/frontend/src/pages/kms/layout.tsx
index 60bc35ab72..11caba01b1 100644
--- a/frontend/src/pages/kms/layout.tsx
+++ b/frontend/src/pages/kms/layout.tsx
@@ -1,9 +1,9 @@
import { createFileRoute } from "@tanstack/react-router";
import { BreadcrumbTypes } from "@app/components/v2";
-import { workspaceKeys } from "@app/hooks/api";
+import { projectKeys } from "@app/hooks/api";
import { fetchUserProjectPermissions, roleQueryKeys } from "@app/hooks/api/roles/queries";
-import { fetchWorkspaceById } from "@app/hooks/api/workspace/queries";
+import { fetchProjectById } from "@app/hooks/api/projects/queries";
import { KmsLayout } from "@app/layouts/KmsLayout";
import { ProjectSelect } from "@app/layouts/ProjectLayout/components/ProjectSelect";
@@ -13,15 +13,15 @@ export const Route = createFileRoute(
component: KmsLayout,
beforeLoad: async ({ params, context }) => {
const project = await context.queryClient.ensureQueryData({
- queryKey: workspaceKeys.getWorkspaceById(params.projectId),
- queryFn: () => fetchWorkspaceById(params.projectId)
+ queryKey: projectKeys.getProjectById(params.projectId),
+ queryFn: () => fetchProjectById(params.projectId)
});
await context.queryClient.ensureQueryData({
queryKey: roleQueryKeys.getUserProjectPermissions({
- workspaceId: params.projectId
+ projectId: params.projectId
}),
- queryFn: () => fetchUserProjectPermissions({ workspaceId: params.projectId })
+ queryFn: () => fetchUserProjectPermissions({ projectId: params.projectId })
});
return {
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddOrgMemberModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddOrgMemberModal.tsx
index 7f751fc7d0..c68d27a4b3 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddOrgMemberModal.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/AddOrgMemberModal.tsx
@@ -21,10 +21,10 @@ import {
useAddUsersToOrg,
useFetchServerStatus,
useGetOrgRoles,
- useGetUserWorkspaces
+ useGetUserProjects
} from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
-import { ProjectType, ProjectVersion } from "@app/hooks/api/workspace/types";
+import { ProjectType, ProjectVersion } from "@app/hooks/api/projects/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { OrgInviteLink } from "./OrgInviteLink";
@@ -76,7 +76,7 @@ export const AddOrgMemberModal = ({
const { data: organizationRoles } = useGetOrgRoles(currentOrg?.id ?? "");
const { data: serverDetails } = useFetchServerStatus();
const { mutateAsync: addUsersMutateAsync } = useAddUsersToOrg();
- const { data: projects, isPending: isProjectsLoading } = useGetUserWorkspaces({
+ const { data: projects, isPending: isProjectsLoading } = useGetUserProjects({
includeRoles: true
});
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx
index bc469ba114..40b2f973f9 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx
@@ -21,7 +21,7 @@ import {
SelectItem
} from "@app/components/v2";
import { useOrganization } from "@app/context";
-import { useGetUserWorkspaces } from "@app/hooks/api";
+import { useGetUserProjects } from "@app/hooks/api";
import {
eventToNameMap,
secretEvents,
@@ -29,7 +29,7 @@ import {
} from "@app/hooks/api/auditLogs/constants";
import { EventType } from "@app/hooks/api/auditLogs/enums";
import { UserAgentType } from "@app/hooks/api/auth/types";
-import { Project } from "@app/hooks/api/workspace/types";
+import { Project } from "@app/hooks/api/projects/types";
import { LogFilterItem } from "./LogFilterItem";
import { auditLogFilterFormSchema, Presets, TAuditLogFilterFormData } from "./types";
@@ -72,7 +72,7 @@ const getActiveFilterCount = (filter: TAuditLogFilterFormData) => {
};
export const LogsFilter = ({ presets, setFilter, filter, project }: Props) => {
- const { data: workspaces = [] } = useGetUserWorkspaces();
+ const { data: workspaces = [] } = useGetUserProjects();
const { currentOrg } = useOrganization();
const workspacesInOrg = workspaces.filter((ws) => ws.orgId === currentOrg?.id);
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
index c81ad70475..f1173447c1 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
@@ -13,7 +13,7 @@ import {
} from "@app/context";
import { Timezone } from "@app/helpers/datetime";
import { withPermission, withProjectPermission } from "@app/hoc";
-import { Project } from "@app/hooks/api/workspace/types";
+import { Project } from "@app/hooks/api/projects/types";
import { usePopUp } from "@app/hooks/usePopUp";
import { LogsDateFilter } from "./LogsDateFilter";
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/types.tsx b/frontend/src/pages/organization/AuditLogsPage/components/types.tsx
index 8e0ec9ba98..b1338be24b 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/types.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/types.tsx
@@ -1,7 +1,7 @@
import { z } from "zod";
import { ActorType, EventType, UserAgentType } from "@app/hooks/api/auditLogs/enums";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
export enum AuditLogDateFilterType {
Relative = "relative",
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx
index a0565d50da..2e5c7101c7 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx
@@ -17,7 +17,7 @@ import {
useAddIdentityToWorkspace,
useGetIdentityProjectMemberships,
useGetProjectRoles,
- useGetUserWorkspaces,
+ useGetUserProjects,
useGetWorkspaceById
} from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -44,7 +44,7 @@ type Props = {
const Content = ({ identityId, handlePopUpToggle }: Omit<Props, "popUp">) => {
const { currentOrg } = useOrganization();
- const { data: workspaces = [] } = useGetUserWorkspaces();
+ const { data: workspaces = [] } = useGetUserProjects();
const { mutateAsync: addIdentityToWorkspace } = useAddIdentityToWorkspace();
const {
@@ -77,7 +77,7 @@ const Content = ({ identityId, handlePopUpToggle }: Omit<Props, "popUp">) => {
const onFormSubmit = async ({ project: selectedProject, role }: FormData) => {
try {
await addIdentityToWorkspace({
- workspaceId: selectedProject.id,
+ projectId: selectedProject.id,
identityId,
role: role.slug || undefined
});
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectRow.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectRow.tsx
index 5b0aac0b79..1622962ea5 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectRow.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectRow.tsx
@@ -8,7 +8,7 @@ import { createNotification } from "@app/components/notifications";
import { IconButton, Td, Tooltip, Tr } from "@app/components/v2";
import { getProjectBaseURL } from "@app/helpers/project";
import { formatProjectRoleName } from "@app/helpers/roles";
-import { useGetUserWorkspaces } from "@app/hooks/api";
+import { useGetUserProjects } from "@app/hooks/api";
import { IdentityMembership } from "@app/hooks/api/identities/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -31,7 +31,7 @@ export const IdentityProjectRow = ({
membership: { id, createdAt, identity, project, roles },
handlePopUpOpen
}: Props) => {
- const { data: workspaces } = useGetUserWorkspaces();
+ const { data: workspaces } = useGetUserProjects();
const navigate = useNavigate();
const isAccessible = useMemo(() => {
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsSection.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsSection.tsx
index 0ea97c4d30..de0573b7b5 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsSection.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsSection.tsx
@@ -25,7 +25,7 @@ export const IdentityProjectsSection = ({ identityId }: Props) => {
try {
await deleteMutateAsync({
identityId: id,
- workspaceId: projectId
+ projectId: projectId
});
createNotification({
diff --git a/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx b/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx
index 3eb1431479..cc533be852 100644
--- a/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx
+++ b/frontend/src/pages/organization/ProjectsPage/components/AllProjectView.tsx
@@ -48,7 +48,7 @@ import {
useRequestProjectAccess,
useSearchProjects
} from "@app/hooks/api";
-import { ProjectType, Project, WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { ProjectType, Project, ProjectEnv } from "@app/hooks/api/projects/types";
import {
ProjectListToggle,
ProjectListView
@@ -155,7 +155,7 @@ export const AllProjectView = ({
const handleAccessProject = async (
type: ProjectType,
projectId: string,
- environments: WorkspaceEnv[]
+ environments: ProjectEnv[]
) => {
try {
await orgAdminAccessProject.mutateAsync({
diff --git a/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx b/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx
index 8987069ec4..b20bde224f 100644
--- a/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx
+++ b/frontend/src/pages/organization/ProjectsPage/components/MyProjectView.tsx
@@ -39,11 +39,11 @@ import {
setUserTablePreference
} from "@app/helpers/userTablePreferences";
import { usePagination, useResetPageHelper } from "@app/hooks";
-import { useGetUserWorkspaces } from "@app/hooks/api";
+import { useGetUserProjects } from "@app/hooks/api";
import { OrderByDirection } from "@app/hooks/api/generic/types";
import { useUpdateUserProjectFavorites } from "@app/hooks/api/users/mutation";
import { useGetUserProjectFavorites } from "@app/hooks/api/users/queries";
-import { ProjectType, Project } from "@app/hooks/api/workspace/types";
+import { ProjectType, Project } from "@app/hooks/api/projects/types";
import {
ProjectListToggle,
ProjectListView
@@ -79,7 +79,7 @@ export const MyProjectView = ({
{}
);
- const { data: workspaces = [], isPending: isWorkspaceLoading } = useGetUserWorkspaces();
+ const { data: workspaces = [], isPending: isWorkspaceLoading } = useGetUserProjects();
const {
setPage,
perPage,
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx b/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx
index c3ecdfa79a..c0f7de0c83 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx
@@ -8,7 +8,7 @@ import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
import { getProjectTitle } from "@app/helpers/project";
import { usePopUp } from "@app/hooks";
import { TProjectTemplate, useDeleteProjectTemplate } from "@app/hooks/api/projectTemplates";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import { ProjectTemplateDetailsModal } from "../../ProjectTemplateDetailsModal";
import { ProjectTemplateEnvironmentsForm } from "./ProjectTemplateEnvironmentsForm";
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplateDetailsModal.tsx b/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplateDetailsModal.tsx
index 3c5e138e3c..113971ef69 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplateDetailsModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplateDetailsModal.tsx
@@ -20,7 +20,7 @@ import {
useCreateProjectTemplate,
useUpdateProjectTemplate
} from "@app/hooks/api/projectTemplates";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import { slugSchema } from "@app/lib/schemas";
const formSchema = z.object({
diff --git a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserAddToProjectModal.tsx b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserAddToProjectModal.tsx
index bd19db761f..572be1d817 100644
--- a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserAddToProjectModal.tsx
+++ b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserAddToProjectModal.tsx
@@ -9,9 +9,9 @@ import { useOrganization } from "@app/context";
import {
useAddUserToWsNonE2EE,
useGetOrgMembershipProjectMemberships,
- useGetUserWorkspaces
+ useGetUserProjects
} from "@app/hooks/api";
-import { ProjectVersion } from "@app/hooks/api/workspace/types";
+import { ProjectVersion } from "@app/hooks/api/projects/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
const schema = z
@@ -34,7 +34,7 @@ type Props = {
const UserAddToProjectModalChild = ({ membershipId, popUp, handlePopUpToggle }: Props) => {
const { currentOrg } = useOrganization();
const orgId = currentOrg?.id || "";
- const { data: workspaces = [] } = useGetUserWorkspaces();
+ const { data: workspaces = [] } = useGetUserProjects();
const { mutateAsync: addUserToWorkspaceNonE2EE } = useAddUserToWsNonE2EE();
diff --git a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectRow.tsx b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectRow.tsx
index aac501fce0..a7a88a72c4 100644
--- a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectRow.tsx
+++ b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectRow.tsx
@@ -7,7 +7,7 @@ import { createNotification } from "@app/components/notifications";
import { IconButton, Td, Tooltip, Tr } from "@app/components/v2";
import { getProjectBaseURL } from "@app/helpers/project";
import { formatProjectRoleName } from "@app/helpers/roles";
-import { useGetUserWorkspaces } from "@app/hooks/api";
+import { useGetUserProjects } from "@app/hooks/api";
import { TWorkspaceUser } from "@app/hooks/api/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { OrgAccessControlTabSections } from "@app/types/org";
@@ -24,7 +24,7 @@ export const UserProjectRow = ({
membership: { id, project, user, roles },
handlePopUpOpen
}: Props) => {
- const { data: workspaces = [] } = useGetUserWorkspaces();
+ const { data: workspaces = [] } = useGetUserProjects();
const navigate = useNavigate();
const isAccessible = useMemo(() => {
diff --git a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsSection.tsx b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsSection.tsx
index c93e1fa8be..e06ed390d0 100644
--- a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsSection.tsx
+++ b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsSection.tsx
@@ -32,7 +32,7 @@ export const UserProjectsSection = ({ membershipId }: Props) => {
const handleRemoveUser = async (projectId: string, username: string) => {
try {
- await removeUserFromWorkspace({ workspaceId: projectId, usernames: [username], orgId });
+ await removeUserFromWorkspace({ projectId, usernames: [username], orgId });
createNotification({
text: "Successfully removed user from project",
type: "success"
diff --git a/frontend/src/pages/project/AccessControlPage/AccessControlPage.tsx b/frontend/src/pages/project/AccessControlPage/AccessControlPage.tsx
index 8bb007e889..9da8770d22 100644
--- a/frontend/src/pages/project/AccessControlPage/AccessControlPage.tsx
+++ b/frontend/src/pages/project/AccessControlPage/AccessControlPage.tsx
@@ -3,9 +3,9 @@ import { useTranslation } from "react-i18next";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import { ProjectAccessControlTabs } from "@app/types/project";
import {
@@ -18,7 +18,7 @@ import {
const Page = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const selectedTab = useSearch({
strict: false,
select: (el) => el.selectedTab
@@ -26,15 +26,15 @@ const Page = () => {
const updateSelectedTab = (tab: string) => {
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/access-management` as const,
+ to: `${getProjectBaseURL(currentProject.type)}/access-management` as const,
search: (prev) => ({ ...prev, selectedTab: tab }),
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}
});
};
- const isSecretManager = currentWorkspace.type === ProjectType.SecretManager;
+ const isSecretManager = currentProject.type === ProjectType.SecretManager;
return (
<div className="container mx-auto flex flex-col justify-between bg-bunker-800 text-white">
diff --git a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx
index f909f92b44..a279bd1b01 100644
--- a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx
@@ -6,7 +6,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FilterableSelect, FormControl, Modal, ModalContent } from "@app/components/v2";
-import { useOrganization, useWorkspace } from "@app/context";
+import { useOrganization, useProject } from "@app/context";
import {
useAddGroupToWorkspace,
useGetOrganizationGroups,
@@ -31,14 +31,14 @@ type Props = {
const Content = ({ popUp, handlePopUpToggle }: Props) => {
const { currentOrg } = useOrganization();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const orgId = currentOrg?.id || "";
const { data: groups } = useGetOrganizationGroups(orgId);
- const { data: groupMemberships } = useListWorkspaceGroups(currentWorkspace?.id || "");
+ const { data: groupMemberships } = useListWorkspaceGroups(currentProject?.id || "");
- const { data: roles } = useGetProjectRoles(currentWorkspace?.id || "");
+ const { data: roles } = useGetProjectRoles(currentProject?.id || "");
const { mutateAsync: addGroupToWorkspaceMutateAsync } = useAddGroupToWorkspace();
@@ -64,7 +64,7 @@ const Content = ({ popUp, handlePopUpToggle }: Props) => {
const onFormSubmit = async ({ group, role }: FormData) => {
try {
await addGroupToWorkspaceMutateAsync({
- projectId: currentWorkspace?.id || "",
+ projectId: currentProject?.id || "",
groupId: group.id,
role: role.slug || undefined
});
diff --git a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
index 91b6d31868..ac5b572c3c 100644
--- a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
@@ -24,13 +24,13 @@ import {
Tag,
Tooltip
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { formatProjectRoleName } from "@app/helpers/roles";
import { usePopUp } from "@app/hooks";
import { useGetProjectRoles, useUpdateGroupWorkspaceRole } from "@app/hooks/api";
import { TGroupMembership } from "@app/hooks/api/groups/types";
import { TProjectRole } from "@app/hooks/api/roles/types";
-import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/workspace/types";
+import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/projects/types";
import { groupBy } from "@app/lib/fn/array";
const temporaryRoleFormSchema = z.object({
@@ -213,7 +213,7 @@ type FormProps = {
};
const GroupRolesForm = ({ projectRoles, roles, groupId, onClose }: FormProps) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [searchRoles, setSearchRoles] = useState("");
@@ -255,7 +255,7 @@ const GroupRolesForm = ({ projectRoles, roles, groupId, onClose }: FormProps) =>
try {
await updateGroupWorkspaceRole.mutateAsync({
- projectId: currentWorkspace?.id || "",
+ projectId: currentProject?.id || "",
groupId,
roles: selectedRoles
});
@@ -373,11 +373,11 @@ export const GroupRoles = ({
className,
popperContentProps
}: TMemberRolesProp) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { popUp, handlePopUpToggle } = usePopUp(["editRole"] as const);
const { data: projectRoles, isPending: isRolesLoading } = useGetProjectRoles(
- currentWorkspace?.id ?? ""
+ currentProject?.id ?? ""
);
return (
diff --git a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsSection.tsx b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsSection.tsx
index 5ba6082e18..0470953ae7 100644
--- a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsSection.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsSection.tsx
@@ -9,7 +9,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { usePopUp } from "@app/hooks";
import { useDeleteGroupFromWorkspace } from "@app/hooks/api";
@@ -19,7 +19,7 @@ import { GroupTable } from "./GroupsTable";
export const GroupsSection = () => {
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync: deleteMutateAsync } = useDeleteGroupFromWorkspace();
@@ -44,7 +44,7 @@ export const GroupsSection = () => {
try {
await deleteMutateAsync({
groupId,
- projectId: currentWorkspace?.id || ""
+ projectId: currentProject?.id || ""
});
createNotification({
diff --git a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsTable.tsx b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsTable.tsx
index 9bd98084eb..3ce5b40623 100644
--- a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsTable.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsTable.tsx
@@ -32,7 +32,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import {
getUserTablePreference,
@@ -61,7 +61,7 @@ enum GroupsOrderBy {
}
export const GroupTable = ({ handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate();
const {
@@ -85,7 +85,7 @@ export const GroupTable = ({ handlePopUpOpen }: Props) => {
};
const { data: groupMemberships = [], isPending } = useListWorkspaceGroups(
- currentWorkspace?.id || ""
+ currentProject?.id || ""
);
const filteredGroupMemberships = useMemo(() => {
@@ -159,9 +159,9 @@ export const GroupTable = ({ handlePopUpOpen }: Props) => {
onKeyDown={(evt) => {
if (evt.key === "Enter") {
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/groups/$groupId` as const,
+ to: `${getProjectBaseURL(currentProject.type)}/groups/$groupId` as const,
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
groupId: id
}
});
@@ -169,9 +169,9 @@ export const GroupTable = ({ handlePopUpOpen }: Props) => {
}}
onClick={() =>
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/groups/$groupId` as const,
+ to: `${getProjectBaseURL(currentProject.type)}/groups/$groupId` as const,
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
groupId: id
}
})
diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
index 5b6e773dbc..7fbe999345 100644
--- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
@@ -45,7 +45,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import { formatProjectRoleName } from "@app/helpers/roles";
import {
@@ -57,7 +57,7 @@ import { withProjectPermission } from "@app/hoc";
import { usePagination, useResetPageHelper } from "@app/hooks";
import { useDeleteIdentityFromWorkspace, useGetWorkspaceIdentityMemberships } from "@app/hooks/api";
import { OrderByDirection } from "@app/hooks/api/generic/types";
-import { ProjectIdentityOrderBy } from "@app/hooks/api/workspace/types";
+import { ProjectIdentityOrderBy } from "@app/hooks/api/projects/types";
import { usePopUp } from "@app/hooks/usePopUp";
import { IdentityModal } from "./components/IdentityModal";
@@ -66,7 +66,7 @@ const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
export const IdentityTab = withProjectPermission(
() => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject, projectId } = useProject();
const navigate = useNavigate();
const {
@@ -92,11 +92,9 @@ export const IdentityTab = withProjectPermission(
setUserTablePreference("projectIdentityTable", PreferenceKey.PerPage, newPerPage);
};
- const workspaceId = currentWorkspace?.id ?? "";
-
const { data, isPending, isFetching } = useGetWorkspaceIdentityMemberships(
{
- workspaceId: currentWorkspace?.id || "",
+ projectId,
offset,
limit,
orderDirection,
@@ -126,7 +124,7 @@ export const IdentityTab = withProjectPermission(
try {
await deleteMutateAsync({
identityId,
- workspaceId
+ projectId
});
createNotification({
@@ -261,9 +259,9 @@ export const IdentityTab = withProjectPermission(
onKeyDown={(evt) => {
if (evt.key === "Enter") {
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/identities/$identityId` as const,
+ to: `${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const,
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
identityId: id
}
});
@@ -271,9 +269,9 @@ export const IdentityTab = withProjectPermission(
}}
onClick={() =>
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/identities/$identityId` as const,
+ to: `${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const,
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
identityId: id
}
})
diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/IdentityModal.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/IdentityModal.tsx
index 1baf80b9b1..7261ba8394 100644
--- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/IdentityModal.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/IdentityModal.tsx
@@ -14,7 +14,7 @@ import {
ModalContent,
Spinner
} from "@app/components/v2";
-import { useOrganization, useWorkspace } from "@app/context";
+import { useOrganization, useProject } from "@app/context";
import {
useAddIdentityToWorkspace,
useGetIdentityMembershipOrgs,
@@ -37,10 +37,9 @@ type Props = {
const Content = ({ popUp, handlePopUpToggle }: Props) => {
const { currentOrg } = useOrganization();
- const { currentWorkspace } = useWorkspace();
+ const { projectId } = useProject();
const organizationId = currentOrg?.id || "";
- const workspaceId = currentWorkspace?.id || "";
const { data: identityMembershipOrgsData, isPending: isMembershipsLoading } =
useGetIdentityMembershipOrgs({
@@ -49,12 +48,12 @@ const Content = ({ popUp, handlePopUpToggle }: Props) => {
});
const identityMembershipOrgs = identityMembershipOrgsData?.identityMemberships;
const { data: identityMembershipsData } = useGetWorkspaceIdentityMemberships({
- workspaceId,
+ projectId,
limit: 20000 // TODO: this is temp to preserve functionality for larger projects, will optimize in PR referenced above
});
const identityMemberships = identityMembershipsData?.identityMemberships;
- const { data: roles, isPending: isRolesLoading } = useGetProjectRoles(workspaceId);
+ const { data: roles, isPending: isRolesLoading } = useGetProjectRoles(projectId);
const { mutateAsync: addIdentityToWorkspaceMutateAsync } = useAddIdentityToWorkspace();
@@ -80,7 +79,7 @@ const Content = ({ popUp, handlePopUpToggle }: Props) => {
const onFormSubmit = async ({ identity, role }: FormData) => {
try {
await addIdentityToWorkspaceMutateAsync({
- workspaceId,
+ projectId,
identityId: identity.id,
role: role.slug || undefined
});
diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/AddMemberModal.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/AddMemberModal.tsx
index d9c9a87185..7124b80a3b 100644
--- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/AddMemberModal.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/AddMemberModal.tsx
@@ -22,7 +22,7 @@ import {
OrgPermissionSubjects,
useOrganization,
useOrgPermission,
- useWorkspace
+ useProject
} from "@app/context";
import {
useAddUsersToOrg,
@@ -31,7 +31,7 @@ import {
useGetWorkspaceUsers
} from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
-import { ProjectVersion } from "@app/hooks/api/workspace/types";
+import { ProjectVersion } from "@app/hooks/api/projects/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
const addMemberFormSchema = z.object({
@@ -57,7 +57,7 @@ type Props = {
export const AddMemberModal = ({ popUp, handlePopUpToggle }: Props) => {
const { t } = useTranslation();
const { currentOrg } = useOrganization();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate({ from: "" });
const { permission } = useOrgPermission();
const requesterEmail = useSearch({
@@ -66,12 +66,12 @@ export const AddMemberModal = ({ popUp, handlePopUpToggle }: Props) => {
});
const orgId = currentOrg?.id || "";
- const workspaceId = currentWorkspace?.id || "";
+ const workspaceId = currentProject?.id || "";
const { data: members } = useGetWorkspaceUsers(workspaceId);
const { data: orgUsers } = useGetOrgUsers(orgId);
- const { data: roles } = useGetProjectRoles(currentWorkspace?.id || "");
+ const { data: roles } = useGetProjectRoles(currentProject?.id || "");
const {
control,
@@ -94,7 +94,7 @@ export const AddMemberModal = ({ popUp, handlePopUpToggle }: Props) => {
}, [requesterEmail]);
const onAddMembers = async ({ orgMemberships, projectRoleSlugs }: TAddMemberForm) => {
- if (!currentWorkspace) return;
+ if (!currentProject) return;
if (!currentOrg?.id) return;
const existingMembers = orgMemberships.filter((membership) => !membership.isNewInvitee);
@@ -109,7 +109,7 @@ export const AddMemberModal = ({ popUp, handlePopUpToggle }: Props) => {
if (!selectedMembers) return;
try {
- if (currentWorkspace.version === ProjectVersion.V1) {
+ if (currentProject.version === ProjectVersion.V1) {
createNotification({
type: "error",
text: "Please upgrade your project to invite new members to the project."
@@ -146,8 +146,8 @@ export const AddMemberModal = ({ popUp, handlePopUpToggle }: Props) => {
organizationRoleSlug: ProjectMembershipRole.Member, // only applies to new invites
projects: [
{
- slug: currentWorkspace.slug,
- id: currentWorkspace.id,
+ slug: currentProject.slug,
+ id: currentProject.id,
projectRoleSlug: projectRoleSlugs.map((role) => role.slug)
}
]
diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/MemberRbacSection.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/MemberRbacSection.tsx
index d18f8715a1..b2b73dbcfe 100644
--- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/MemberRbacSection.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/MemberRbacSection.tsx
@@ -31,12 +31,12 @@ import {
ProjectPermissionSub,
useProjectPermission,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { useGetProjectRoles, useUpdateUserWorkspaceRole } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { TWorkspaceUser } from "@app/hooks/api/types";
-import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/workspace/types";
+import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/projects/types";
const roleFormSchema = z.object({
roles: z
@@ -64,9 +64,8 @@ type Props = {
};
export const MemberRbacSection = ({ projectMember, onOpenUpgradeModal }: Props) => {
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
- const workspaceId = currentWorkspace?.id || "";
- const { data: projectRoles, isPending: isRolesLoading } = useGetProjectRoles(workspaceId);
+ const { projectId } = useProject();
+ const { data: projectRoles, isPending: isRolesLoading } = useGetProjectRoles(projectId);
const { permission } = useProjectPermission();
const isMemberEditDisabled = permission.cannot(
ProjectPermissionMemberActions.Edit,
@@ -130,7 +129,7 @@ export const MemberRbacSection = ({ projectMember, onOpenUpgradeModal }: Props)
try {
await updateMembershipRole.mutateAsync({
- workspaceId,
+ projectId,
membershipId: projectMember.id,
roles: sanitizedRoles
});
diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/MemberRoleForm.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/MemberRoleForm.tsx
index 7352572938..187e1813a0 100644
--- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/MemberRoleForm.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/MemberRoleForm.tsx
@@ -1,7 +1,7 @@
import { Link } from "@tanstack/react-router";
import { Alert, AlertDescription } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import { TWorkspaceUser } from "@app/hooks/api/types";
@@ -12,7 +12,7 @@ type Props = {
onOpenUpgradeModal: (title: string) => void;
};
export const MemberRoleForm = ({ projectMember, onOpenUpgradeModal }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
return (
<div>
<MemberRbacSection projectMember={projectMember} onOpenUpgradeModal={onOpenUpgradeModal} />
@@ -22,9 +22,9 @@ export const MemberRoleForm = ({ projectMember, onOpenUpgradeModal }: Props) =>
>
<AlertDescription>
<Link
- to={`${getProjectBaseURL(currentWorkspace.type)}/members/$membershipId` as const}
+ to={`${getProjectBaseURL(currentProject.type)}/members/$membershipId` as const}
params={{
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
membershipId: projectMember.id
}}
>
diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx
index 5dd4397444..43f1490ceb 100644
--- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx
@@ -44,7 +44,7 @@ import {
ProjectPermissionMemberActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { removeTrailingSlash } from "@app/helpers/string";
import { usePopUp } from "@app/hooks";
@@ -89,7 +89,7 @@ export const SpecificPrivilegeSecretForm = ({
secretPath?: string;
onClose?: () => void;
}) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
"deletePrivilege",
@@ -129,7 +129,7 @@ export const SpecificPrivilegeSecretForm = ({
temporaryAccess: privilege
}
: {
- environmentSlug: currentWorkspace.environments?.[0]?.slug,
+ environmentSlug: currentProject.environments?.[0]?.slug,
secretPath: initialSecretPath,
read: selectedActions.includes(ProjectPermissionActions.Read),
edit: selectedActions.includes(ProjectPermissionActions.Edit),
@@ -202,7 +202,7 @@ export const SpecificPrivilegeSecretForm = ({
// This is used for requesting access additional privileges, not directly creating a privilege!
const handleRequestAccess = async (data: TSecretPermissionForm) => {
if (!policies) return;
- if (!currentWorkspace) {
+ if (!currentProject) {
createNotification({
type: "error",
text: "No workspace found.",
@@ -253,7 +253,7 @@ export const SpecificPrivilegeSecretForm = ({
...(data.temporaryAccess.isTemporary && {
temporaryRange: data.temporaryAccess.temporaryRange
}),
- projectSlug: currentWorkspace.slug,
+ projectSlug: currentProject.slug,
isTemporary: data.temporaryAccess.isTemporary,
permissions: actions
.filter(({ allowed }) => allowed)
@@ -307,7 +307,7 @@ export const SpecificPrivilegeSecretForm = ({
position="popper"
dropdownContainerClassName="max-w-none"
>
- {currentWorkspace?.environments?.map(({ slug, id, name }) => (
+ {currentProject?.environments?.map(({ slug, id, name }) => (
<SelectItem value={slug} key={id}>
{name}
</SelectItem>
diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersSection.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersSection.tsx
index a8ecde73ae..da56164532 100644
--- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersSection.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersSection.tsx
@@ -9,7 +9,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useOrganization,
- useWorkspace
+ useProject
} from "@app/context";
import { usePopUp } from "@app/hooks";
import { useDeleteUserFromWorkspace } from "@app/hooks/api";
@@ -19,7 +19,7 @@ import { MembersTable } from "./MembersTable";
export const MembersSection = () => {
const { currentOrg } = useOrganization();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync: removeUserFromWorkspace } = useDeleteUserFromWorkspace();
@@ -32,11 +32,11 @@ export const MembersSection = () => {
const handleRemoveUser = async () => {
const username = (popUp?.removeMember?.data as { username: string })?.username;
if (!currentOrg?.id) return;
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
try {
await removeUserFromWorkspace({
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
usernames: [username],
orgId: currentOrg.id
});
diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx
index 2cbe144ee4..5103430ef8 100644
--- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx
@@ -44,12 +44,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import {
- ProjectPermissionActions,
- ProjectPermissionSub,
- useUser,
- useWorkspace
-} from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useUser, useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import { formatProjectRoleName } from "@app/helpers/roles";
import {
@@ -81,7 +76,7 @@ type Filter = {
};
export const MembersTable = ({ handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { user } = useUser();
const navigate = useNavigate();
const [filter, setFilter] = useState<Filter>({
@@ -90,7 +85,7 @@ export const MembersTable = ({ handlePopUpOpen }: Props) => {
const filterRoles = useMemo(() => filter.roles, [filter.roles]);
const userId = user?.id || "";
- const workspaceId = currentWorkspace?.id || "";
+ const workspaceId = currentProject?.id || "";
const { data: projectRoles } = useGetProjectRoles(workspaceId);
const {
@@ -312,7 +307,7 @@ export const MembersTable = ({ handlePopUpOpen }: Props) => {
onKeyDown={(evt) => {
if (evt.key === "Enter") {
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/members/$membershipId`,
+ to: `${getProjectBaseURL(currentProject.type)}/members/$membershipId`,
params: {
projectId: workspaceId,
membershipId
@@ -322,7 +317,7 @@ export const MembersTable = ({ handlePopUpOpen }: Props) => {
}}
onClick={() =>
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/members/$membershipId`,
+ to: `${getProjectBaseURL(currentProject.type)}/members/$membershipId`,
params: {
projectId: workspaceId,
membershipId
diff --git a/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx b/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx
index 211f1d0e81..e7b3b10b8d 100644
--- a/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx
@@ -39,7 +39,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import { isCustomProjectRole } from "@app/helpers/roles";
import {
@@ -67,8 +67,8 @@ export const ProjectRoleList = () => {
"deleteRole",
"duplicateRole"
] as const);
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data: roles, isPending: isRolesLoading } = useGetProjectRoles(projectId);
@@ -250,9 +250,9 @@ export const ProjectRoleList = () => {
className="h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
onClick={() =>
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/roles/$roleSlug`,
+ to: `${getProjectBaseURL(currentProject.type)}/roles/$roleSlug`,
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
roleSlug: slug
}
})
@@ -292,9 +292,9 @@ export const ProjectRoleList = () => {
onClick={(e) => {
e.stopPropagation();
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/roles/$roleSlug`,
+ to: `${getProjectBaseURL(currentProject.type)}/roles/$roleSlug`,
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
roleSlug: slug
}
});
diff --git a/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx b/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx
index 8264d47bf6..d63b6bb9c8 100644
--- a/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx
@@ -22,7 +22,7 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useToggle } from "@app/hooks";
import { useCreateServiceToken } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -70,7 +70,7 @@ type Props = {
const ServiceTokenForm = () => {
const { t } = useTranslation();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const {
control,
handleSubmit,
@@ -81,7 +81,7 @@ const ServiceTokenForm = () => {
scopes: [
{
secretPath: "/",
- environment: currentWorkspace?.environments?.[0]?.slug
+ environment: currentProject?.environments?.[0]?.slug
}
]
}
@@ -111,7 +111,7 @@ const ServiceTokenForm = () => {
const onFormSubmit = async ({ name, scopes, expiresIn, permissions }: FormData) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
const randomBytes = crypto.randomBytes(16).toString("hex");
@@ -122,7 +122,7 @@ const ServiceTokenForm = () => {
scopes,
expiresIn: Number(expiresIn),
name,
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
randomBytes,
permissions: Object.entries(permissions)
.filter(([, permissionsValue]) => permissionsValue)
@@ -172,7 +172,7 @@ const ServiceTokenForm = () => {
<Controller
control={control}
name={`scopes.${index}.environment`}
- defaultValue={currentWorkspace?.environments?.[0]?.slug}
+ defaultValue={currentProject?.environments?.[0]?.slug}
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
<FormControl
className="mb-0"
@@ -186,7 +186,7 @@ const ServiceTokenForm = () => {
onValueChange={(e) => onChange(e)}
className="w-full"
>
- {currentWorkspace?.environments.map(({ name, slug }) => (
+ {currentProject?.environments.map(({ name, slug }) => (
<SelectItem value={slug} key={slug}>
{name}
</SelectItem>
@@ -225,7 +225,7 @@ const ServiceTokenForm = () => {
variant="outline_bg"
onClick={() =>
append({
- environment: currentWorkspace?.environments?.[0]?.slug || "",
+ environment: currentProject?.environments?.[0]?.slug || "",
secretPath: ""
})
}
@@ -334,7 +334,7 @@ const ServiceTokenForm = () => {
export const AddServiceTokenModal = ({ popUp, handlePopUpToggle }: Props) => {
const { t } = useTranslation();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
return (
<Modal
@@ -346,7 +346,7 @@ export const AddServiceTokenModal = ({ popUp, handlePopUpToggle }: Props) => {
<ModalContent
title={
t("section.token.add-dialog.title", {
- target: currentWorkspace?.name
+ target: currentProject?.name
}) as string
}
subTitle={t("section.token.add-dialog.description") as string}
diff --git a/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/ServiceTokenTable.tsx b/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/ServiceTokenTable.tsx
index 4f364b6b63..5c0c70ebb1 100644
--- a/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/ServiceTokenTable.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/ServiceTokenTable.tsx
@@ -33,7 +33,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import {
getUserTablePreference,
PreferenceKey,
@@ -63,9 +63,9 @@ enum TokensOrderBy {
}
export const ServiceTokenTable = ({ handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data, isPending } = useGetUserWsServiceTokens({
- workspaceID: currentWorkspace?.id || ""
+ workspaceID: currentProject?.id || ""
});
const {
diff --git a/frontend/src/pages/project/AuditLogsPage/AuditLogsPage.tsx b/frontend/src/pages/project/AuditLogsPage/AuditLogsPage.tsx
index 0c83b05204..1e9b1ad547 100644
--- a/frontend/src/pages/project/AuditLogsPage/AuditLogsPage.tsx
+++ b/frontend/src/pages/project/AuditLogsPage/AuditLogsPage.tsx
@@ -1,11 +1,11 @@
import { Helmet } from "react-helmet";
import { PageHeader } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { LogsSection } from "@app/pages/organization/AuditLogsPage/components";
export const AuditLogsPage = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
return (
<div className="container mx-auto flex flex-col justify-between bg-bunker-800 text-white">
@@ -19,7 +19,7 @@ export const AuditLogsPage = () => {
title="Audit logs"
description="Audit logs for security and compliance teams to monitor information access."
/>
- <LogsSection pageView project={currentWorkspace} />
+ <LogsSection pageView project={currentProject} />
</div>
</div>
</div>
diff --git a/frontend/src/pages/project/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx b/frontend/src/pages/project/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
index a3dfabcd01..d6bda7ea10 100644
--- a/frontend/src/pages/project/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
+++ b/frontend/src/pages/project/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
@@ -4,8 +4,8 @@ import { useParams } from "@tanstack/react-router";
import { ProjectPermissionCan } from "@app/components/permissions";
import { EmptyState, PageHeader, Spinner } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
-import { useGetWorkspaceGroupMembershipDetails } from "@app/hooks/api/workspace/queries";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
+import { useGetWorkspaceGroupMembershipDetails } from "@app/hooks/api/projects/queries";
import { GroupDetailsSection } from "./components/GroupDetailsSection";
import { GroupMembersSection } from "./components/GroupMembersSection";
@@ -16,10 +16,10 @@ const Page = () => {
select: (el) => el.groupId as string
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: groupMembership, isPending } = useGetWorkspaceGroupMembershipDetails(
- currentWorkspace.id,
+ currentProject.id,
groupId
);
diff --git a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupDetailsSection.tsx b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupDetailsSection.tsx
index 90c3270673..0689d674ad 100644
--- a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupDetailsSection.tsx
+++ b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupDetailsSection.tsx
@@ -14,7 +14,7 @@ import {
IconButton
} from "@app/components/v2";
import { CopyButton } from "@app/components/v2/CopyButton";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import { usePopUp } from "@app/hooks";
import { useDeleteGroupFromWorkspace } from "@app/hooks/api";
@@ -31,14 +31,14 @@ export const GroupDetailsSection = ({ groupMembership }: Props) => {
] as const);
const { mutateAsync: deleteMutateAsync } = useDeleteGroupFromWorkspace();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate();
const onRemoveGroupSubmit = async () => {
try {
await deleteMutateAsync({
groupId: groupMembership.group.id,
- projectId: currentWorkspace.id
+ projectId: currentProject.id
});
createNotification({
@@ -47,9 +47,9 @@ export const GroupDetailsSection = ({ groupMembership }: Props) => {
});
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/access-management`,
+ to: `${getProjectBaseURL(currentProject.type)}/access-management`,
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: "groups"
diff --git a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx
index 7d155ba43c..1df989602d 100644
--- a/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx
+++ b/frontend/src/pages/project/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersTable.tsx
@@ -23,7 +23,7 @@ import {
THead,
Tr
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { getProjectHomePage } from "@app/helpers/project";
import {
getUserTablePreference,
@@ -69,12 +69,12 @@ export const GroupMembersTable = ({ groupMembership }: Props) => {
setUserTablePreference("projectGroupMembersTable", PreferenceKey.PerPage, newPerPage);
};
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: groupMemberships, isPending } = useListProjectGroupUsers({
id: groupMembership.group.id,
groupSlug: groupMembership.group.slug,
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
offset,
limit: perPage,
search,
@@ -127,7 +127,7 @@ export const GroupMembersTable = ({ groupMembership }: Props) => {
{
actorId: userId,
actorType: ActorType.USER,
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
{
onSuccess: () => {
@@ -136,8 +136,8 @@ export const GroupMembersTable = ({ groupMembership }: Props) => {
text: "User privilege assumption has started"
});
- const url = getProjectHomePage(currentWorkspace.type, currentWorkspace.environments);
- window.location.href = url.replace("$projectId", currentWorkspace.id);
+ const url = getProjectHomePage(currentProject.type, currentProject.environments);
+ window.location.href = url.replace("$projectId", currentProject.id);
}
}
);
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
index e1da4edabf..44cc00e3b4 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
@@ -18,7 +18,7 @@ import {
ProjectPermissionActions,
ProjectPermissionIdentityActions,
ProjectPermissionSub,
- useWorkspace
+ useProject
} from "@app/context";
import { getProjectBaseURL, getProjectHomePage } from "@app/helpers/project";
import { usePopUp } from "@app/hooks";
@@ -38,12 +38,10 @@ const Page = () => {
strict: false,
select: (el) => el.identityId as string
});
- const { currentWorkspace } = useWorkspace();
-
- const workspaceId = currentWorkspace?.id || "";
+ const { currentProject, projectId } = useProject();
const { data: identityMembershipDetails, isPending: isMembershipDetailsLoading } =
- useGetWorkspaceIdentityMembershipDetails(workspaceId, identityId);
+ useGetWorkspaceIdentityMembershipDetails(projectId, identityId);
const { mutateAsync: deleteMutateAsync, isPending: isDeletingIdentity } =
useDeleteIdentityFromWorkspace();
@@ -59,7 +57,7 @@ const Page = () => {
{
actorId: identityId,
actorType: ActorType.IDENTITY,
- projectId: workspaceId
+ projectId: projectId
},
{
onSuccess: () => {
@@ -67,8 +65,8 @@ const Page = () => {
type: "success",
text: "Identity privilege assumption has started"
});
- const url = getProjectHomePage(currentWorkspace.type, currentWorkspace.environments);
- window.location.href = url.replace("$projectId", currentWorkspace.id);
+ const url = getProjectHomePage(currentProject.type, currentProject.environments);
+ window.location.href = url.replace("$projectId", currentProject.id);
}
}
);
@@ -78,7 +76,7 @@ const Page = () => {
try {
await deleteMutateAsync({
identityId,
- workspaceId
+ projectId
});
createNotification({
text: "Successfully removed identity from project",
@@ -86,9 +84,9 @@ const Page = () => {
});
handlePopUpClose("deleteIdentity");
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/access-management` as const,
+ to: `${getProjectBaseURL(currentProject.type)}/access-management` as const,
params: {
- projectId: workspaceId
+ projectId: projectId
},
search: {
selectedTab: "identities"
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
index fe574a32db..d68dd8fff1 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
@@ -25,7 +25,7 @@ import {
ProjectPermissionIdentityActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import {
useCreateIdentityProjectAdditionalPrivilege,
@@ -78,8 +78,8 @@ export const IdentityProjectAdditionalPrivilegeModifySection = ({
isDisabled
}: Props) => {
const isCreate = !privilegeId;
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data: privilegeDetails, isPending } = useGetIdentityProjectPrivilegeDetails({
identityId,
projectId,
@@ -225,7 +225,7 @@ export const IdentityProjectAdditionalPrivilegeModifySection = ({
>
Save
</Button>
- <AddPoliciesButton isDisabled={isDisabled} projectType={currentWorkspace.type} />
+ <AddPoliciesButton isDisabled={isDisabled} projectType={currentProject.type} />
</div>
</div>
</div>
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleDetailsSection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleDetailsSection.tsx
index 1fa98628e9..eb8653acba 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleDetailsSection.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleDetailsSection.tsx
@@ -23,7 +23,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { formatProjectRoleName } from "@app/helpers/roles";
import { usePopUp } from "@app/hooks";
import { useUpdateIdentityWorkspaceRole } from "@app/hooks/api";
@@ -41,7 +41,7 @@ export const IdentityRoleDetailsSection = ({
identityMembershipDetails,
isMembershipDetailsLoading
}: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
"deleteRole",
"modifyRole"
@@ -53,7 +53,7 @@ export const IdentityRoleDetailsSection = ({
try {
const updatedRoles = identityMembershipDetails?.roles?.filter((el) => el.id !== id);
await updateIdentityWorkspaceRole({
- workspaceId: currentWorkspace?.id || "",
+ projectId: currentProject?.id || "",
identityId: identityMembershipDetails.identity.id,
roles: updatedRoles.map(
({
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleModify.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleModify.tsx
index c5860ec11f..984ec8e33c 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleModify.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleModify.tsx
@@ -30,12 +30,12 @@ import {
ProjectPermissionIdentityActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { useGetProjectRoles, useUpdateIdentityWorkspaceRole } from "@app/hooks/api";
import { IdentityMembership } from "@app/hooks/api/identities/types";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
-import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/workspace/types";
+import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/projects/types";
const roleFormSchema = z.object({
roles: z
@@ -62,9 +62,8 @@ type Props = {
};
export const IdentityRoleModify = ({ identityProjectMembership }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const workspaceId = currentWorkspace?.id || "";
- const { data: projectRoles, isPending: isRolesLoading } = useGetProjectRoles(workspaceId);
+ const { projectId } = useProject();
+ const { data: projectRoles, isPending: isRolesLoading } = useGetProjectRoles(projectId);
const { permission } = useProjectPermission();
const isIdentityEditDisabled = permission.cannot(
ProjectPermissionIdentityActions.Edit,
@@ -117,7 +116,7 @@ export const IdentityRoleModify = ({ identityProjectMembership }: Props) => {
try {
await updateIdentityWorkspaceRole.mutateAsync({
- workspaceId,
+ projectId,
identityId: identityProjectMembership.identity.id,
roles: sanitizedRoles
});
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx
index 7fadf2cb9b..23b8299daf 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx
@@ -19,7 +19,7 @@ import {
ProjectPermissionMemberActions,
ProjectPermissionSub,
useOrganization,
- useWorkspace
+ useProject
} from "@app/context";
import { getProjectBaseURL, getProjectHomePage } from "@app/helpers/project";
import { usePopUp } from "@app/hooks";
@@ -40,12 +40,10 @@ export const Page = () => {
select: (el) => el.membershipId as string
});
const { currentOrg } = useOrganization();
- const { currentWorkspace } = useWorkspace();
-
- const workspaceId = currentWorkspace?.id || "";
+ const { currentProject, projectId } = useProject();
const { data: membershipDetails, isPending: isMembershipDetailsLoading } =
- useGetWorkspaceUserDetails(workspaceId, membershipId);
+ useGetWorkspaceUserDetails(projectId, membershipId);
const { mutateAsync: removeUserFromWorkspace, isPending: isRemovingUserFromWorkspace } =
useDeleteUserFromWorkspace();
@@ -63,7 +61,7 @@ export const Page = () => {
{
actorId: userId,
actorType: ActorType.USER,
- projectId: workspaceId
+ projectId
},
{
onSuccess: () => {
@@ -72,19 +70,19 @@ export const Page = () => {
text: "User privilege assumption has started"
});
- const url = getProjectHomePage(currentWorkspace.type, currentWorkspace.environments);
- window.location.href = url.replace("$projectId", currentWorkspace.id);
+ const url = getProjectHomePage(currentProject.type, currentProject.environments);
+ window.location.href = url.replace("$projectId", currentProject.id);
}
}
);
};
const handleRemoveUser = async () => {
- if (!currentOrg?.id || !currentWorkspace?.id || !membershipDetails?.user?.username) return;
+ if (!currentOrg?.id || !currentProject?.id || !membershipDetails?.user?.username) return;
try {
await removeUserFromWorkspace({
- workspaceId: currentWorkspace.id,
+ projectId,
usernames: [membershipDetails?.user?.username],
orgId: currentOrg.id
});
@@ -93,9 +91,9 @@ export const Page = () => {
type: "success"
});
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/access-management` as const,
+ to: `${getProjectBaseURL(currentProject.type)}/access-management` as const,
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}
});
} catch (error) {
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
index 9817aefdb7..acc6b67af7 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
@@ -24,7 +24,7 @@ import {
ProjectPermissionMemberActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import {
useCreateProjectUserAdditionalPrivilege,
@@ -77,8 +77,8 @@ export const MembershipProjectAdditionalPrivilegeModifySection = ({
isDisabled
}: Props) => {
const isCreate = !privilegeId;
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data: privilegeDetails, isPending } = useGetProjectUserPrivilegeDetails(
privilegeId || ""
);
@@ -221,7 +221,7 @@ export const MembershipProjectAdditionalPrivilegeModifySection = ({
>
Save
</Button>
- <AddPoliciesButton isDisabled={isDisabled} projectType={currentWorkspace.type} />
+ <AddPoliciesButton isDisabled={isDisabled} projectType={currentProject.type} />
</div>
</div>
</div>
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberRoleDetailsSection/MemberRoleDetailsSection.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberRoleDetailsSection/MemberRoleDetailsSection.tsx
index 5ff78360dc..668986e3b9 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberRoleDetailsSection/MemberRoleDetailsSection.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberRoleDetailsSection/MemberRoleDetailsSection.tsx
@@ -22,12 +22,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import {
- ProjectPermissionActions,
- ProjectPermissionSub,
- useUser,
- useWorkspace
-} from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useUser, useProject } from "@app/context";
import { formatProjectRoleName } from "@app/helpers/roles";
import { usePopUp } from "@app/hooks";
import { useUpdateUserWorkspaceRole } from "@app/hooks/api";
@@ -49,7 +44,7 @@ export const MemberRoleDetailsSection = ({
}: Props) => {
const { user } = useUser();
const userId = user?.id;
- const { currentWorkspace } = useWorkspace();
+ const { projectId } = useProject();
const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
"deleteRole",
"modifyRole"
@@ -63,7 +58,7 @@ export const MemberRoleDetailsSection = ({
try {
const updatedRoles = membershipDetails?.roles?.filter((el) => el.id !== id);
await updateUserWorkspaceRole({
- workspaceId: currentWorkspace?.id || "",
+ projectId,
roles: updatedRoles.map(
({
role,
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberRoleDetailsSection/MemberRoleModify.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberRoleDetailsSection/MemberRoleModify.tsx
index 739b22b7d6..13537058f3 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberRoleDetailsSection/MemberRoleModify.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberRoleDetailsSection/MemberRoleModify.tsx
@@ -31,12 +31,12 @@ import {
ProjectPermissionSub,
useProjectPermission,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { useGetProjectRoles, useUpdateUserWorkspaceRole } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { TWorkspaceUser } from "@app/hooks/api/types";
-import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/workspace/types";
+import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/projects/types";
const roleFormSchema = z.object({
roles: z
@@ -65,9 +65,8 @@ type Props = {
export const MemberRoleModify = ({ projectMember, onOpenUpgradeModal }: Props) => {
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
- const workspaceId = currentWorkspace?.id || "";
- const { data: projectRoles, isPending: isRolesLoading } = useGetProjectRoles(workspaceId);
+ const { projectId } = useProject();
+ const { data: projectRoles, isPending: isRolesLoading } = useGetProjectRoles(projectId);
const { permission } = useProjectPermission();
const isMemberEditDisabled = permission.cannot(
ProjectPermissionMemberActions.Edit,
@@ -131,7 +130,7 @@ export const MemberRoleModify = ({ projectMember, onOpenUpgradeModal }: Props) =
try {
await updateMembershipRole.mutateAsync({
- workspaceId,
+ projectId,
membershipId: projectMember.id,
roles: sanitizedRoles
});
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/RoleDetailsBySlugPage.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/RoleDetailsBySlugPage.tsx
index e400767a1b..775244b4dd 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/RoleDetailsBySlugPage.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/RoleDetailsBySlugPage.tsx
@@ -16,7 +16,7 @@ import {
DropdownMenuTrigger,
PageHeader
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import { useDeleteProjectRole, useGetProjectRoleBySlug } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
@@ -33,8 +33,8 @@ const Page = () => {
strict: false,
select: (el) => el.roleSlug as string
});
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data } = useGetProjectRoleBySlug(projectId, roleSlug as string);
@@ -48,7 +48,7 @@ const Page = () => {
const onDeleteRoleSubmit = async () => {
try {
- if (!currentWorkspace?.slug || !data?.id) return;
+ if (!currentProject?.slug || !data?.id) return;
await deleteProjectRole({
projectId,
@@ -61,7 +61,7 @@ const Page = () => {
});
handlePopUpClose("deleteRole");
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/access-management` as const,
+ to: `${getProjectBaseURL(currentProject.type)}/access-management` as const,
params: {
projectId
},
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx
index abdf5c5d59..37f6b38686 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx
@@ -9,7 +9,7 @@ import {
IconButton
} from "@app/components/v2";
import { usePopUp } from "@app/hooks";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import { PolicySelectionModal } from "@app/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal";
import { PolicyTemplateModal } from "@app/pages/project/RoleDetailsBySlugPage/components/PolicyTemplateModal";
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx
index 24974225ea..d365620899 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx
@@ -5,7 +5,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalContent, Spinner } from "@app/components/v2";
-import { ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionSub, useProject } from "@app/context";
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
import { getProjectBaseURL } from "@app/helpers/project";
import { useCreateProjectRole, useGetProjectRoleBySlug } from "@app/hooks/api";
@@ -45,7 +45,7 @@ const Content = ({ role, onClose }: ContentProps) => {
resolver: zodResolver(schema)
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const createRole = useCreateProjectRole();
const navigate = useNavigate();
@@ -70,7 +70,7 @@ const Content = ({ role, onClose }: ContentProps) => {
});
const newRole = await createRole.mutateAsync({
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
permissions: sanitizedPermission,
...form
});
@@ -81,10 +81,10 @@ const Content = ({ role, onClose }: ContentProps) => {
});
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/roles/$roleSlug` as const,
+ to: `${getProjectBaseURL(currentProject.type)}/roles/$roleSlug` as const,
params: {
roleSlug: newRole.slug,
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}
});
@@ -142,9 +142,9 @@ const Content = ({ role, onClose }: ContentProps) => {
};
export const DuplicateProjectRoleModal = ({ isOpen, onOpenChange, roleSlug }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
- const { data: role, isPending } = useGetProjectRoleBySlug(currentWorkspace.id, roleSlug ?? "");
+ const { data: role, isPending } = useGetProjectRoleBySlug(currentProject.id, roleSlug ?? "");
if (!roleSlug) return null;
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
index 845c5f54ec..22e64d48e2 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
@@ -19,7 +19,7 @@ import {
Tr
} from "@app/components/v2";
import { ProjectPermissionSub } from "@app/context";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import {
EXCLUDED_PERMISSION_SUBS,
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicyTemplateModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicyTemplateModal.tsx
index d9cae62446..3064311bc3 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicyTemplateModal.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicyTemplateModal.tsx
@@ -13,7 +13,7 @@ import {
ModalContent
} from "@app/components/v2";
import { ProjectPermissionSub } from "@app/context";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import {
PROJECT_PERMISSION_OBJECT,
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
index 8562753740..123a3ee0c2 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
@@ -33,7 +33,7 @@ import {
TPermissionConditionOperators
} from "@app/context/ProjectPermissionContext/types";
import { TProjectPermission } from "@app/hooks/api/roles/types";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
const GeneralPolicyActionSchema = z.object({
read: z.boolean().optional(),
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx
index eb7a2ba830..e34f868929 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx
@@ -6,7 +6,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { getProjectBaseURL } from "@app/helpers/project";
import {
useCreateProjectRole,
@@ -38,8 +38,8 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
roleSlug: string;
};
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data: role } = useGetProjectRoleBySlug(projectId, popupData?.roleSlug ?? "");
@@ -101,7 +101,7 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
});
navigate({
- to: `${getProjectBaseURL(currentWorkspace.type)}/roles/$roleSlug` as const,
+ to: `${getProjectBaseURL(currentProject.type)}/roles/$roleSlug` as const,
params: {
roleSlug: newRole.slug,
projectId
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
index f50446a8ef..13de1d57b0 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
@@ -8,12 +8,12 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { createNotification } from "@app/components/notifications";
import { AccessTree } from "@app/components/permissions";
import { Button } from "@app/components/v2";
-import { ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionSub, useProject } from "@app/context";
import { ProjectPermissionSet } from "@app/context/ProjectPermissionContext";
import { evaluatePermissionsAbility } from "@app/helpers/permissions";
import { useGetProjectRoleBySlug, useUpdateProjectRole } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import { AddPoliciesButton } from "./AddPoliciesButton";
import { DynamicSecretPermissionConditions } from "./DynamicSecretPermissionConditions";
@@ -84,10 +84,10 @@ export const renderConditionalComponents = (
};
export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data: role, isPending } = useGetProjectRoleBySlug(
- currentWorkspace?.id ?? "",
+ currentProject?.id ?? "",
roleSlug as string
);
@@ -126,7 +126,7 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
(role?.slug ?? "") as ProjectMembershipRole
);
- const isSecretManagerProject = currentWorkspace.type === ProjectType.SecretManager;
+ const isSecretManagerProject = currentProject.type === ProjectType.SecretManager;
const permissions = form.watch("permissions");
@@ -178,7 +178,7 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
Save
</Button>
<div className="ml-2 border-l border-mineshaft-500 pl-4">
- <AddPoliciesButton isDisabled={isDisabled} projectType={currentWorkspace.type} />
+ <AddPoliciesButton isDisabled={isDisabled} projectType={currentProject.type} />
</div>
</div>
)}
diff --git a/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx b/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
index 7c65b18573..b5b442e9ba 100644
--- a/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
+++ b/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
@@ -5,10 +5,10 @@ import { z } from "zod";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input } from "@app/components/v2";
-import { useProjectPermission, useSubscription, useWorkspace } from "@app/context";
+import { useProjectPermission, useSubscription, useProject } from "@app/context";
import { usePopUp } from "@app/hooks";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
-import { useUpdateWorkspaceAuditLogsRetention } from "@app/hooks/api/workspace/queries";
+import { useUpdateWorkspaceAuditLogsRetention } from "@app/hooks/api/projects/queries";
const formSchema = z.object({
auditLogsRetentionDays: z.coerce.number().min(0)
@@ -19,7 +19,7 @@ type TForm = z.infer<typeof formSchema>;
export const AuditLogsRetentionSection = () => {
const { mutateAsync: updateAuditLogsRetention } = useUpdateWorkspaceAuditLogsRetention();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { membership } = useProjectPermission();
const { subscription } = useSubscription();
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
@@ -32,11 +32,11 @@ export const AuditLogsRetentionSection = () => {
resolver: zodResolver(formSchema),
values: {
auditLogsRetentionDays:
- currentWorkspace?.auditLogsRetentionDays ?? subscription?.auditLogsRetentionDays ?? 0
+ currentProject?.auditLogsRetentionDays ?? subscription?.auditLogsRetentionDays ?? 0
}
});
- if (!currentWorkspace) return null;
+ if (!currentProject) return null;
const handleAuditLogsRetentionSubmit = async ({ auditLogsRetentionDays }: TForm) => {
try {
@@ -59,7 +59,7 @@ export const AuditLogsRetentionSection = () => {
await updateAuditLogsRetention({
auditLogsRetentionDays,
- projectSlug: currentWorkspace.slug
+ projectSlug: currentProject.slug
});
createNotification({
diff --git a/frontend/src/pages/project/SettingsPage/components/DeleteProjectProtection/DeleteProjectProtection.tsx b/frontend/src/pages/project/SettingsPage/components/DeleteProjectProtection/DeleteProjectProtection.tsx
index 2ac1236077..3e09a9f6bd 100644
--- a/frontend/src/pages/project/SettingsPage/components/DeleteProjectProtection/DeleteProjectProtection.tsx
+++ b/frontend/src/pages/project/SettingsPage/components/DeleteProjectProtection/DeleteProjectProtection.tsx
@@ -1,20 +1,19 @@
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Checkbox } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
-import { useToggleDeleteProjectProtection } from "@app/hooks/api/workspace/queries";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
+import { useUpdateProject } from "@app/hooks/api";
export const DeleteProjectProtection = () => {
- const { currentWorkspace } = useWorkspace();
- const { mutateAsync } = useToggleDeleteProjectProtection();
+ const { projectId, currentProject } = useProject();
+
+ const { mutateAsync } = useUpdateProject();
const handleToggleDeleteProjectProtection = async (state: boolean) => {
try {
- if (!currentWorkspace?.id) return;
-
await mutateAsync({
- workspaceID: currentWorkspace.id,
- state
+ projectId: projectId,
+ hasDeleteProtection: state
});
const text = `Successfully ${state ? "enabled" : "disabled"} delete protection`;
@@ -40,7 +39,7 @@ export const DeleteProjectProtection = () => {
<Checkbox
id="hasDeleteProtection"
isDisabled={!isAllowed}
- isChecked={currentWorkspace?.hasDeleteProtection ?? false}
+ isChecked={currentProject?.hasDeleteProtection ?? false}
onCheckedChange={(state) => {
handleToggleDeleteProjectProtection(state as boolean);
}}
diff --git a/frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx b/frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
index ac589ba594..662506052e 100644
--- a/frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
+++ b/frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
@@ -10,7 +10,7 @@ import {
ProjectPermissionSub,
useOrganization,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { useToggle } from "@app/hooks";
import { useDeleteWorkspace, useGetWorkspaceUsers, useLeaveProject } from "@app/hooks/api";
@@ -26,13 +26,13 @@ export const DeleteProjectSection = () => {
const { currentOrg } = useOrganization();
const { hasProjectRole, membership } = useProjectPermission();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [isDeleting, setIsDeleting] = useToggle();
const [isLeaving, setIsLeaving] = useToggle();
const deleteWorkspace = useDeleteWorkspace();
const leaveProject = useLeaveProject();
const { data: members, isPending: isMembersLoading } = useGetWorkspaceUsers(
- currentWorkspace?.id || ""
+ currentProject?.id || ""
);
// If isNoAccessMember is true, then the user can't read the workspace members. So we need to handle this case separately.
@@ -51,10 +51,10 @@ export const DeleteProjectSection = () => {
const handleDeleteWorkspaceSubmit = async () => {
setIsDeleting.on();
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
await deleteWorkspace.mutateAsync({
- workspaceID: currentWorkspace?.id
+ projectID: currentProject?.id
});
createNotification({
@@ -81,7 +81,7 @@ export const DeleteProjectSection = () => {
try {
setIsLeaving.on();
- if (!currentWorkspace?.id || !currentOrg?.id) return;
+ if (!currentProject?.id || !currentOrg?.id) return;
// If there's no members, and the user has access to read members, something went wrong.
if (!members && !isNoAccessMember) return;
@@ -110,7 +110,7 @@ export const DeleteProjectSection = () => {
// If it's actually a no-access member, then we don't really care about the members.
await leaveProject.mutateAsync({
- workspaceId: currentWorkspace.id
+ projectId: currentProject.id
});
navigate({
@@ -141,7 +141,7 @@ export const DeleteProjectSection = () => {
type="submit"
onClick={() => handlePopUpOpen("deleteWorkspace")}
>
- {`Delete ${currentWorkspace?.name}`}
+ {`Delete ${currentProject?.name}`}
</Button>
)}
</ProjectPermissionCan>
@@ -154,7 +154,7 @@ export const DeleteProjectSection = () => {
type="submit"
onClick={() => handlePopUpOpen("leaveWorkspace")}
>
- {`Leave ${currentWorkspace?.name}`}
+ {`Leave ${currentProject?.name}`}
</Button>
)}
</div>
@@ -162,7 +162,7 @@ export const DeleteProjectSection = () => {
<DeleteActionModal
isOpen={popUp.deleteWorkspace.isOpen}
title="Are you sure you want to delete this project?"
- subTitle={`Permanently delete ${currentWorkspace?.name} and all of its data. This action is not reversible, so please be careful.`}
+ subTitle={`Permanently delete ${currentProject?.name} and all of its data. This action is not reversible, so please be careful.`}
onChange={(isOpen) => handlePopUpToggle("deleteWorkspace", isOpen)}
deleteKey="confirm"
buttonText="Delete Project"
@@ -172,7 +172,7 @@ export const DeleteProjectSection = () => {
<LeaveProjectModal
isOpen={popUp.leaveWorkspace.isOpen}
title="Are you sure you want to leave this project?"
- subTitle={`If you leave ${currentWorkspace?.name} you will lose access to the project and its contents.`}
+ subTitle={`If you leave ${currentProject?.name} you will lose access to the project and its contents.`}
onChange={(isOpen) => handlePopUpToggle("leaveWorkspace", isOpen)}
deleteKey="confirm"
buttonText="Leave Project"
diff --git a/frontend/src/pages/secret-manager/CommitDetailsPage/CommitDetailsPage.tsx b/frontend/src/pages/secret-manager/CommitDetailsPage/CommitDetailsPage.tsx
index 06f79e9f04..d03a347a86 100644
--- a/frontend/src/pages/secret-manager/CommitDetailsPage/CommitDetailsPage.tsx
+++ b/frontend/src/pages/secret-manager/CommitDetailsPage/CommitDetailsPage.tsx
@@ -2,7 +2,7 @@ import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
import { ProjectPermissionCan } from "@app/components/permissions";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
ProjectPermissionCommitsActions,
ProjectPermissionSub
@@ -23,7 +23,7 @@ export const CommitDetailsPage = () => {
from: ROUTE_PATHS.SecretManager.CommitDetailsPage.id,
select: (el) => el.folderId
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate();
const routerQueryParams: { secretPath?: string } = useSearch({
@@ -36,7 +36,7 @@ export const CommitDetailsPage = () => {
navigate({
to: "/projects/secret-management/$projectId/commits/$environment/$folderId",
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
folderId,
environment: envSlug
},
@@ -51,7 +51,7 @@ export const CommitDetailsPage = () => {
navigate({
to: "/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/restore",
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
folderId,
environment: envSlug,
commitId: selectedCommitId
@@ -73,7 +73,7 @@ export const CommitDetailsPage = () => {
>
<CommitDetailsTab
selectedCommitId={selectedCommitId}
- workspaceId={currentWorkspace.id}
+ workspaceId={currentProject.id}
goBackToHistory={handleGoBackToHistory}
envSlug={envSlug}
goToRollbackPreview={handleGoToRollbackPreview}
diff --git a/frontend/src/pages/secret-manager/CommitDetailsPage/components/RollbackPreviewTab/RollbackPreviewTab.tsx b/frontend/src/pages/secret-manager/CommitDetailsPage/components/RollbackPreviewTab/RollbackPreviewTab.tsx
index 682822503f..ae082d8eaa 100644
--- a/frontend/src/pages/secret-manager/CommitDetailsPage/components/RollbackPreviewTab/RollbackPreviewTab.tsx
+++ b/frontend/src/pages/secret-manager/CommitDetailsPage/components/RollbackPreviewTab/RollbackPreviewTab.tsx
@@ -17,7 +17,7 @@ import {
Tooltip
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
ProjectPermissionCommitsActions,
ProjectPermissionSub
@@ -79,7 +79,7 @@ export const RollbackPreviewTab = (): JSX.Element => {
const [deepRollback, setDeepRollback] = useState<boolean>(false);
const [message, setMessage] = useState<string>("");
const [selectedFolderId, setSelectedFolderId] = useState<string | null>(null);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const envSlug = useParams({
from: ROUTE_PATHS.SecretManager.RollbackPreviewPage.id,
select: (el) => el.environment
@@ -104,7 +104,7 @@ export const RollbackPreviewTab = (): JSX.Element => {
navigate({
to: "/projects/secret-management/$projectId/commits/$environment/$folderId",
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
folderId,
environment: envSlug
},
@@ -120,7 +120,7 @@ export const RollbackPreviewTab = (): JSX.Element => {
] as const);
const { mutateAsync: rollback } = useCommitRollback({
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
commitId: selectedCommitId,
folderId,
deepRollback,
@@ -133,7 +133,7 @@ export const RollbackPreviewTab = (): JSX.Element => {
folderId,
selectedCommitId,
envSlug,
- currentWorkspace.id,
+ currentProject.id,
deepRollback,
secretPath
);
diff --git a/frontend/src/pages/secret-manager/CommitsPage/CommitsPage.tsx b/frontend/src/pages/secret-manager/CommitsPage/CommitsPage.tsx
index 1acb764469..2dba8ad550 100644
--- a/frontend/src/pages/secret-manager/CommitsPage/CommitsPage.tsx
+++ b/frontend/src/pages/secret-manager/CommitsPage/CommitsPage.tsx
@@ -4,7 +4,7 @@ import { ProjectPermissionCan } from "@app/components/permissions";
import { PageHeader } from "@app/components/v2";
import { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
ProjectPermissionCommitsActions,
ProjectPermissionSub
@@ -17,7 +17,7 @@ export const CommitsPage = () => {
from: ROUTE_PATHS.SecretManager.CommitsPage.id,
select: (el) => el.environment
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate();
const folderId = useParams({
from: ROUTE_PATHS.SecretManager.CommitsPage.id,
@@ -33,7 +33,7 @@ export const CommitsPage = () => {
navigate({
to: "/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId",
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
folderId,
environment: envSlug,
commitId
@@ -67,7 +67,7 @@ export const CommitsPage = () => {
>
<CommitHistoryTab
onSelectCommit={handleSelectCommit}
- projectId={currentWorkspace.id}
+ projectId={currentProject.id}
environment={envSlug}
secretPath={secretPath}
/>
diff --git a/frontend/src/pages/secret-manager/CommitsPage/components/CommitHistoryTab/CommitHistoryTab.tsx b/frontend/src/pages/secret-manager/CommitsPage/components/CommitHistoryTab/CommitHistoryTab.tsx
index 58191f3897..d5f982529a 100644
--- a/frontend/src/pages/secret-manager/CommitsPage/components/CommitHistoryTab/CommitHistoryTab.tsx
+++ b/frontend/src/pages/secret-manager/CommitsPage/components/CommitHistoryTab/CommitHistoryTab.tsx
@@ -136,7 +136,7 @@ export const CommitHistoryTab = ({
isFetchingNextPage,
hasNextPage
} = useGetFolderCommitHistory({
- workspaceId: projectId,
+ projectId,
environment,
directory: secretPath,
limit,
diff --git a/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistModal.tsx b/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistModal.tsx
index 4d95b6388a..36f5858502 100644
--- a/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistModal.tsx
+++ b/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistModal.tsx
@@ -5,7 +5,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useAddTrustedIp, useGetMyIp, useUpdateTrustedIp } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -27,7 +27,7 @@ type Props = {
export const IPAllowlistModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props) => {
const { data, isPending } = useGetMyIp();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const addTrustedIp = useAddTrustedIp();
const updateTrustedIp = useUpdateTrustedIp();
@@ -65,11 +65,11 @@ export const IPAllowlistModal = ({ popUp, handlePopUpClose, handlePopUpToggle }:
const onIPAllowlistModalSubmit = async ({ ipAddress, comment }: FormData) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
if (popUp?.trustedIp?.data) {
await updateTrustedIp.mutateAsync({
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
trustedIpId: (popUp?.trustedIp?.data as { trustedIpId: string })?.trustedIpId,
ipAddress,
comment,
@@ -77,7 +77,7 @@ export const IPAllowlistModal = ({ popUp, handlePopUpClose, handlePopUpToggle }:
});
} else {
await addTrustedIp.mutateAsync({
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
ipAddress,
comment,
isActive: true
diff --git a/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistSection.tsx b/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistSection.tsx
index 63b410ee28..8434553431 100644
--- a/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistSection.tsx
+++ b/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistSection.tsx
@@ -9,7 +9,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { useDeleteTrustedIp } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -20,7 +20,7 @@ import { IPAllowlistTable } from "./IPAllowlistTable";
export const IPAllowlistSection = () => {
const { mutateAsync } = useDeleteTrustedIp();
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"trustedIp",
@@ -30,10 +30,10 @@ export const IPAllowlistSection = () => {
const onDeleteTrustedIpSubmit = async (trustedIpId: string) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
await mutateAsync({
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
trustedIpId
});
diff --git a/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistTable.tsx b/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistTable.tsx
index 42ecc8d8a0..001514a96d 100644
--- a/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistTable.tsx
+++ b/frontend/src/pages/secret-manager/IPAllowlistPage/components/IPAllowlistTable.tsx
@@ -19,7 +19,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { useGetTrustedIps } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -41,8 +41,8 @@ type Props = {
export const IPAllowlistTable = ({ popUp, handlePopUpOpen, handlePopUpToggle }: Props) => {
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
- const { data, isPending } = useGetTrustedIps(currentWorkspace?.id ?? "");
+ const { currentProject } = useProject();
+ const { data, isPending } = useGetTrustedIps(currentProject?.id ?? "");
const formatType = (type: string, prefix?: number) => {
return `${type.slice(0, 2).toUpperCase() + type.slice(2)} ${
@@ -77,10 +77,10 @@ export const IPAllowlistTable = ({ popUp, handlePopUpOpen, handlePopUpToggle }:
<Td>{comment}</Td>
{/* <Td>
<div className="flex items-center">
- <FontAwesomeIcon
- icon={faCircle}
+ <FontAwesomeIcon
+ icon={faCircle}
color="#2ecc71"
- />
+ />
<p className="ml-4">Active</p>
</div>
</Td> */}
diff --git a/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/IntegrationsDetailsByIDPage.tsx b/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/IntegrationsDetailsByIDPage.tsx
index c1ba83ae62..3788d955ef 100644
--- a/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/IntegrationsDetailsByIDPage.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/IntegrationsDetailsByIDPage.tsx
@@ -20,11 +20,11 @@ import {
Tooltip
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { OrgPermissionActions, OrgPermissionSubjects, useWorkspace } from "@app/context";
+import { OrgPermissionActions, OrgPermissionSubjects, useProject } from "@app/context";
import { usePopUp, useToggle } from "@app/hooks";
import { useGetIntegration } from "@app/hooks/api";
import { useDeleteIntegration, useSyncIntegration } from "@app/hooks/api/integrations/queries";
-import { ProjectType } from "@app/hooks/api/workspace/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import { IntegrationAuditLogsSection } from "./components/IntegrationAuditLogsSection";
import { IntegrationConnectionSection } from "./components/IntegrationConnectionSection";
@@ -45,8 +45,8 @@ export const IntegrationDetailsByIDPage = () => {
const [shouldDeleteSecrets, setShouldDeleteSecrets] = useToggle(false);
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace.id;
+ const { currentProject } = useProject();
+ const projectId = currentProject.id;
const { mutateAsync: syncIntegration } = useSyncIntegration();
const { mutateAsync: deleteIntegration } = useDeleteIntegration();
@@ -56,7 +56,7 @@ export const IntegrationDetailsByIDPage = () => {
try {
await deleteIntegration({
id: integrationId,
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
shouldDeleteIntegrationSecrets
});
diff --git a/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/components/IntegrationAuditLogsSection.tsx b/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/components/IntegrationAuditLogsSection.tsx
index c27b1bb08d..1b7a93eefc 100644
--- a/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/components/IntegrationAuditLogsSection.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/components/IntegrationAuditLogsSection.tsx
@@ -1,7 +1,7 @@
import { Link } from "@tanstack/react-router";
import { EmptyState } from "@app/components/v2";
-import { useSubscription, useWorkspace } from "@app/context";
+import { useSubscription, useProject } from "@app/context";
import { EventType } from "@app/hooks/api/auditLogs/enums";
import { TIntegrationWithEnv } from "@app/hooks/api/integrations/types";
import { LogsSection } from "@app/pages/organization/AuditLogsPage/components/LogsSection";
@@ -15,7 +15,7 @@ type Props = {
export const IntegrationAuditLogsSection = ({ integration }: Props) => {
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const auditLogsRetentionDays = subscription?.auditLogsRetentionDays ?? 30;
@@ -31,7 +31,7 @@ export const IntegrationAuditLogsSection = ({ integration }: Props) => {
<LogsSection
refetchInterval={4000}
showFilters={false}
- project={currentWorkspace}
+ project={currentProject}
presets={{
eventMetadata: { integrationId: integration.id },
startDate: new Date(
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/IntegrationsListPage.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/IntegrationsListPage.tsx
index 172dda3029..26263f0adb 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/IntegrationsListPage.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/IntegrationsListPage.tsx
@@ -5,7 +5,7 @@ import { useNavigate, useSearch } from "@tanstack/react-router";
import { ProjectPermissionCan } from "@app/components/permissions";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
import { IntegrationsListPageTabs } from "@app/types/integrations";
@@ -18,7 +18,7 @@ import {
export const IntegrationsListPage = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { t } = useTranslation();
const { selectedTab } = useSearch({
@@ -30,7 +30,7 @@ export const IntegrationsListPage = () => {
to: ROUTE_PATHS.SecretManager.IntegrationsListPage.path,
search: (prev) => ({ ...prev, selectedTab: tab as IntegrationsListPageTabs }),
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}
});
};
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/CloudIntegrationSection/CloudIntegrationSection.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/components/CloudIntegrationSection/CloudIntegrationSection.tsx
index 935ad1a8cd..4f8e541e22 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/CloudIntegrationSection/CloudIntegrationSection.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/CloudIntegrationSection/CloudIntegrationSection.tsx
@@ -25,7 +25,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { usePopUp } from "@app/hooks";
import { SecretSync } from "@app/hooks/api/secretSyncs";
@@ -60,7 +60,7 @@ export const CloudIntegrationSection = ({
"deleteConfirmation"
] as const);
const { permission } = useProjectPermission();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate();
const isEmpty = !isLoading && !cloudIntegrations?.length;
@@ -68,12 +68,12 @@ export const CloudIntegrationSection = ({
const sortedCloudIntegrations = useMemo(() => {
const sortedIntegrations = cloudIntegrations.sort((a, b) => a.name.localeCompare(b.name));
- if (currentWorkspace?.environments.length === 0) {
+ if (currentProject?.environments.length === 0) {
return sortedIntegrations.map((integration) => ({ ...integration, isAvailable: false }));
}
return sortedIntegrations;
- }, [cloudIntegrations, currentWorkspace?.environments]);
+ }, [cloudIntegrations, currentProject?.environments]);
const [search, setSearch] = useState("");
@@ -83,9 +83,9 @@ export const CloudIntegrationSection = ({
return (
<div>
- {currentWorkspace?.environments.length === 0 && (
+ {currentProject?.environments.length === 0 && (
<div className="px-5">
- <NoEnvironmentsBanner projectId={currentWorkspace.id} />
+ <NoEnvironmentsBanner projectId={currentProject.id} />
</div>
)}
<div className="m-4 mt-0 flex flex-col items-start justify-between px-2 text-xl">
@@ -138,7 +138,7 @@ export const CloudIntegrationSection = ({
navigate({
to: ROUTE_PATHS.SecretManager.IntegrationsListPage.path,
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.SecretSyncs,
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/NativeIntegrationsTab/IntegrationRow.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/components/NativeIntegrationsTab/IntegrationRow.tsx
index df862b8ba1..c83e242546 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/NativeIntegrationsTab/IntegrationRow.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/NativeIntegrationsTab/IntegrationRow.tsx
@@ -15,7 +15,7 @@ import { twMerge } from "tailwind-merge";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Badge, IconButton, Td, Tooltip, Tr } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { TCloudIntegration } from "@app/hooks/api/integrations/types";
import { TIntegration } from "@app/hooks/api/types";
@@ -37,7 +37,7 @@ export const IntegrationRow = ({
cloudIntegration
}: IProps) => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { id, secretPath, syncMessage, isSynced } = integration;
@@ -62,7 +62,7 @@ export const IntegrationRow = ({
to: "/projects/secret-management/$projectId/integrations/$integrationId",
params: {
integrationId: integration.id,
- projectId: currentWorkspace.id
+ projectId: currentProject.id
}
})
}
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/NativeIntegrationsTab/NativeIntegrationsTab.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/components/NativeIntegrationsTab/NativeIntegrationsTab.tsx
index f3706940c1..b4f790075d 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/NativeIntegrationsTab/NativeIntegrationsTab.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/NativeIntegrationsTab/NativeIntegrationsTab.tsx
@@ -5,7 +5,7 @@ import { useNavigate } from "@tanstack/react-router";
import { createNotification } from "@app/components/notifications";
import { Button, Checkbox, DeleteActionModal, Spinner } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { usePopUp, useToggle } from "@app/hooks";
import {
useDeleteIntegration,
@@ -27,8 +27,8 @@ enum IntegrationView {
}
export const NativeIntegrationsTab = () => {
- const { currentWorkspace } = useWorkspace();
- const { environments, id: workspaceId } = currentWorkspace;
+ const { currentProject } = useProject();
+ const { environments, id: workspaceId } = currentProject;
const navigate = useNavigate();
const { data: cloudIntegrations, isPending: isCloudIntegrationsLoading } =
@@ -91,7 +91,7 @@ export const NativeIntegrationsTab = () => {
if (!selectedCloudIntegration) return;
try {
- redirectForProviderAuth(currentWorkspace.id, navigate, selectedCloudIntegration);
+ redirectForProviderAuth(currentProject.id, navigate, selectedCloudIntegration);
} catch (error) {
console.error(error);
}
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncsTable.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncsTable.tsx
index fcd42a10fa..ed96dcd45a 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncsTable.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncsTable.tsx
@@ -36,7 +36,7 @@ import {
THead,
Tr
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { SECRET_SYNC_MAP } from "@app/helpers/secretSyncs";
import {
getUserTablePreference,
@@ -109,7 +109,7 @@ export const SecretSyncsTable = ({ secretSyncs }: Props) => {
environmentIds: []
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const {
search,
@@ -372,7 +372,7 @@ export const SecretSyncsTable = ({ secretSyncs }: Props) => {
<DropdownMenuItem isDisabled>No Secret Syncs Configured</DropdownMenuItem>
)}
<DropdownMenuLabel>Environment</DropdownMenuLabel>
- {currentWorkspace.environments.map((env) => (
+ {currentProject.environments.map((env) => (
<DropdownMenuItem
onClick={(e) => {
e.preventDefault();
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncsTab.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncsTab.tsx
index 20a3c74df1..04a1cd7708 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncsTab.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncsTab.tsx
@@ -7,7 +7,7 @@ import { ProjectPermissionCan } from "@app/components/permissions";
import { CreateSecretSyncModal } from "@app/components/secret-syncs";
import { Button, Spinner } from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionSub, useProject } from "@app/context";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
import { usePopUp } from "@app/hooks";
import { useListSecretSyncs } from "@app/hooks/api/secretSyncs";
@@ -23,7 +23,7 @@ export const SecretSyncsTab = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
useEffect(() => {
if (!addSync) return;
@@ -32,14 +32,14 @@ export const SecretSyncsTab = () => {
navigate({
to: ROUTE_PATHS.SecretManager.IntegrationsListPage.path,
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search
});
}, [addSync]);
const { data: secretSyncs = [], isPending: isSecretSyncsPending } = useListSecretSyncs(
- currentWorkspace.id,
+ currentProject.id,
{
refetchInterval: 30000
}
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/route.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/route.tsx
index b7f8236da5..53131cca1a 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/route.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/route.tsx
@@ -2,7 +2,7 @@ import { createFileRoute, redirect } from "@tanstack/react-router";
import { zodValidator } from "@tanstack/zod-adapter";
import { z } from "zod";
-import { workspaceKeys } from "@app/hooks/api";
+import { projectKeys } from "@app/hooks/api";
import { TIntegration } from "@app/hooks/api/integrations/types";
import {
fetchSecretSyncsByProjectId,
@@ -10,7 +10,7 @@ import {
secretSyncKeys,
TSecretSync
} from "@app/hooks/api/secretSyncs";
-import { fetchWorkspaceIntegrations } from "@app/hooks/api/workspace/queries";
+import { fetchWorkspaceIntegrations } from "@app/hooks/api/projects/queries";
import { IntegrationsListPageTabs } from "@app/types/integrations";
import { IntegrationsListPage } from "./IntegrationsListPage";
@@ -57,7 +57,7 @@ export const Route = createFileRoute(
let integrations: TIntegration[];
try {
integrations = await context.queryClient.ensureQueryData({
- queryKey: workspaceKeys.getWorkspaceIntegrations(projectId),
+ queryKey: projectKeys.getProjectIntegrations(projectId),
queryFn: () => fetchWorkspaceIntegrations(projectId)
});
} catch {
diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
index 910e07eac5..47b448d135 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
@@ -65,7 +65,7 @@ import {
ProjectPermissionSub,
useProjectPermission,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { ProjectPermissionSecretRotationActions } from "@app/context/ProjectPermissionContext/types";
import {
@@ -95,13 +95,8 @@ import { OrderByDirection } from "@app/hooks/api/generic/types";
import { useUpdateFolderBatch } from "@app/hooks/api/secretFolders/queries";
import { TUpdateFolderBatchDTO } from "@app/hooks/api/secretFolders/types";
import { TSecretRotationV2 } from "@app/hooks/api/secretRotationsV2";
-import {
- SecretType,
- SecretV3RawSanitized,
- TSecretFolder,
- WorkspaceEnv
-} from "@app/hooks/api/types";
-import { ProjectVersion } from "@app/hooks/api/workspace/types";
+import { SecretType, SecretV3RawSanitized, TSecretFolder, ProjectEnv } from "@app/hooks/api/types";
+import { ProjectVersion } from "@app/hooks/api/projects/types";
import {
useDynamicSecretOverview,
useFolderOverview,
@@ -173,10 +168,9 @@ export const OverviewPage = () => {
const [debouncedScrollOffset] = useDebounce(scrollOffset);
const { permission } = useProjectPermission();
const tableRef = useRef<HTMLDivElement>(null);
- const { currentWorkspace } = useWorkspace();
- const isProjectV3 = currentWorkspace?.version === ProjectVersion.V3;
- const workspaceId = currentWorkspace?.id as string;
- const projectSlug = currentWorkspace?.slug as string;
+ const { currentProject, projectId } = useProject();
+ const isProjectV3 = currentProject?.version === ProjectVersion.V3;
+ const projectSlug = currentProject?.slug as string;
const [searchFilter, setSearchFilter] = useState("");
const [debouncedSearchFilter, setDebouncedSearchFilter] = useDebounce(searchFilter);
const secretPath = (routerSearch?.secretPath as string) || "/";
@@ -246,7 +240,7 @@ export const OverviewPage = () => {
};
}, []);
- const userAvailableEnvs = currentWorkspace?.environments || [];
+ const userAvailableEnvs = currentProject?.environments || [];
const userAvailableDynamicSecretEnvs = userAvailableEnvs.filter((env) =>
permission.can(
ProjectPermissionDynamicSecretActions.CreateRootCredential,
@@ -267,7 +261,7 @@ export const OverviewPage = () => {
)
);
- const [filteredEnvs, setFilteredEnvs] = useState<WorkspaceEnv[]>([]);
+ const [filteredEnvs, setFilteredEnvs] = useState<ProjectEnv[]>([]);
const visibleEnvs = filteredEnvs.length ? filteredEnvs : userAvailableEnvs;
const {
@@ -276,7 +270,7 @@ export const OverviewPage = () => {
getImportedSecretByKey,
getEnvImportedSecretKeyCount
} = useGetImportedSecretsAllEnvs({
- projectId: workspaceId,
+ projectId: projectId,
path: secretPath,
environments: (userAvailableEnvs || []).map(({ slug }) => slug)
});
@@ -284,7 +278,7 @@ export const OverviewPage = () => {
const isFilteredByResources = Object.values(filter).some(Boolean);
const { isPending: isOverviewLoading, data: overview } = useGetProjectSecretsOverview(
{
- projectId: workspaceId,
+ projectId: projectId,
environments: visibleEnvs.map((env) => env.slug),
secretPath,
orderDirection,
@@ -368,7 +362,7 @@ export const OverviewPage = () => {
);
const { data: tags } = useGetWsTags(
- permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags) ? workspaceId : ""
+ permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags) ? projectId : ""
);
const { mutateAsync: createSecretV3 } = useCreateSecretV3();
@@ -398,7 +392,7 @@ export const OverviewPage = () => {
name: folderName,
path: secretPath,
environment,
- projectId: workspaceId,
+ projectId: projectId,
description
});
});
@@ -458,7 +452,7 @@ export const OverviewPage = () => {
await updateFolderBatch({
projectSlug,
folders: updatedFolders,
- projectId: workspaceId
+ projectId: projectId
});
createNotification({
type: "success",
@@ -491,7 +485,7 @@ export const OverviewPage = () => {
);
if (folderName && parentPath && canCreateFolder) {
await createFolder({
- projectId: workspaceId,
+ projectId: projectId,
path: parentPath,
environment: env,
name: folderName
@@ -500,7 +494,7 @@ export const OverviewPage = () => {
}
const result = await createSecretV3({
environment: env,
- workspaceId,
+ projectId,
secretPath,
secretKey: key,
secretValue: value,
@@ -555,7 +549,7 @@ export const OverviewPage = () => {
try {
const result = await updateSecretV3({
environment: env,
- workspaceId,
+ projectId,
secretPath,
secretKey: key,
secretValue,
@@ -586,7 +580,7 @@ export const OverviewPage = () => {
try {
const result = await deleteSecretV3({
environment: env,
- workspaceId,
+ projectId,
secretPath,
secretKey: key,
secretId,
@@ -655,7 +649,7 @@ export const OverviewPage = () => {
);
if (folderName && parentPath && canCreateFolder) {
await createFolder({
- projectId: workspaceId,
+ projectId: projectId,
environment: slug,
path: parentPath,
name: folderName
@@ -669,7 +663,7 @@ export const OverviewPage = () => {
navigate({
to: "/projects/secret-management/$projectId/secrets/$envSlug",
params: {
- projectId: workspaceId,
+ projectId: projectId,
envSlug: slug
},
search: query
@@ -1099,7 +1093,7 @@ export const OverviewPage = () => {
tags={tags}
onChange={setSearchFilter}
environments={userAvailableEnvs}
- projectId={currentWorkspace?.id}
+ projectId={currentProject?.id}
/>
{userAvailableEnvs.length > 0 && (
<div>
@@ -1419,7 +1413,7 @@ export const OverviewPage = () => {
<Link
to="/projects/secret-management/$projectId/settings"
params={{
- projectId: workspaceId
+ projectId: projectId
}}
hash="environments"
>
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/CreateSecretForm/CreateSecretForm.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/CreateSecretForm/CreateSecretForm.tsx
index 7087faf72d..00e0d799ce 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/CreateSecretForm/CreateSecretForm.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/CreateSecretForm/CreateSecretForm.tsx
@@ -20,7 +20,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
import { getKeyValue } from "@app/helpers/parseEnvVar";
@@ -57,16 +57,15 @@ export const CreateSecretForm = ({ secretPath = "/", onClose }: Props) => {
formState: { isSubmitting, errors }
} = useForm<TFormSchema>({ resolver: zodResolver(typeSchema) });
- const { currentWorkspace } = useWorkspace();
+ const { currentProject, projectId } = useProject();
const { permission } = useProjectPermission();
const canReadTags = permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags);
- const workspaceId = currentWorkspace?.id || "";
- const environments = currentWorkspace?.environments || [];
+ const environments = currentProject?.environments || [];
const { mutateAsync: createSecretV3 } = useCreateSecretV3();
const { mutateAsync: createFolder } = useCreateFolder();
const { data: projectTags, isPending: isTagsLoading } = useGetWsTags(
- canReadTags ? workspaceId : ""
+ canReadTags ? projectId : ""
);
const secretKeyInputRef = useRef<HTMLInputElement>(null);
@@ -93,7 +92,7 @@ export const CreateSecretForm = ({ secretPath = "/", onClose }: Props) => {
if (folderName && parentPath && canCreateFolder) {
await createFolder({
- projectId: workspaceId,
+ projectId: projectId,
path: parentPath,
environment,
name: folderName
@@ -106,7 +105,7 @@ export const CreateSecretForm = ({ secretPath = "/", onClose }: Props) => {
return {
...(await createSecretV3({
environment,
- workspaceId,
+ projectId,
secretPath,
secretKey: key,
secretValue: value || "",
@@ -176,7 +175,7 @@ export const CreateSecretForm = ({ secretPath = "/", onClose }: Props) => {
if (!secretKey || isWholeKeyHighlighted) {
e.preventDefault();
- const keyStr = currentWorkspace.autoCapitalization ? key.toUpperCase() : key;
+ const keyStr = currentProject.autoCapitalization ? key.toUpperCase() : key;
setValue("key", keyStr);
if (value) {
setValue("value", value);
@@ -191,7 +190,7 @@ export const CreateSecretForm = ({ secretPath = "/", onClose }: Props) => {
try {
const parsedSlug = slugSchema.parse(slug);
await createWsTag.mutateAsync({
- workspaceID: workspaceId,
+ projectId: projectId,
tagSlug: parsedSlug,
tagColor: ""
});
@@ -220,7 +219,7 @@ export const CreateSecretForm = ({ secretPath = "/", onClose }: Props) => {
}}
placeholder="Type your secret name"
onPaste={handlePaste}
- autoCapitalization={currentWorkspace?.autoCapitalization}
+ autoCapitalization={currentProject?.autoCapitalization}
/>
</FormControl>
<Controller
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretOverviewTableRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretOverviewTableRow.tsx
index 006b9b0d66..0260135f8d 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretOverviewTableRow.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretOverviewTableRow.tsx
@@ -22,7 +22,7 @@ import {
} from "@app/context/ProjectPermissionContext/types";
import { useToggle } from "@app/hooks";
import { SecretType, SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { getExpandedRowStyle } from "@app/pages/secret-manager/OverviewPage/components/utils";
import { HIDDEN_SECRET_VALUE } from "@app/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem";
@@ -50,7 +50,7 @@ type Props = {
getImportedSecretByKey: (
env: string,
secretName: string
- ) => { secret?: SecretV3RawSanitized; environmentInfo?: WorkspaceEnv } | undefined;
+ ) => { secret?: SecretV3RawSanitized; environmentInfo?: ProjectEnv } | undefined;
scrollOffset: number;
importedBy?: {
environment: { name: string; slug: string };
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretRenameRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretRenameRow.tsx
index d15e96a91e..4bb0ce4535 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretRenameRow.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretRenameRow.tsx
@@ -10,7 +10,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { IconButton, Input, Spinner, Tooltip } from "@app/components/v2";
-import { ProjectPermissionSub, useProjectPermission, useWorkspace } from "@app/context";
+import { ProjectPermissionSub, useProjectPermission, useProject } from "@app/context";
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
import { useToggle } from "@app/hooks";
import { useUpdateSecretV3 } from "@app/hooks/api";
@@ -37,7 +37,7 @@ export const formSchema = z.object({
type TFormSchema = z.infer<typeof formSchema>;
function SecretRenameRow({ environments, getSecretByKey, secretKey, secretPath }: Props) {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject, projectId } = useProject();
const { permission } = useProjectPermission();
const secrets = environments.map((env) => getSecretByKey(env.slug, secretKey));
@@ -68,7 +68,6 @@ function SecretRenameRow({ environments, getSecretByKey, secretKey, secretPath }
secret?.overrideAction === SecretActionType.Created ||
secret?.overrideAction === SecretActionType.Modified
);
- const workspaceId = currentWorkspace?.id || "";
const [isSecNameCopied, setIsSecNameCopied] = useToggle(false);
@@ -111,7 +110,7 @@ function SecretRenameRow({ environments, getSecretByKey, secretKey, secretPath }
return updateSecretV3({
environment: secret?.env,
- workspaceId,
+ projectId,
secretPath,
secretKey: secret.key,
secretValue: secret.value || "",
@@ -163,7 +162,7 @@ function SecretRenameRow({ environments, getSecretByKey, secretKey, secretPath }
<Input
autoComplete="off"
isReadOnly={isReadOnly || secrets.filter(Boolean).length === 0}
- autoCapitalization={currentWorkspace?.autoCapitalization}
+ autoCapitalization={currentProject?.autoCapitalization}
variant="plain"
isDisabled={isOverriden}
placeholder={error?.message}
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchModal.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchModal.tsx
index a4a3fcde47..1be02b6ab6 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchModal.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchModal.tsx
@@ -34,7 +34,7 @@ import {
import { useDebounce } from "@app/hooks";
import { useGetProjectSecretsQuickSearch } from "@app/hooks/api/dashboard";
import { WsTag } from "@app/hooks/api/tags/types";
-import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { ProjectEnv } from "@app/hooks/api/projects/types";
import { QuickSearchSecretRotationItem } from "@app/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchSecretRotationItem";
import { RowType } from "@app/pages/secret-manager/SecretDashboardPage/SecretMainPage.types";
@@ -43,7 +43,7 @@ import { QuickSearchFolderItem } from "./QuickSearchFolderItem";
import { QuickSearchSecretItem } from "./QuickSearchSecretItem";
export type QuickSearchModalProps = {
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
projectId: string;
tags?: WsTag[];
isSingleEnv?: boolean;
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchSecretItem.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchSecretItem.tsx
index a9d592b1ce..8c97b4f5cd 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchSecretItem.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchSecretItem.tsx
@@ -28,10 +28,10 @@ import {
import { reverseTruncate } from "@app/helpers/reverseTruncate";
import { useTimedReset } from "@app/hooks";
import { TDashboardProjectSecretsQuickSearch } from "@app/hooks/api/dashboard/types";
-import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { ProjectEnv } from "@app/hooks/api/projects/types";
type Props = {
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
secretGroup: TDashboardProjectSecretsQuickSearch["secrets"][string];
onClose: () => void;
isSingleEnv?: boolean;
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretV2MigrationSection/SecretV2MigrationSection.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretV2MigrationSection/SecretV2MigrationSection.tsx
index 14faa7e9e2..9afa742f41 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretV2MigrationSection/SecretV2MigrationSection.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretV2MigrationSection/SecretV2MigrationSection.tsx
@@ -8,11 +8,11 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, Checkbox, Modal, ModalContent, Spinner } from "@app/components/v2";
-import { useProjectPermission, useWorkspace } from "@app/context";
+import { useProjectPermission, useProject } from "@app/context";
import { usePopUp } from "@app/hooks";
-import { useGetWorkspaceById, useMigrateProjectToV3, workspaceKeys } from "@app/hooks/api";
+import { useGetWorkspaceById, useMigrateProjectToV3, projectKeys } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
-import { ProjectVersion } from "@app/hooks/api/workspace/types";
+import { ProjectVersion } from "@app/hooks/api/projects/types";
enum ProjectUpgradeStatus {
InProgress = "IN_PROGRESS",
@@ -28,14 +28,14 @@ const formSchema = z.object({
export const SecretV2MigrationSection = () => {
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["migrationInfo"] as const);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const queryClient = useQueryClient();
const { data: workspaceDetails, refetch } = useGetWorkspaceById(
// if v3 no need to fetch
- currentWorkspace?.version === ProjectVersion.V3 ? "" : currentWorkspace?.id || "",
+ currentProject?.version === ProjectVersion.V3 ? "" : currentProject?.id || "",
{
refetchInterval:
- currentWorkspace?.upgradeStatus === ProjectUpgradeStatus.InProgress ? 2000 : false
+ currentProject?.upgradeStatus === ProjectUpgradeStatus.InProgress ? 2000 : false
}
);
const { membership } = useProjectPermission();
@@ -54,12 +54,12 @@ export const SecretV2MigrationSection = () => {
createNotification({ type: "success", text: "Project upgrade completed successfully" });
migrateProjectToV3.reset();
queryClient.invalidateQueries({
- queryKey: workspaceKeys.getAllUserWorkspace()
+ queryKey: projectKeys.getAllUserProjects()
});
}
}, [isProjectUpgraded, Boolean(migrateProjectToV3.data)]);
- if (isProjectUpgraded || currentWorkspace?.version === ProjectVersion.V3) return null;
+ if (isProjectUpgraded || currentProject?.version === ProjectVersion.V3) return null;
const isUpgrading = workspaceDetails?.upgradeStatus === ProjectUpgradeStatus.InProgress;
const didProjectUpgradeFailed = workspaceDetails?.upgradeStatus === ProjectUpgradeStatus.Failed;
@@ -67,7 +67,7 @@ export const SecretV2MigrationSection = () => {
const handleMigrationSecretV2 = async () => {
try {
handlePopUpToggle("migrationInfo");
- await migrateProjectToV3.mutateAsync({ workspaceId: currentWorkspace?.id || "" });
+ await migrateProjectToV3.mutateAsync({ projectId: currentProject?.id || "" });
refetch();
createNotification({
text: "Project upgrade started",
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/SelectionPanel.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/SelectionPanel.tsx
index 11ee3def8b..41794dbc7a 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/SelectionPanel.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/SelectionPanel.tsx
@@ -11,7 +11,7 @@ import {
ProjectPermissionSub,
useProjectPermission,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
import { usePopUp } from "@app/hooks";
@@ -66,9 +66,8 @@ export const SelectionPanel = ({
);
const selectedCount = selectedFolderCount + selectedKeysCount;
- const { currentWorkspace } = useWorkspace();
- const workspaceId = currentWorkspace?.id || "";
- const userAvailableEnvs = currentWorkspace?.environments || [];
+ const { currentProject, projectId } = useProject();
+ const userAvailableEnvs = currentProject?.environments || [];
const { mutateAsync: deleteBatchSecretV3 } = useDeleteSecretBatch();
const { mutateAsync: deleteFolder } = useDeleteFolder();
@@ -134,7 +133,7 @@ export const SelectionPanel = ({
folderId: folder?.id,
path: secretPath,
environment: env.slug,
- projectId: workspaceId
+ projectId: projectId
});
}
})
@@ -173,7 +172,7 @@ export const SelectionPanel = ({
processedEntries += secretsToDelete.length;
await deleteBatchSecretV3({
secretPath,
- workspaceId,
+ projectId,
environment: env.slug,
secrets: secretsToDelete
});
@@ -281,8 +280,8 @@ export const SelectionPanel = ({
isOpen={popUp.bulkMoveSecrets.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("bulkMoveSecrets", isOpen)}
environments={userAvailableEnvs}
- projectId={workspaceId}
- projectSlug={currentWorkspace.slug}
+ projectId={projectId}
+ projectSlug={currentProject.slug}
sourceSecretPath={secretPath}
secrets={selectedEntries[EntryType.SECRET]}
onComplete={resetSelectedEntries}
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/MoveSecretsDialog/MoveSecretsDialog.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/MoveSecretsDialog/MoveSecretsDialog.tsx
index bb7862f091..9dd2863d61 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/MoveSecretsDialog/MoveSecretsDialog.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/MoveSecretsDialog/MoveSecretsDialog.tsx
@@ -31,12 +31,12 @@ import { useDebounce } from "@app/hooks";
import { useMoveSecrets } from "@app/hooks/api";
import { useGetProjectSecretsQuickSearch } from "@app/hooks/api/dashboard";
import { SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
-import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { ProjectEnv } from "@app/hooks/api/projects/types";
type Props = {
isOpen: boolean;
onOpenChange: (isOpen: boolean) => void;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
projectId: string;
projectSlug: string;
sourceSecretPath: string;
@@ -64,7 +64,6 @@ type MoveResults = {
const Content = ({
onComplete,
secrets,
- projectSlug,
environments,
projectId,
sourceSecretPath
@@ -189,7 +188,6 @@ const Content = ({
try {
const { isDestinationUpdated, isSourceUpdated } = await moveSecrets.mutateAsync({
- projectSlug,
shouldOverwrite,
sourceEnvironment: environment.slug,
sourceSecretPath,
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/SecretApprovalsPage.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/SecretApprovalsPage.tsx
index bc82e9b90b..09fe3aa667 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/SecretApprovalsPage.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/SecretApprovalsPage.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import { Badge } from "@app/components/v2/Badge";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useGetAccessRequestsCount, useGetSecretApprovalRequestCount } from "@app/hooks/api";
import { AccessApprovalRequest } from "./components/AccessApprovalRequest";
@@ -20,11 +20,10 @@ enum TabSection {
export const SecretApprovalsPage = () => {
const { t } = useTranslation();
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
- const projectSlug = currentWorkspace?.slug || "";
+ const { currentProject, projectId } = useProject();
+ const projectSlug = currentProject?.slug || "";
const { data: secretApprovalReqCount } = useGetSecretApprovalRequestCount({
- workspaceId: projectId
+ projectId
});
const { data: accessApprovalRequestCount } = useGetAccessRequestsCount({ projectSlug });
const defaultTab =
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx
index ad905c1f6c..3ab1c624e9 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx
@@ -42,7 +42,7 @@ import {
useProjectPermission,
useSubscription,
useUser,
- useWorkspace
+ useProject
} from "@app/context";
import {
getUserTablePreference,
@@ -110,7 +110,7 @@ export const AccessApprovalRequest = ({
const { permission } = useProjectPermission();
const { user } = useUser();
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: members } = useGetWorkspaceUsers(projectId, true);
const membersGroupById = members?.reduce<Record<string, TWorkspaceUser>>(
@@ -410,7 +410,7 @@ export const AccessApprovalRequest = ({
<DropdownMenuLabel className="sticky top-0 bg-mineshaft-900">
Select an Environment
</DropdownMenuLabel>
- {currentWorkspace?.environments.map(({ slug, name }) => (
+ {currentProject?.environments.map(({ slug, name }) => (
<DropdownMenuItem
onClick={() => setEnvFilter((state) => (state === slug ? undefined : slug))}
key={`request-filter-${slug}`}
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/ReviewAccessModal.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/ReviewAccessModal.tsx
index e7269298a5..b4336637d5 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/ReviewAccessModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/ReviewAccessModal.tsx
@@ -25,7 +25,7 @@ import {
Tooltip
} from "@app/components/v2";
import { Badge } from "@app/components/v2/Badge";
-import { ProjectPermissionActions, useUser, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, useUser, useProject } from "@app/context";
import { usePopUp } from "@app/hooks";
import { useListWorkspaceGroups, useReviewAccessRequest } from "@app/hooks/api";
import {
@@ -102,8 +102,8 @@ export const ReviewAccessRequestModal = ({
const [bypassApproval, setBypassApproval] = useState(false);
const [bypassReason, setBypassReason] = useState("");
- const { currentWorkspace } = useWorkspace();
- const { data: groupMemberships = [] } = useListWorkspaceGroups(currentWorkspace?.id || "");
+ const { currentProject } = useProject();
+ const { data: groupMemberships = [] } = useListWorkspaceGroups(currentProject?.id || "");
const { user } = useUser();
const { popUp, handlePopUpToggle, handlePopUpOpen } = usePopUp(["editRequest"] as const);
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/ApprovalPolicyList.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/ApprovalPolicyList.tsx
index 3d292f9a28..58516dced9 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/ApprovalPolicyList.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/ApprovalPolicyList.tsx
@@ -42,7 +42,7 @@ import {
TProjectPermission,
useProjectPermission,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { ProjectPermissionActions } from "@app/context/ProjectPermissionContext/types";
import {
@@ -59,7 +59,7 @@ import {
import { useGetAccessApprovalPolicies } from "@app/hooks/api/accessApproval/queries";
import { OrderByDirection } from "@app/hooks/api/generic/types";
import { PolicyType } from "@app/hooks/api/policies/enums";
-import { TAccessApprovalPolicy, Workspace } from "@app/hooks/api/types";
+import { TAccessApprovalPolicy, Project } from "@app/hooks/api/types";
import { AccessPolicyForm } from "./components/AccessPolicyModal";
import { ApprovalPolicyRow } from "./components/ApprovalPolicyRow";
@@ -81,24 +81,24 @@ type PolicyFilters = {
environmentIds: string[];
};
-const useApprovalPolicies = (permission: TProjectPermission, currentWorkspace?: Workspace) => {
+const useApprovalPolicies = (permission: TProjectPermission, currentProject?: Project) => {
const { data: accessPolicies, isPending: isAccessPoliciesLoading } = useGetAccessApprovalPolicies(
{
- projectSlug: currentWorkspace?.slug as string,
+ projectSlug: currentProject?.slug as string,
options: {
enabled:
permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval) &&
- !!currentWorkspace?.slug
+ !!currentProject?.slug
}
}
);
const { data: secretPolicies, isPending: isSecretPoliciesLoading } = useGetSecretApprovalPolicies(
{
- workspaceId: currentWorkspace?.id as string,
+ projectId: currentProject?.id as string,
options: {
enabled:
permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval) &&
- !!currentWorkspace?.id
+ !!currentProject?.id
}
}
);
@@ -126,14 +126,14 @@ export const ApprovalPolicyList = ({ workspaceId }: IProps) => {
] as const);
const { permission } = useProjectPermission();
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: members } = useGetWorkspaceUsers(workspaceId, true);
- const { data: groups } = useListWorkspaceGroups(currentWorkspace?.id || "");
+ const { data: groups } = useListWorkspaceGroups(currentProject?.id || "");
const { policies, isLoading: isPoliciesLoading } = useApprovalPolicies(
permission,
- currentWorkspace
+ currentProject
);
const [filters, setFilters] = useState<PolicyFilters>({
@@ -367,7 +367,7 @@ export const ApprovalPolicyList = ({ workspaceId }: IProps) => {
Change Policy
</DropdownMenuItem>
<DropdownMenuLabel>Environment</DropdownMenuLabel>
- {currentWorkspace.environments.map((env) => (
+ {currentProject.environments.map((env) => (
<DropdownMenuItem
onClick={(e) => {
e.preventDefault();
@@ -466,7 +466,7 @@ export const ApprovalPolicyList = ({ workspaceId }: IProps) => {
</Td>
</Tr>
)}
- {!!currentWorkspace &&
+ {!!currentProject &&
filteredPolicies
?.slice(offset, perPage * page)
.map((policy) => (
@@ -497,8 +497,8 @@ export const ApprovalPolicyList = ({ workspaceId }: IProps) => {
</div>
</motion.div>
<AccessPolicyForm
- projectId={currentWorkspace.id}
- projectSlug={currentWorkspace.slug}
+ projectId={currentProject.id}
+ projectSlug={currentProject.slug}
isOpen={popUp.policyForm.isOpen}
onToggle={(isOpen) => handlePopUpToggle("policyForm", isOpen)}
members={members}
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx
index 856c16ee17..b78b8aa0c1 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx
@@ -22,7 +22,7 @@ import {
Tooltip
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { getMemberLabel } from "@app/helpers/members";
import { policyDetails } from "@app/helpers/policies";
import {
@@ -207,10 +207,10 @@ const Form = ({
name: "sequenceApprovers"
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: groups } = useListWorkspaceGroups(projectId);
- const availableEnvironments = currentWorkspace?.environments || [];
+ const availableEnvironments = currentProject?.environments || [];
const isAccessPolicyType = watch("policyType") === PolicyType.AccessPolicy;
const { mutateAsync: createAccessApprovalPolicy } = useCreateAccessApprovalPolicy();
@@ -246,7 +246,7 @@ const Form = ({
approvers: [...userApprovers, ...groupApprovers],
bypassers: bypassers.length > 0 ? bypassers : undefined,
environments: environments.map((env) => env.slug),
- workspaceId: currentWorkspace?.id || ""
+ projectId: currentProject?.id || ""
});
} else {
await createAccessApprovalPolicy({
@@ -302,7 +302,7 @@ const Form = ({
...data,
approvers: [...userApprovers, ...groupApprovers],
bypassers: bypassers.length > 0 ? bypassers : undefined,
- workspaceId: currentWorkspace?.id || "",
+ projectId: currentProject?.id || "",
environments: environments.map((env) => env.slug)
});
} else {
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/ApprovalPolicyRow.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/ApprovalPolicyRow.tsx
index 89a97003e6..13147b37ba 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/ApprovalPolicyRow.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/ApprovalPolicyRow.tsx
@@ -33,13 +33,13 @@ import { Approver } from "@app/hooks/api/accessApproval/types";
import { TGroupMembership } from "@app/hooks/api/groups/types";
import { EnforcementLevel, PolicyType } from "@app/hooks/api/policies/enums";
import { ApproverType } from "@app/hooks/api/secretApproval/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { TWorkspaceUser } from "@app/hooks/api/users/types";
interface IPolicy {
id: string;
name: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
projectId?: string;
secretPath?: string;
approvals: number;
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/RemoveApprovalPolicyModal.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/RemoveApprovalPolicyModal.tsx
index d267ffc785..c9f92f6ede 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/RemoveApprovalPolicyModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/RemoveApprovalPolicyModal.tsx
@@ -4,7 +4,7 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { DeleteActionModal, Spinner } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
useDeleteAccessApprovalPolicy,
useDeleteSecretApprovalPolicy,
@@ -29,18 +29,18 @@ export const RemoveApprovalPolicyModal = ({
const { mutateAsync: deleteSecretApprovalPolicy } = useDeleteSecretApprovalPolicy();
const { mutateAsync: deleteAccessApprovalPolicy } = useDeleteAccessApprovalPolicy();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const handleDeletePolicy = async () => {
try {
if (policyType === PolicyType.ChangePolicy) {
await deleteSecretApprovalPolicy({
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
id: policyId
});
} else {
await deleteAccessApprovalPolicy({
- projectSlug: currentWorkspace.slug,
+ projectSlug: currentProject.slug,
id: policyId
});
}
@@ -59,14 +59,14 @@ export const RemoveApprovalPolicyModal = ({
const deleteSecretApprovalData = useGetSecretApprovalRequestCount({
policyId,
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
options: {
enabled: Boolean(policyId) && policyType === PolicyType.ChangePolicy
}
});
const deleteAccessApprovalData = useGetAccessRequestsCount({
- projectSlug: currentWorkspace.slug,
+ projectSlug: currentProject.slug,
policyId,
options: {
enabled: Boolean(policyId) && policyType === PolicyType.AccessPolicy
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/SecretApprovalRequest.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/SecretApprovalRequest.tsx
index 46b611328f..8543bac19f 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/SecretApprovalRequest.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/SecretApprovalRequest.tsx
@@ -37,7 +37,7 @@ import {
ProjectPermissionSub,
useProjectPermission,
useUser,
- useWorkspace
+ useProject
} from "@app/context";
import {
getUserTablePreference,
@@ -58,8 +58,7 @@ import {
} from "./components/SecretApprovalRequestChanges";
export const SecretApprovalRequest = () => {
- const { currentWorkspace } = useWorkspace();
- const workspaceId = currentWorkspace?.id || "";
+ const { currentProject, projectId } = useProject();
const [selectedApprovalId, setSelectedApprovalId] = useState<string | null>(null);
// filters
@@ -92,7 +91,7 @@ export const SecretApprovalRequest = () => {
isPending: isApprovalRequestLoading,
refetch
} = useGetSecretApprovalRequests({
- workspaceId,
+ projectId,
status: statusFilter,
environment: envFilter,
committer: committerFilter,
@@ -105,14 +104,14 @@ export const SecretApprovalRequest = () => {
const secretApprovalRequests = data?.approvals ?? [];
const { data: secretApprovalRequestCount, isSuccess: isSecretApprovalReqCountSuccess } =
- useGetSecretApprovalRequestCount({ workspaceId });
+ useGetSecretApprovalRequestCount({ projectId });
const { user: userSession } = useUser();
const search = useSearch({
from: ROUTE_PATHS.SecretManager.ApprovalPage.id
});
const { permission } = useProjectPermission();
- const { data: members } = useGetWorkspaceUsers(workspaceId);
+ const { data: members } = useGetWorkspaceUsers(projectId);
const isSecretApprovalScreen = Boolean(selectedApprovalId);
const { requestId } = search;
@@ -143,7 +142,6 @@ export const SecretApprovalRequest = () => {
exit={{ opacity: 0, translateX: 30 }}
>
<SecretApprovalRequestChanges
- workspaceId={workspaceId}
approvalRequestId={selectedApprovalId || ""}
onGoBack={handleGoBackSecretRequestDetail}
/>
@@ -241,7 +239,7 @@ export const SecretApprovalRequest = () => {
<DropdownMenuLabel className="sticky top-0 bg-mineshaft-900">
Select an Environment
</DropdownMenuLabel>
- {currentWorkspace?.environments.map(({ slug, name }) => (
+ {currentProject?.environments.map(({ slug, name }) => (
<DropdownMenuItem
onClick={() => setEnvFilter((state) => (state === slug ? undefined : slug))}
key={`request-filter-${slug}`}
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestAction.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestAction.tsx
index ee45a442b4..c7bc713a82 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestAction.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestAction.tsx
@@ -18,6 +18,7 @@ import {
useUpdateSecretApprovalRequestStatus
} from "@app/hooks/api";
import { EnforcementLevel } from "@app/hooks/api/policies/enums";
+import { useProject } from "@app/context";
type Props = {
approvalRequestId: string;
@@ -28,7 +29,6 @@ type Props = {
canApprove?: boolean;
isBypasser: boolean;
statusChangeByEmail?: string;
- workspaceId: string;
enforcementLevel: EnforcementLevel;
};
@@ -39,11 +39,11 @@ export const SecretApprovalRequestAction = ({
isMergable,
approvals,
statusChangeByEmail,
- workspaceId,
enforcementLevel,
canApprove,
isBypasser
}: Props) => {
+ const { projectId } = useProject();
const { mutateAsync: performSecretApprovalMerge, isPending: isMerging } =
usePerformSecretApprovalRequestMerge();
@@ -62,7 +62,7 @@ export const SecretApprovalRequestAction = ({
try {
await performSecretApprovalMerge({
id: approvalRequestId,
- workspaceId,
+ projectId,
bypassReason: byPassApproval ? bypassReason : undefined
});
createNotification({
@@ -83,7 +83,7 @@ export const SecretApprovalRequestAction = ({
await updateSecretStatusChange({
id: approvalRequestId,
status: reqState,
- workspaceId
+ projectId
});
createNotification({
type: "success",
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx
index 636952c336..583c142bed 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx
@@ -33,7 +33,7 @@ import {
TextArea,
Tooltip
} from "@app/components/v2";
-import { useUser, useWorkspace } from "@app/context";
+import { useUser, useProject } from "@app/context";
import { usePopUp } from "@app/hooks";
import {
useGetSecretApprovalRequestDetails,
@@ -92,7 +92,6 @@ const getReviewedStatusSymbol = (status?: ApprovalStatus) => {
};
type Props = {
- workspaceId: string;
approvalRequestId: string;
onGoBack: () => void;
};
@@ -104,13 +103,9 @@ const reviewFormSchema = z.object({
type TReviewFormSchema = z.infer<typeof reviewFormSchema>;
-export const SecretApprovalRequestChanges = ({
- approvalRequestId,
- onGoBack,
- workspaceId
-}: Props) => {
+export const SecretApprovalRequestChanges = ({ approvalRequestId, onGoBack }: Props) => {
const { user: userSession } = useUser();
- const { currentWorkspace } = useWorkspace();
+ const { projectId } = useProject();
const {
data: secretApprovalRequestDetails,
isSuccess: isSecretApprovalRequestSuccess,
@@ -123,7 +118,7 @@ export const SecretApprovalRequestChanges = ({
);
const { data: secretImports } = useGetSecretImports({
environment: secretApprovalRequestDetails?.environment || "",
- projectId: currentWorkspace.id,
+ projectId,
path: approvalSecretPath
});
@@ -526,7 +521,6 @@ export const SecretApprovalRequestChanges = ({
isMergable={isMergable}
statusChangeByEmail={secretApprovalRequestDetails.statusChangedByUser?.email}
enforcementLevel={secretApprovalRequestDetails.policy.enforcementLevel}
- workspaceId={workspaceId}
/>
</div>
</div>
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/SecretDashboardPage.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/SecretDashboardPage.tsx
index a6ae7be628..c7de2b4f28 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/SecretDashboardPage.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/SecretDashboardPage.tsx
@@ -26,7 +26,7 @@ import {
ProjectPermissionDynamicSecretActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import {
ProjectPermissionCommitsActions,
@@ -53,7 +53,7 @@ import { OrderByDirection } from "@app/hooks/api/generic/types";
import { PendingAction } from "@app/hooks/api/secretFolders/types";
import { useCreateCommit } from "@app/hooks/api/secrets/mutations";
import { SecretV3RawSanitized } from "@app/hooks/api/types";
-import { ProjectVersion } from "@app/hooks/api/workspace/types";
+import { ProjectVersion } from "@app/hooks/api/projects/types";
import { usePathAccessPolicies } from "@app/hooks/usePathAccessPolicies";
import { useResizableColWidth } from "@app/hooks/useResizableColWidth";
import { hasSecretReadValueOrDescribePermission } from "@app/lib/fn/permission";
@@ -94,7 +94,7 @@ const LOADER_TEXT = [
];
const Page = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate({
from: ROUTE_PATHS.SecretManager.SecretDashboardPage.path
});
@@ -142,15 +142,15 @@ const Page = () => {
] as const);
// env slug
- const workspaceId = currentWorkspace?.id || "";
- const projectSlug = currentWorkspace?.slug || "";
+ const projectId = currentProject?.id || "";
+ const projectSlug = currentProject?.slug || "";
const secretPath = (routerQueryParams.secretPath as string) || "/";
useEffect(() => {
- if (isBatchMode && workspaceId && environment && secretPath) {
- loadPendingChanges({ workspaceId, environment, secretPath });
+ if (isBatchMode && projectId && environment && secretPath) {
+ loadPendingChanges({ projectId: projectId, environment, secretPath });
}
- }, [isBatchMode, workspaceId, environment, secretPath, loadPendingChanges]);
+ }, [isBatchMode, projectId, environment, secretPath, loadPendingChanges]);
const canReadSecret = hasSecretReadValueOrDescribePermission(
permission,
@@ -240,7 +240,7 @@ const Page = () => {
const { togglePopUp } = usePopUpAction();
useEffect(() => {
- if (!currentWorkspace?.environments.find((env) => env.slug === environment)) {
+ if (!currentProject?.environments.find((env) => env.slug === environment)) {
createNotification({
text: "No environment found with given slug",
type: "error"
@@ -248,11 +248,11 @@ const Page = () => {
navigate({
to: "/projects/secret-management/$projectId/overview",
params: {
- projectId: workspaceId
+ projectId: projectId
}
});
}
- }, [currentWorkspace, environment]);
+ }, [currentProject, environment]);
const isResourceTypeFiltered = Object.values(filter.include).some(Boolean);
const {
@@ -262,7 +262,7 @@ const Page = () => {
isFetched
} = useGetProjectSecretsDetails({
environment,
- projectId: workspaceId,
+ projectId: projectId,
secretPath,
offset,
limit,
@@ -316,7 +316,7 @@ const Page = () => {
// fetch imported secrets to show user the overriden ones
const { data: importedSecrets } = useGetImportedSecretsSingleEnv({
- projectId: workspaceId,
+ projectId: projectId,
environment,
path: secretPath,
options: {
@@ -326,13 +326,13 @@ const Page = () => {
// fetch tags
const { data: tags } = useGetWsTags(
- permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags) ? workspaceId : ""
+ permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags) ? projectId : ""
);
const { pathPolicies, hasPathPolicies } = usePathAccessPolicies({ secretPath, environment });
const { data: boardPolicy } = useGetSecretApprovalPolicyOfABoard({
- workspaceId,
+ projectId,
environment,
secretPath
});
@@ -341,7 +341,7 @@ const Page = () => {
const handleCreateCommit = async (changes: PendingChanges, message: string) => {
try {
await createCommit({
- workspaceId,
+ projectId,
environment,
secretPath,
pendingChanges: changes,
@@ -368,7 +368,7 @@ const Page = () => {
fetchNextPage: fetchNextSnapshotList,
hasNextPage: hasNextSnapshotListPage
} = useGetWorkspaceSnapshotList({
- workspaceId,
+ projectId,
directory: secretPath,
environment,
isPaused: !popUp.snapshots.isOpen || !canDoReadRollback,
@@ -381,7 +381,7 @@ const Page = () => {
isFetching: isFolderCommitsCountFetching
} = useGetFolderCommitsCount({
directory: secretPath,
- workspaceId,
+ projectId,
environment,
isPaused: !canReadCommits
});
@@ -391,13 +391,13 @@ const Page = () => {
isPending: isSnapshotCountLoading,
isFetching: isSnapshotCountFetching
} = useGetWsSnapshotCount({
- workspaceId,
+ projectId,
environment,
directory: secretPath,
isPaused: !canDoReadRollback
});
- const isPITEnabled = !currentWorkspace?.showSnapshotsLegacy;
+ const isPITEnabled = !currentProject?.showSnapshotsLegacy;
const changesCount = useMemo(() => {
return isPITEnabled ? folderCommitsCount : snapshotCount;
@@ -416,7 +416,7 @@ const Page = () => {
navigate({
to: "/projects/secret-management/$projectId/commits/$environment/$folderId",
params: {
- projectId: workspaceId,
+ projectId: projectId,
folderId,
environment
},
@@ -647,7 +647,7 @@ const Page = () => {
? change.tags?.map((tag) => ({
id: tag.id,
slug: tag.slug,
- projectId: workspaceId,
+ projectId: projectId,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
__v: 0
@@ -734,7 +734,7 @@ const Page = () => {
const mergedSecrets = getMergedSecretsWithPending();
const mergedFolders = getMergedFoldersWithPending();
- if (!(currentWorkspace?.version === ProjectVersion.V3))
+ if (!(currentProject?.version === ProjectVersion.V3))
return (
<div className="flex h-full w-full flex-col items-center justify-center px-6 text-mineshaft-50 dark:[color-scheme:dark]">
<SecretV2MigrationSection />
@@ -794,8 +794,6 @@ const Page = () => {
<>
<ActionBar
environment={environment}
- workspaceId={workspaceId}
- projectSlug={projectSlug}
secretPath={secretPath}
isVisible={isVisible}
isBatchMode={isBatchMode}
@@ -957,7 +955,7 @@ const Page = () => {
secretImports={imports}
isFetching={isDetailsFetching}
environment={environment}
- workspaceId={workspaceId}
+ workspaceId={projectId}
secretPath={secretPath}
importedSecrets={importedSecrets}
/>
@@ -966,7 +964,7 @@ const Page = () => {
<FolderListView
folders={mergedFolders}
environment={environment}
- workspaceId={workspaceId}
+ workspaceId={projectId}
secretPath={secretPath}
onNavigateToFolder={handleResetFilter}
canNavigate={isFetched}
@@ -990,7 +988,7 @@ const Page = () => {
tags={tags}
isVisible={isVisible}
environment={environment}
- workspaceId={workspaceId}
+ projectId={projectId}
secretPath={secretPath}
isProtectedBranch={isProtectedBranch}
importedBy={importedBy}
@@ -1001,7 +999,7 @@ const Page = () => {
<CommitForm
onCommit={handleCreateCommit}
environment={environment}
- workspaceId={workspaceId}
+ workspaceId={projectId}
secretPath={secretPath}
isCommitting={isCommitPending}
/>
@@ -1052,9 +1050,9 @@ const Page = () => {
>
<CreateSecretForm
environment={environment}
- workspaceId={workspaceId}
+ projectId={projectId}
secretPath={secretPath}
- autoCapitalize={currentWorkspace?.autoCapitalization}
+ autoCapitalize={currentProject?.autoCapitalization}
isProtectedBranch={isProtectedBranch}
isBatchMode={isBatchMode}
/>
@@ -1073,10 +1071,10 @@ const Page = () => {
)}
<SecretDropzone
environment={environment}
- workspaceId={workspaceId}
+ projectId={projectId}
secretPath={secretPath}
isSmaller={isNotEmpty}
- environments={currentWorkspace?.environments}
+ environments={currentProject?.environments}
isProtectedBranch={isProtectedBranch}
/>
<PitDrawer
@@ -1094,7 +1092,7 @@ const Page = () => {
<SnapshotView
snapshotId={snapshotId || ""}
environment={environment}
- workspaceId={workspaceId}
+ projectId={projectId}
secretPath={secretPath}
secrets={secrets}
folders={folders}
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/SecretMainPage.store.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/SecretMainPage.store.tsx
index 15ee3b9c6b..4cccc64802 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/SecretMainPage.store.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/SecretMainPage.store.tsx
@@ -97,7 +97,7 @@ export interface PendingChanges {
// Context interface for batch operations
export interface BatchContext {
- workspaceId: string;
+ projectId: string;
environment: string;
secretPath: string;
}
@@ -257,8 +257,8 @@ type BatchModeState = {
};
};
-const generateContextKey = (workspaceId: string, environment: string, secretPath: string) => {
- return `${workspaceId}_${environment}_${secretPath}`;
+const generateContextKey = (projectId: string, environment: string, secretPath: string) => {
+ return `${projectId}_${environment}_${secretPath}`;
};
const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState> = (set, get) => ({
@@ -272,7 +272,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
addPendingChange: (change: PendingChange, context: BatchContext) =>
set((state) => {
const contextKey = generateContextKey(
- context.workspaceId,
+ context.projectId,
context.environment,
context.secretPath
);
@@ -551,7 +551,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
const currentChanges =
contextKey ===
generateContextKey(
- state.currentContext?.workspaceId || context.workspaceId,
+ state.currentContext?.projectId || context.projectId,
state.currentContext?.environment || context.environment,
state.currentContext?.secretPath || context.secretPath
)
@@ -568,7 +568,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
removePendingChange: (changeId: string, resourceType: string, context: BatchContext) =>
set((state) => {
const contextKey = generateContextKey(
- context.workspaceId,
+ context.projectId,
context.environment,
context.secretPath
);
@@ -593,7 +593,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
state.currentContext &&
contextKey ===
generateContextKey(
- state.currentContext.workspaceId,
+ state.currentContext.projectId,
state.currentContext.environment,
state.currentContext.secretPath
);
@@ -606,7 +606,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
loadPendingChanges: (context) => {
const contextKey = generateContextKey(
- context.workspaceId,
+ context.projectId,
context.environment,
context.secretPath
);
@@ -626,7 +626,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
clearAllPendingChanges: (context) => {
const contextKey = generateContextKey(
- context.workspaceId,
+ context.projectId,
context.environment,
context.secretPath
);
@@ -641,7 +641,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
state.currentContext &&
contextKey ===
generateContextKey(
- state.currentContext.workspaceId,
+ state.currentContext.projectId,
state.currentContext.environment,
state.currentContext.secretPath
);
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
index 9252d71a12..9969d06322 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
@@ -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 && (
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsElastiCacheInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsElastiCacheInputForm.tsx
index 84cf7f7b5c..e458f347c4 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsElastiCacheInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsElastiCacheInputForm.tsx
@@ -19,7 +19,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
const formSchema = z.object({
provider: z.object({
@@ -63,7 +63,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsIamInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsIamInputForm.tsx
index f9ed9967cd..a50352f580 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsIamInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AwsIamInputForm.tsx
@@ -20,7 +20,7 @@ import {
DynamicSecretAwsIamAuth,
DynamicSecretProviders
} from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { MetadataForm } from "../../DynamicSecretListView/MetadataForm";
@@ -112,7 +112,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AzureEntraIdInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AzureEntraIdInputForm.tsx
index 771523828d..6c4ccd65b2 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AzureEntraIdInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AzureEntraIdInputForm.tsx
@@ -18,7 +18,7 @@ import { Tooltip } from "@app/components/v2/Tooltip";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { useGetDynamicSecretProviderData } from "@app/hooks/api/dynamicSecret/queries";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
const formSchema = z.object({
selectedUsers: z.array(
@@ -66,7 +66,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CassandraInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CassandraInputForm.tsx
index 8f99d368cd..0ef4d092d2 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CassandraInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CassandraInputForm.tsx
@@ -19,7 +19,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
const formSchema = z.object({
@@ -66,7 +66,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CouchbaseInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CouchbaseInputForm.tsx
index fd2eecaa62..1b42dc7e02 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CouchbaseInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CouchbaseInputForm.tsx
@@ -24,7 +24,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
// Component for managing scopes and collections within a bucket
@@ -265,7 +265,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CreateDynamicSecretForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CreateDynamicSecretForm.tsx
index abe14d82de..dd169727db 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CreateDynamicSecretForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/CreateDynamicSecretForm.tsx
@@ -24,7 +24,7 @@ import { AnimatePresence, motion } from "framer-motion";
import { Modal, ModalContent } from "@app/components/v2";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { AwsElastiCacheInputForm } from "./AwsElastiCacheInputForm";
import { AwsIamInputForm } from "./AwsIamInputForm";
@@ -51,7 +51,7 @@ type Props = {
isOpen?: boolean;
onToggle: (isOpen: boolean) => void;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
secretPath: string;
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/ElasticSearchInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/ElasticSearchInputForm.tsx
index 51dcea68b0..390909e810 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/ElasticSearchInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/ElasticSearchInputForm.tsx
@@ -20,7 +20,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
const authMethods = [
@@ -87,7 +87,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/GcpIamInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/GcpIamInputForm.tsx
index f47273aa18..e7518830d8 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/GcpIamInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/GcpIamInputForm.tsx
@@ -8,7 +8,7 @@ import { createNotification } from "@app/components/notifications";
import { Button, FilterableSelect, FormControl, Input } from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
const validateTTL = (val: string, ctx: z.RefinementCtx) => {
if (!val) return;
@@ -49,7 +49,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/GithubInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/GithubInputForm.tsx
index 800bc677a3..acac4e0aa6 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/GithubInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/GithubInputForm.tsx
@@ -16,7 +16,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
const formSchema = z.object({
provider: z.object({
@@ -44,7 +44,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/KubernetesInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/KubernetesInputForm.tsx
index 2b08382468..945e46777d 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/KubernetesInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/KubernetesInputForm.tsx
@@ -28,7 +28,7 @@ import {
DynamicSecretProviders,
KubernetesDynamicSecretCredentialType
} from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
enum RoleType {
@@ -150,7 +150,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/LdapInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/LdapInputForm.tsx
index f2f5c9233e..62f8cdd967 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/LdapInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/LdapInputForm.tsx
@@ -16,7 +16,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
enum CredentialType {
@@ -89,7 +89,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/MongoAtlasInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/MongoAtlasInputForm.tsx
index 821730b08d..05109e5a3b 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/MongoAtlasInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/MongoAtlasInputForm.tsx
@@ -23,7 +23,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
const formSchema = z.object({
@@ -77,7 +77,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/MongoDBInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/MongoDBInputForm.tsx
index 5a89f4649d..646755a8fc 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/MongoDBInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/MongoDBInputForm.tsx
@@ -18,7 +18,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
const formSchema = z.object({
@@ -67,7 +67,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/RabbitMqInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/RabbitMqInputForm.tsx
index f80c374d84..1c2db7d2af 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/RabbitMqInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/RabbitMqInputForm.tsx
@@ -18,7 +18,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
const formSchema = z.object({
@@ -71,7 +71,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/RedisInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/RedisInputForm.tsx
index 4d0c51194f..06bf4e41a2 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/RedisInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/RedisInputForm.tsx
@@ -19,7 +19,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
const formSchema = z.object({
@@ -64,7 +64,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SapAseInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SapAseInputForm.tsx
index 413bbe0b6d..507e678205 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SapAseInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SapAseInputForm.tsx
@@ -18,7 +18,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
const formSchema = z.object({
@@ -62,7 +62,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SapHanaInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SapHanaInputForm.tsx
index deea1ada1c..38ddbc7f03 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SapHanaInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SapHanaInputForm.tsx
@@ -19,7 +19,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
const formSchema = z.object({
@@ -64,7 +64,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SnowflakeInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SnowflakeInputForm.tsx
index 3120d7cef6..30f01c13f4 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SnowflakeInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SnowflakeInputForm.tsx
@@ -18,7 +18,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
const formSchema = z.object({
@@ -62,7 +62,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SqlDatabaseInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SqlDatabaseInputForm.tsx
index 050a51754f..b0c18fbd36 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SqlDatabaseInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SqlDatabaseInputForm.tsx
@@ -29,7 +29,7 @@ import {
} from "@app/context/OrgPermissionContext/types";
import { gatewaysQueryKeys, useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders, SqlProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
import { MetadataForm } from "../../DynamicSecretListView/MetadataForm";
@@ -110,7 +110,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/TotpInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/TotpInputForm.tsx
index 1ec9f8a0cd..63680f524d 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/TotpInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/TotpInputForm.tsx
@@ -13,7 +13,7 @@ import {
} from "@app/components/v2";
import { useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { slugSchema } from "@app/lib/schemas";
enum ConfigType {
@@ -66,7 +66,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VerticaInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VerticaInputForm.tsx
index d5443b1edf..ca417adb6e 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VerticaInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/VerticaInputForm.tsx
@@ -27,7 +27,7 @@ import {
} from "@app/context/OrgPermissionContext/types";
import { gatewaysQueryKeys, useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
const passwordRequirementsSchema = z
.object({
@@ -91,7 +91,7 @@ type Props = {
onCancel: () => void;
secretPath: string;
projectSlug: string;
- environments: WorkspaceEnv[];
+ environments: ProjectEnv[];
isSingleEnvironmentMode?: boolean;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx
index 9bdace648e..e7911aa901 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx
@@ -14,7 +14,7 @@ import {
SelectItem
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
-import { useSubscription, useWorkspace } from "@app/context";
+import { useSubscription, useProject } from "@app/context";
import { useCreateSecretImport } from "@app/hooks/api";
const typeSchema = z.object({
@@ -32,7 +32,7 @@ type TFormSchema = z.infer<typeof typeSchema>;
type Props = {
environment: string;
- workspaceId: string;
+ projectId: string;
secretPath?: string;
// modal props
isOpen?: boolean;
@@ -43,7 +43,7 @@ type Props = {
export const CreateSecretImportForm = ({
environment,
- workspaceId,
+ projectId: workspaceId,
secretPath = "/",
isOpen,
onClose,
@@ -57,8 +57,8 @@ export const CreateSecretImportForm = ({
watch,
formState: { isSubmitting }
} = useForm<TFormSchema>({ resolver: zodResolver(typeSchema) });
- const { currentWorkspace } = useWorkspace();
- const environments = currentWorkspace?.environments || [];
+ const { currentProject } = useProject();
+ const environments = currentProject?.environments || [];
const selectedEnvironment = watch("environment");
const { subscription } = useSubscription();
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/MoveSecretsModal.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/MoveSecretsModal.tsx
index 606f23fac8..05f00315d6 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/MoveSecretsModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/MoveSecretsModal.tsx
@@ -12,7 +12,7 @@ import {
SelectItem
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { UsePopUpState } from "@app/hooks/usePopUp";
type Props = {
@@ -47,8 +47,8 @@ export const MoveSecretsModal = ({ popUp, handlePopUpToggle, onMoveApproved }: P
formState: { isSubmitting }
} = useForm<TFormSchema>({ resolver: zodResolver(formSchema) });
- const { currentWorkspace } = useWorkspace();
- const environments = currentWorkspace?.environments || [];
+ const { currentProject } = useProject();
+ const environments = currentProject?.environments || [];
const selectedEnvironment = watch("environment");
const handleFormSubmit = (data: TFormSchema) => {
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ReplicateFolderFromBoard/ReplicateFolderFromBoard.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ReplicateFolderFromBoard/ReplicateFolderFromBoard.tsx
index 339612a899..814373eb54 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ReplicateFolderFromBoard/ReplicateFolderFromBoard.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ReplicateFolderFromBoard/ReplicateFolderFromBoard.tsx
@@ -48,7 +48,7 @@ type Props = {
env: Record<string, Record<string, { value: string; comments: string[]; secretPath?: string }>>
) => void;
environments?: { name: string; slug: string }[];
- workspaceId: string;
+ projectId: string;
environment: string;
secretPath: string;
};
@@ -64,7 +64,7 @@ type SecretStructure = {
export const ReplicateFolderFromBoard = ({
environments = [],
- workspaceId,
+ projectId: workspaceId,
isOpen,
onToggle,
onParsedEnv
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx
index c3f5e74eeb..1670a4b7f1 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx
@@ -245,7 +245,7 @@ const ResourceChange: React.FC<ResourceChangeProps> = ({
const handleDeletePending = useCallback(
(changeType: string, id: string) => {
removePendingChange(id, changeType, {
- workspaceId,
+ projectId: workspaceId,
environment,
secretPath
});
@@ -291,7 +291,7 @@ export const CommitForm: React.FC<CommitFormProps> = ({
}
await onCommit(pendingChanges, commitMessage);
clearAllPendingChanges({
- workspaceId,
+ projectId: workspaceId,
environment,
secretPath
});
@@ -336,7 +336,7 @@ export const CommitForm: React.FC<CommitFormProps> = ({
<Button
size="sm"
onClick={() =>
- clearAllPendingChanges({ workspaceId, environment, secretPath })
+ clearAllPendingChanges({ projectId: workspaceId, environment, secretPath })
}
isDisabled={totalChangesCount === 0}
variant="outline_bg"
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CompareEnvironments/CompareEnvironments.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CompareEnvironments/CompareEnvironments.tsx
index c3570bf5ac..2d26ed025c 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CompareEnvironments/CompareEnvironments.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CompareEnvironments/CompareEnvironments.tsx
@@ -38,7 +38,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
getUserTablePreference,
PreferenceKey,
@@ -49,7 +49,7 @@ import { useGetImportedSecretsAllEnvs } from "@app/hooks/api";
import { useGetProjectSecretsOverview } from "@app/hooks/api/dashboard";
import { DashboardSecretsOrderBy } from "@app/hooks/api/dashboard/types";
import { OrderByDirection } from "@app/hooks/api/generic/types";
-import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { ProjectEnv } from "@app/hooks/api/projects/types";
import { useResizableColWidth } from "@app/hooks/useResizableColWidth";
import {
useDynamicSecretOverview,
@@ -89,10 +89,10 @@ const DEFAULT_FILTER_STATE = {
const COL_WIDTH_OFFSET = 220;
export const CompareEnvironments = ({ secretPath }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const compareEnvironmentsKey = `compare-environments-${currentWorkspace.id}`;
+ const { currentProject } = useProject();
+ const compareEnvironmentsKey = `compare-environments-${currentProject.id}`;
- const [selectedEnvironments, setSelectedEnvironments] = useState<WorkspaceEnv[]>(() => {
+ const [selectedEnvironments, setSelectedEnvironments] = useState<ProjectEnv[]>(() => {
try {
const storedEnvironments = JSON.parse(localStorage.getItem(compareEnvironmentsKey) ?? "[]");
@@ -104,12 +104,12 @@ export const CompareEnvironments = ({ secretPath }: Props) => {
}
});
- return currentWorkspace.environments.filter((env) => potentialEnvs.includes(env.id));
+ return currentProject.environments.filter((env) => potentialEnvs.includes(env.id));
}
} catch {
// do nothing and proceed
}
- return currentWorkspace.environments.slice(0, 2);
+ return currentProject.environments.slice(0, 2);
});
const [filter, setFilter] = useState<Filter>(DEFAULT_FILTER_STATE);
@@ -133,7 +133,7 @@ export const CompareEnvironments = ({ secretPath }: Props) => {
setUserTablePreference("secretCompareTable", PreferenceKey.PerPage, newPerPage);
};
- const workspaceId = currentWorkspace.id;
+ const workspaceId = currentProject.id;
const [searchFilter, setSearchFilter] = useState("");
const [debouncedSearchFilter] = useDebounce(searchFilter);
const [debouncedSelectedEnvironments] = useDebounce(selectedEnvironments);
@@ -153,12 +153,12 @@ export const CompareEnvironments = ({ secretPath }: Props) => {
} = useGetImportedSecretsAllEnvs({
projectId: workspaceId,
path: secretPath,
- environments: (currentWorkspace.environments || []).map(({ slug }) => slug)
+ environments: (currentProject.environments || []).map(({ slug }) => slug)
});
const compareEnvironments = selectedEnvironments.length
? selectedEnvironments
- : currentWorkspace.environments;
+ : currentProject.environments;
const isFilteredByResources = Object.values(filter).some(Boolean);
const { isPending: isOverviewLoading, data: overview } = useGetProjectSecretsOverview(
@@ -579,12 +579,12 @@ export const CompareEnvironments = ({ secretPath }: Props) => {
<FilterableSelect
value={selectedEnvironments}
onChange={(value) => {
- const selected = value as MultiValue<WorkspaceEnv>;
+ const selected = value as MultiValue<ProjectEnv>;
- setSelectedEnvironments((selected as WorkspaceEnv[]) ?? []);
+ setSelectedEnvironments((selected as ProjectEnv[]) ?? []);
}}
placeholder="Leave blank to compare all environments"
- options={currentWorkspace.environments}
+ options={currentProject.environments}
getOptionValue={(option) => option.slug}
getOptionLabel={(option) => option.name}
isMulti
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CompareEnvironments/components/SecretRow/SecretRow.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CompareEnvironments/components/SecretRow/SecretRow.tsx
index 095b503567..7f2efca877 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CompareEnvironments/components/SecretRow/SecretRow.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CompareEnvironments/components/SecretRow/SecretRow.tsx
@@ -17,7 +17,7 @@ import {
} from "@app/context/ProjectPermissionContext/types";
import { useToggle } from "@app/hooks";
import { SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
-import { WorkspaceEnv } from "@app/hooks/api/types";
+import { ProjectEnv } from "@app/hooks/api/types";
import { HIDDEN_SECRET_VALUE } from "@app/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem";
import { EnvironmentStatus, EnvironmentStatusCell, ResourceNameCell } from "../shared";
@@ -32,7 +32,7 @@ type Props = {
getImportedSecretByKey: (
env: string,
secretName: string
- ) => { secret?: SecretV3RawSanitized; environmentInfo?: WorkspaceEnv } | undefined;
+ ) => { secret?: SecretV3RawSanitized; environmentInfo?: ProjectEnv } | undefined;
colWidth: number;
tableWidth: number;
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CreateSecretForm/CreateSecretForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CreateSecretForm/CreateSecretForm.tsx
index 9b43d820d8..a1ac9c8cb1 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CreateSecretForm/CreateSecretForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CreateSecretForm/CreateSecretForm.tsx
@@ -32,7 +32,7 @@ type TFormSchema = z.infer<typeof typeSchema>;
type Props = {
environment: string;
- workspaceId: string;
+ projectId: string;
secretPath?: string;
// modal props
autoCapitalize?: boolean;
@@ -42,7 +42,7 @@ type Props = {
export const CreateSecretForm = ({
environment,
- workspaceId,
+ projectId,
secretPath = "/",
autoCapitalize = true,
isProtectedBranch = false,
@@ -66,7 +66,7 @@ export const CreateSecretForm = ({
const { permission } = useProjectPermission();
const canReadTags = permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags);
const { data: projectTags, isPending: isTagsLoading } = useGetWsTags(
- canReadTags ? workspaceId : ""
+ canReadTags ? projectId : ""
);
const secretKeyInputRef = useRef<HTMLInputElement>(null);
@@ -80,7 +80,7 @@ export const CreateSecretForm = ({
try {
const parsedSlug = slugSchema.parse(slug);
await createWsTag.mutateAsync({
- workspaceID: workspaceId,
+ projectId,
tagSlug: parsedSlug,
tagColor: ""
});
@@ -106,7 +106,8 @@ export const CreateSecretForm = ({
resourceType: "secret"
};
addPendingChange(pendingSecretCreate, {
- workspaceId,
+ projectId,
+
environment,
secretPath
});
@@ -116,7 +117,7 @@ export const CreateSecretForm = ({
}
await createSecretV3({
environment,
- workspaceId,
+ projectId,
secretPath,
secretKey: key,
secretValue: value || "",
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/EnvironmentTabs/EnvironmentTabs.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/EnvironmentTabs/EnvironmentTabs.tsx
index 66fd3a8785..5903351d2f 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/EnvironmentTabs/EnvironmentTabs.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/EnvironmentTabs/EnvironmentTabs.tsx
@@ -25,11 +25,11 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { usePopUp } from "@app/hooks";
-import { workspaceKeys } from "@app/hooks/api";
-import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { projectKeys } from "@app/hooks/api";
+import { ProjectEnv } from "@app/hooks/api/projects/types";
import { AddEnvironmentModal } from "@app/pages/secret-manager/SettingsPage/components/EnvironmentSection/AddEnvironmentModal";
import { CompareEnvironments } from "../CompareEnvironments";
@@ -45,7 +45,7 @@ type Props = {
const TABS_TO_SHOW = 5;
export const EnvironmentTabs = ({ secretPath }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const currentEnv = useParams({
from: ROUTE_PATHS.SecretManager.SecretDashboardPage.id,
select: (el) => el.envSlug
@@ -54,8 +54,8 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
const { subscription } = useSubscription();
const isMoreEnvironmentsAllowed =
- subscription?.environmentLimit && currentWorkspace?.environments
- ? currentWorkspace.environments.length < subscription.environmentLimit
+ subscription?.environmentLimit && currentProject?.environments
+ ? currentProject.environments.length < subscription.environmentLimit
: true;
const [isNavigating, setIsNavigating] = useState(false);
@@ -68,20 +68,20 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
"upgradePlan"
] as const);
- const selectedIndex = currentWorkspace.environments.findIndex((env) => env.slug === currentEnv);
+ const selectedIndex = currentProject.environments.findIndex((env) => env.slug === currentEnv);
- let tabEnvironments: WorkspaceEnv[];
- let dropdownEnvironments: WorkspaceEnv[];
+ let tabEnvironments: ProjectEnv[];
+ let dropdownEnvironments: ProjectEnv[];
if (selectedIndex < TABS_TO_SHOW) {
- tabEnvironments = currentWorkspace.environments.slice(0, TABS_TO_SHOW);
- dropdownEnvironments = currentWorkspace.environments.slice(TABS_TO_SHOW);
+ tabEnvironments = currentProject.environments.slice(0, TABS_TO_SHOW);
+ dropdownEnvironments = currentProject.environments.slice(TABS_TO_SHOW);
} else {
tabEnvironments = [
- ...currentWorkspace.environments.slice(0, TABS_TO_SHOW - 1),
- currentWorkspace.environments[selectedIndex]
+ ...currentProject.environments.slice(0, TABS_TO_SHOW - 1),
+ currentProject.environments[selectedIndex]
];
- dropdownEnvironments = currentWorkspace.environments
+ dropdownEnvironments = currentProject.environments
.slice(TABS_TO_SHOW - 1)
.filter((env) => env.slug !== currentEnv);
}
@@ -96,7 +96,7 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
to: ROUTE_PATHS.SecretManager.SecretDashboardPage.path,
params: {
envSlug,
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: (prev) => prev
});
@@ -199,7 +199,7 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
</Tooltip>
</Tab>
)}
- {currentWorkspace.environments.length > 1 && (
+ {currentProject.environments.length > 1 && (
<Tab className="ml-auto" value={COMPARE_ENVIRONMENT_TAB}>
<div className="flex items-center gap-x-2 whitespace-nowrap">
<FontAwesomeIcon icon={faArrowRightArrowLeft} />
@@ -232,7 +232,7 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
onOpenChange={(isOpen) => handlePopUpToggle("createEnvironment", isOpen)}
onComplete={async (env) => {
await queryClient.refetchQueries({
- queryKey: workspaceKeys.getWorkspaceById(currentWorkspace.id)
+ queryKey: projectKeys.getProjectById(currentProject.id)
});
handleSelect(env.slug);
}}
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/FolderListView/FolderListView.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/FolderListView/FolderListView.tsx
index fd65bc639d..14d2005a2c 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/FolderListView/FolderListView.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/FolderListView/FolderListView.tsx
@@ -89,7 +89,7 @@ export const FolderListView = ({
};
addPendingChange(updatedCreate, {
- workspaceId,
+ projectId: workspaceId,
environment,
secretPath
});
@@ -106,7 +106,7 @@ export const FolderListView = ({
};
addPendingChange(updateChange, {
- workspaceId,
+ projectId: workspaceId,
environment,
secretPath
});
@@ -140,7 +140,7 @@ export const FolderListView = ({
const handleDeletePending = (id: string) => {
removePendingChange(id, "folder", {
- workspaceId,
+ projectId: workspaceId,
environment,
secretPath
});
@@ -161,7 +161,7 @@ export const FolderListView = ({
};
addPendingChange(pendingFolderDelete, {
- workspaceId,
+ projectId: workspaceId,
environment,
secretPath
});
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretDropzone/SecretDropzone.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretDropzone/SecretDropzone.tsx
index d7cb87da77..eb20c5e9cc 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretDropzone/SecretDropzone.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretDropzone/SecretDropzone.tsx
@@ -53,7 +53,7 @@ type TSecOverwriteOpt = { update: TParsedEnv; create: TParsedEnv };
type Props = {
isSmaller: boolean;
environments?: { name: string; slug: string }[];
- workspaceId: string;
+ projectId: string;
environment: string;
secretPath: string;
isProtectedBranch?: boolean;
@@ -140,7 +140,7 @@ const MatrixImportModalTableRow = ({
export const SecretDropzone = ({
isSmaller,
environments = [],
- workspaceId,
+ projectId,
environment,
secretPath,
isProtectedBranch = false
@@ -196,7 +196,7 @@ export const SecretDropzone = ({
const { secrets: existingSecrets } = await fetchDashboardProjectSecretsByKeys({
secretPath,
environment,
- projectId: workspaceId,
+ projectId: projectId,
keys: envSecretKeys
});
@@ -334,7 +334,7 @@ export const SecretDropzone = ({
if (Object.keys(create || {}).length) {
await createSecretBatch({
secretPath,
- workspaceId,
+ projectId,
environment,
secrets: Object.entries(create).map(([secretKey, secData]) => ({
type: SecretType.Shared,
@@ -347,7 +347,7 @@ export const SecretDropzone = ({
if (Object.keys(update || {}).length) {
await updateSecretBatch({
secretPath,
- workspaceId,
+ projectId,
environment,
secrets: Object.entries(update).map(([secretKey, secData]) => ({
type: SecretType.Shared,
@@ -358,13 +358,13 @@ export const SecretDropzone = ({
});
}
queryClient.invalidateQueries({
- queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
+ queryKey: secretKeys.getProjectSecret({ projectId, environment, secretPath })
});
queryClient.invalidateQueries({
- queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
+ queryKey: dashboardKeys.getDashboardSecrets({ projectId: projectId, secretPath })
});
queryClient.invalidateQueries({
- queryKey: secretApprovalRequestKeys.count({ workspaceId })
+ queryKey: secretApprovalRequestKeys.count({ projectId })
});
handlePopUpClose("confirmUpload");
createNotification({
@@ -464,7 +464,7 @@ export const SecretDropzone = ({
onParsedEnv={handleParsedEnv}
environment={environment}
environments={environments}
- workspaceId={workspaceId}
+ workspaceId={projectId}
secretPath={secretPath}
isSmaller={isSmaller}
/>
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretImportListView/SecretImportItem.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretImportListView/SecretImportItem.tsx
index 44886c21f3..9fc8cc98f0 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretImportListView/SecretImportItem.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretImportListView/SecretImportItem.tsx
@@ -21,7 +21,7 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { EmptyState, IconButton, SecretInput, TableContainer, Tooltip } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useToggle } from "@app/hooks";
import { useResyncSecretReplication } from "@app/hooks/api";
import { TSecretImport } from "@app/hooks/api/types";
@@ -82,7 +82,7 @@ export const SecretImportItem = ({
lastReplicated,
importEnv
} = secretImport as TSecretImport;
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [isExpanded, setIsExpanded] = useToggle();
const { attributes, listeners, transform, transition, setNodeRef, isDragging } = useSortable({
id
@@ -118,7 +118,7 @@ export const SecretImportItem = ({
id,
environment,
path: secretPath,
- projectId: currentWorkspace?.id || ""
+ projectId: currentProject?.id || ""
});
createNotification({
text: "Please refresh the dashboard to view changes",
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretImportListView/SecretImportListView.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretImportListView/SecretImportListView.tsx
index e212d6da99..f36d167512 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretImportListView/SecretImportListView.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretImportListView/SecretImportListView.tsx
@@ -18,7 +18,7 @@ import { usePopUp } from "@app/hooks";
import { useDeleteSecretImport, useUpdateSecretImport } from "@app/hooks/api";
import { ReservedFolders } from "@app/hooks/api/secretFolders/types";
import { TSecretImport } from "@app/hooks/api/secretImports/types";
-import { SecretV3RawSanitized, WorkspaceEnv } from "@app/hooks/api/types";
+import { SecretV3RawSanitized, ProjectEnv } from "@app/hooks/api/types";
import { formatReservedPaths } from "@app/lib/fn/string";
import { SecretImportItem } from "./SecretImportItem";
@@ -26,7 +26,7 @@ import { SecretImportItem } from "./SecretImportItem";
const SECRET_IN_DASHBOARD = "Present In Dashboard";
type TImportedSecrets = Array<{
- environmentInfo: WorkspaceEnv;
+ environmentInfo: ProjectEnv;
secretPath: string;
folderId: string;
secrets: SecretV3RawSanitized[];
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/CollapsibleSecretImports.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/CollapsibleSecretImports.tsx
index 70010fe81b..a1ed019f12 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/CollapsibleSecretImports.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/CollapsibleSecretImports.tsx
@@ -4,7 +4,7 @@ import { faFileImport, faKey, faSync, faWarning } from "@fortawesome/free-solid-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Table, TBody, Td, Th, THead, Tooltip, Tr } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { UsedBySecretSyncs } from "@app/hooks/api/dashboard/types";
enum ItemType {
@@ -44,7 +44,7 @@ export const CollapsibleSecretImports: React.FC<CollapsibleSecretImportsProps> =
secretsToDelete,
onlyReferences
}) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const truncatePath = (path: string, maxLength = 24): string => {
if (path.length <= maxLength) return path;
@@ -62,7 +62,7 @@ export const CollapsibleSecretImports: React.FC<CollapsibleSecretImportsProps> =
const handlePathClick = (item: FlatItem) => {
if (item.type === ItemType.SecretSync) {
window.open(
- `/secret-manager/${currentWorkspace.id}/integrations/secret-syncs/${item.destination}/${item.id}`,
+ `/secret-manager/${currentProject.id}/integrations/secret-syncs/${item.destination}/${item.id}`,
"_blank",
"noopener,noreferrer"
);
@@ -78,7 +78,7 @@ export const CollapsibleSecretImports: React.FC<CollapsibleSecretImportsProps> =
}
const encodedPath = encodeURIComponent(pathToNavigate);
window.open(
- `/secret-manager/${currentWorkspace.id}/secrets/${item.environment.slug}?secretPath=${encodedPath}`,
+ `/secret-manager/${currentProject.id}/secrets/${item.environment.slug}?secretPath=${encodedPath}`,
"_blank"
);
};
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/CreateReminderForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/CreateReminderForm.tsx
index 78e79d3738..94e1b17973 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/CreateReminderForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/CreateReminderForm.tsx
@@ -21,7 +21,7 @@ import {
SelectItem,
TextArea
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useGetWorkspaceUsers } from "@app/hooks/api";
import { dashboardKeys } from "@app/hooks/api/dashboard/queries";
import { useCreateReminder, useDeleteReminder } from "@app/hooks/api/reminders";
@@ -52,7 +52,7 @@ interface ReminderFormProps {
isOpen: boolean;
reminderId?: string;
onOpenChange: () => void;
- workspaceId: string;
+ projectId: string;
environment: string;
secretPath: string;
secretId: string;
@@ -118,8 +118,8 @@ const useReminderForm = (reminderData?: Reminder) => {
// Custom hook for workspace members
const useWorkspaceMembers = () => {
- const { currentWorkspace } = useWorkspace();
- const { data: members = [] } = useGetWorkspaceUsers(currentWorkspace?.id);
+ const { currentProject } = useProject();
+ const { data: members = [] } = useGetWorkspaceUsers(currentProject?.id);
const memberOptions = useMemo(
(): RecipientOption[] =>
@@ -137,7 +137,7 @@ const useWorkspaceMembers = () => {
export const CreateReminderForm = ({
isOpen,
onOpenChange,
- workspaceId,
+ projectId: projectId,
environment,
secretPath,
secretId,
@@ -185,12 +185,12 @@ export const CreateReminderForm = ({
const invalidateQueries = () => {
queryClient.invalidateQueries({
queryKey: dashboardKeys.getDashboardSecrets({
- projectId: workspaceId,
+ projectId,
secretPath
})
});
queryClient.invalidateQueries({
- queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
+ queryKey: secretKeys.getProjectSecret({ projectId, environment, secretPath })
});
queryClient.invalidateQueries({
queryKey: reminderKeys.getReminder(secretId)
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
index 953176ff5b..c72ca9d764 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
@@ -56,7 +56,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
import { getProjectBaseURL } from "@app/helpers/project";
@@ -120,7 +120,7 @@ export const SecretDetailSidebar = ({
] as const);
const { permission } = useProjectPermission();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const tagFields = useFieldArray({
control,
@@ -187,7 +187,7 @@ export const SecretDetailSidebar = ({
});
const { data: secretAccessList, isPending } = useGetSecretAccessList({
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
environment,
secretPath,
secretKey
@@ -252,9 +252,9 @@ export const SecretDetailSidebar = ({
) => {
switch (actorType) {
case ActorType.USER:
- return `/projects/secret-management/${currentWorkspace.id}/members/${membershipId}`;
+ return `/projects/secret-management/${currentProject.id}/members/${membershipId}`;
case ActorType.IDENTITY:
- return `/projects/secret-management/${currentWorkspace.id}/identities/${actorId}`;
+ return `/projects/secret-management/${currentProject.id}/identities/${actorId}`;
default:
return null;
}
@@ -367,16 +367,14 @@ export const SecretDetailSidebar = ({
/>
<Tooltip
content={
- !currentWorkspace.secretSharing
+ !currentProject.secretSharing
? "This project does not allow secret sharing."
: "You don't have permission to view the secret value."
}
- isDisabled={!secret?.secretValueHidden && currentWorkspace.secretSharing}
+ isDisabled={!secret?.secretValueHidden && currentProject.secretSharing}
>
<Button
- isDisabled={
- secret?.secretValueHidden || !currentWorkspace.secretSharing
- }
+ isDisabled={secret?.secretValueHidden || !currentProject.secretSharing}
className="px-2 py-[0.43rem] font-normal"
variant="outline_bg"
leftIcon={<FontAwesomeIcon icon={faShare} />}
@@ -848,10 +846,10 @@ export const SecretDetailSidebar = ({
>
<Link
to={
- `${getProjectBaseURL(currentWorkspace.type)}/members/$membershipId` as const
+ `${getProjectBaseURL(currentProject.type)}/members/$membershipId` as const
}
params={{
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
membershipId: user.membershipId
}}
className="text-secondary/80 rounded-md border border-mineshaft-600 bg-mineshaft-700 px-1 py-0.5 text-sm hover:text-mineshaft-100"
@@ -882,10 +880,10 @@ export const SecretDetailSidebar = ({
>
<Link
to={
- `${getProjectBaseURL(currentWorkspace.type)}/identities/$identityId` as const
+ `${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const
}
params={{
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
identityId: identity.id
}}
className="text-secondary/80 rounded-md border border-mineshaft-600 bg-mineshaft-700 px-1 py-0.5 text-sm hover:text-mineshaft-100"
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
index 31cf18a65d..98b5e780c0 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
@@ -28,7 +28,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { usePopUp, useToggle } from "@app/hooks";
import { SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
@@ -112,7 +112,7 @@ export const SecretItem = memo(
"editSecret",
"reminder"
] as const);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { permission } = useProjectPermission();
const { isRotatedSecret } = secret;
const { removePendingChange } = useBatchModeActions();
@@ -122,7 +122,7 @@ export const SecretItem = memo(
const handleDeletePending = (pendingSecret: SecretV3RawSanitized) => {
removePendingChange(pendingSecret.id, "secret", {
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
environment,
secretPath
});
@@ -393,7 +393,7 @@ export const SecretItem = memo(
<Input
autoComplete="off"
isReadOnly={isReadOnly || isRotatedSecret}
- autoCapitalization={currentWorkspace?.autoCapitalization}
+ autoCapitalization={currentProject?.autoCapitalization}
variant="plain"
isDisabled={isOverridden}
placeholder={error?.message}
@@ -677,7 +677,7 @@ export const SecretItem = memo(
)}
</ProjectPermissionCan>
<IconButton
- isDisabled={secret.secretValueHidden || !currentWorkspace.secretSharing}
+ isDisabled={secret.secretValueHidden || !currentProject.secretSharing}
className="w-0 overflow-hidden p-0 group-hover:w-5"
variant="plain"
size="md"
@@ -974,7 +974,7 @@ export const SecretItem = memo(
<CreateReminderForm
isOpen={popUp.reminder.isOpen}
onOpenChange={() => handlePopUpToggle("reminder")}
- workspaceId={currentWorkspace.id}
+ projectId={currentProject.id}
environment={environment}
secretPath={secretPath}
secretId={secret?.id}
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx
index 7407e7e24e..1548edf167 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretListView.tsx
@@ -37,7 +37,7 @@ import { FontAwesomeSpriteSymbols } from "./SecretListView.utils";
type Props = {
secrets?: SecretV3RawSanitized[];
environment: string;
- workspaceId: string;
+ projectId: string;
secretPath?: string;
tags?: WsTag[];
isVisible?: boolean;
@@ -57,7 +57,7 @@ type Props = {
export const SecretListView = ({
secrets = [],
environment,
- workspaceId,
+ projectId: projectId,
secretPath = "/",
tags: wsTags = [],
isVisible,
@@ -93,7 +93,7 @@ export const SecretListView = ({
message:
"You have unsaved changes. If you leave now, your work will be lost. Do you want to continue?",
context: {
- workspaceId,
+ projectId: projectId,
environment,
secretPath
}
@@ -140,7 +140,7 @@ export const SecretListView = ({
if (operation === "delete") {
await deleteSecretV3({
environment,
- workspaceId,
+ projectId,
secretPath,
secretKey: key,
type,
@@ -161,7 +161,7 @@ export const SecretListView = ({
await updateSecretV3({
environment,
- workspaceId,
+ projectId,
secretPath,
secretKey: key,
...(!isRotatedSecret && {
@@ -183,7 +183,7 @@ export const SecretListView = ({
await createSecretV3(
{
environment,
- workspaceId,
+ projectId,
secretPath,
secretKey: key,
secretValue: value || "",
@@ -337,7 +337,7 @@ export const SecretListView = ({
};
addPendingChange(updatedCreate, {
- workspaceId,
+ projectId: projectId,
environment,
secretPath
});
@@ -369,7 +369,7 @@ export const SecretListView = ({
};
addPendingChange(updateChange, {
- workspaceId,
+ projectId: projectId,
environment,
secretPath
});
@@ -400,27 +400,39 @@ export const SecretListView = ({
}
queryClient.invalidateQueries({
queryKey: dashboardKeys.getDashboardSecrets({
- projectId: workspaceId,
+ projectId,
secretPath
})
});
queryClient.invalidateQueries({
- queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
+ queryKey: secretKeys.getProjectSecret({ projectId, environment, secretPath })
});
queryClient.invalidateQueries({
- queryKey: secretSnapshotKeys.list({ workspaceId, environment, directory: secretPath })
+ queryKey: secretSnapshotKeys.list({
+ projectId,
+ environment,
+ directory: secretPath
+ })
});
queryClient.invalidateQueries({
- queryKey: secretSnapshotKeys.count({ workspaceId, environment, directory: secretPath })
+ queryKey: secretSnapshotKeys.count({
+ projectId,
+ environment,
+ directory: secretPath
+ })
});
queryClient.invalidateQueries({
- queryKey: commitKeys.count({ projectId: workspaceId, environment, directory: secretPath })
+ queryKey: commitKeys.count({ projectId: projectId, environment, directory: secretPath })
});
queryClient.invalidateQueries({
- queryKey: commitKeys.history({ workspaceId, environment, directory: secretPath })
+ queryKey: commitKeys.history({
+ projectId,
+ environment,
+ directory: secretPath
+ })
});
queryClient.invalidateQueries({
- queryKey: secretApprovalRequestKeys.count({ workspaceId })
+ queryKey: secretApprovalRequestKeys.count({ projectId })
});
if (!isReminderEvent) {
handlePopUpClose("secretDetail");
@@ -450,7 +462,7 @@ export const SecretListView = ({
});
}
},
- [environment, secretPath, isProtectedBranch, isBatchMode, workspaceId, addPendingChange]
+ [environment, secretPath, isProtectedBranch, isBatchMode, projectId, addPendingChange]
);
const handleSecretDelete = useCallback(async () => {
@@ -467,7 +479,7 @@ export const SecretListView = ({
};
addPendingChange(deleteChange, {
- workspaceId,
+ projectId: projectId,
environment,
secretPath
});
@@ -480,25 +492,33 @@ export const SecretListView = ({
await handleSecretOperation("delete", SecretType.Shared, key, { secretId });
// wrap this in another function and then reuse
queryClient.invalidateQueries({
- queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
+ queryKey: dashboardKeys.getDashboardSecrets({ projectId: projectId, secretPath })
});
queryClient.invalidateQueries({
- queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
+ queryKey: secretKeys.getProjectSecret({ projectId, environment, secretPath })
});
queryClient.invalidateQueries({
- queryKey: secretSnapshotKeys.list({ workspaceId, environment, directory: secretPath })
+ queryKey: secretSnapshotKeys.list({
+ projectId,
+ environment,
+ directory: secretPath
+ })
});
queryClient.invalidateQueries({
- queryKey: secretSnapshotKeys.count({ workspaceId, environment, directory: secretPath })
+ queryKey: secretSnapshotKeys.count({
+ projectId,
+ environment,
+ directory: secretPath
+ })
});
queryClient.invalidateQueries({
- queryKey: commitKeys.count({ projectId: workspaceId, environment, directory: secretPath })
+ queryKey: commitKeys.count({ projectId: projectId, environment, directory: secretPath })
});
queryClient.invalidateQueries({
- queryKey: commitKeys.history({ workspaceId, environment, directory: secretPath })
+ queryKey: commitKeys.history({ projectId, environment, directory: secretPath })
});
queryClient.invalidateQueries({
- queryKey: secretApprovalRequestKeys.count({ workspaceId })
+ queryKey: secretApprovalRequestKeys.count({ projectId })
});
handlePopUpClose("deleteSecret");
handlePopUpClose("secretDetail");
@@ -521,7 +541,7 @@ export const SecretListView = ({
secretPath,
isProtectedBranch,
isBatchMode,
- workspaceId,
+ projectId,
addPendingChange
]);
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SnapshotView/SnapshotView.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SnapshotView/SnapshotView.tsx
index d286db472e..6bef2d3f6b 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SnapshotView/SnapshotView.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SnapshotView/SnapshotView.tsx
@@ -22,7 +22,7 @@ import { renderIcon, SecretItem, TDiffModes, TDiffView } from "./SecretItem";
type Props = {
snapshotId: string;
environment: string;
- workspaceId: string;
+ projectId: string;
secretPath?: string;
secrets?: SecretV3RawSanitized[];
folders?: TSecretFolder[];
@@ -43,7 +43,7 @@ const deepCompareSecrets = (lhs: SecretV3RawSanitized, rhs: SecretV3RawSanitized
export const SnapshotView = ({
snapshotId,
environment,
- workspaceId,
+ projectId,
secretPath,
secrets = [],
folders = [],
@@ -130,7 +130,7 @@ export const SnapshotView = ({
}
try {
await performRollback({
- workspaceId,
+ projectId,
snapshotId: snapshotData.id,
environment,
directory: secretPath
diff --git a/frontend/src/pages/secret-manager/SecretRotationPage/SecretRotationPage.tsx b/frontend/src/pages/secret-manager/SecretRotationPage/SecretRotationPage.tsx
index 51551999e9..c77f427ac2 100644
--- a/frontend/src/pages/secret-manager/SecretRotationPage/SecretRotationPage.tsx
+++ b/frontend/src/pages/secret-manager/SecretRotationPage/SecretRotationPage.tsx
@@ -42,7 +42,7 @@ import {
ProjectPermissionSub,
useProjectPermission,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { ProjectPermissionSecretRotationActions } from "@app/context/ProjectPermissionContext/types";
import { usePopUp } from "@app/hooks";
@@ -56,7 +56,7 @@ import { TSecretRotationProviderTemplate } from "@app/hooks/api/secretRotation/t
import { CreateRotationForm } from "@app/pages/secret-manager/SecretRotationPage/components/CreateRotationForm";
const Page = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { permission } = useProjectPermission();
const navigate = useNavigate();
@@ -68,7 +68,7 @@ const Page = () => {
"upgradePlan",
"secretRotationV2"
] as const);
- const workspaceId = currentWorkspace?.id || "";
+ const workspaceId = currentProject?.id || "";
const canCreateRotation = permission.can(
ProjectPermissionSecretRotationActions.Create,
ProjectPermissionSub.SecretRotation
@@ -173,7 +173,7 @@ const Page = () => {
<Link
className="text-mineshaft-100 underline decoration-primary underline-offset-2 hover:text-mineshaft-200"
to="/projects/secret-management/$projectId/overview"
- params={{ projectId: currentWorkspace.id }}
+ params={{ projectId: currentProject.id }}
>
Secret Manager Dashboard
</Link>{" "}
@@ -408,7 +408,7 @@ const Page = () => {
<Link
className="text-mineshaft-100 underline decoration-primary underline-offset-2 hover:text-mineshaft-200"
to="/projects/secret-management/$projectId/overview"
- params={{ projectId: currentWorkspace.id }}
+ params={{ projectId: currentProject.id }}
>
Secret Manager Dashboard
</Link>{" "}
@@ -425,7 +425,7 @@ const Page = () => {
onClick={() =>
navigate({
to: "/projects/secret-management/$projectId/overview",
- params: { projectId: currentWorkspace.id }
+ params: { projectId: currentProject.id }
})
}
colorSchema="secondary"
diff --git a/frontend/src/pages/secret-manager/SecretRotationPage/components/CreateRotationForm/steps/RotationOutputForm.tsx b/frontend/src/pages/secret-manager/SecretRotationPage/components/CreateRotationForm/steps/RotationOutputForm.tsx
index e669b88de5..31c8eceb75 100644
--- a/frontend/src/pages/secret-manager/SecretRotationPage/components/CreateRotationForm/steps/RotationOutputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretRotationPage/components/CreateRotationForm/steps/RotationOutputForm.tsx
@@ -4,7 +4,7 @@ import { z } from "zod";
import { Button, FormControl, Input, Select, SelectItem, Spinner } from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useGetProjectSecrets } from "@app/hooks/api";
const formSchema = z.object({
@@ -22,9 +22,9 @@ type Props = {
};
export const RotationOutputForm = ({ onSubmit, onCancel, outputSchema = {} }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const environments = currentWorkspace?.environments || [];
- const workspaceId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const environments = currentProject?.environments || [];
+ const projectId = currentProject?.id || "";
const {
control,
handleSubmit,
@@ -39,7 +39,7 @@ export const RotationOutputForm = ({ onSubmit, onCancel, outputSchema = {} }: Pr
const selectedSecrets = watch("secrets");
const { data: secrets, isPending: isSecretsLoading } = useGetProjectSecrets({
- workspaceId,
+ projectId,
environment,
secretPath
});
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncAuditLogsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncAuditLogsSection.tsx
index 58c00db6f6..b7f3b14359 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncAuditLogsSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncAuditLogsSection.tsx
@@ -2,7 +2,7 @@ import { faFingerprint } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Link } from "@tanstack/react-router";
-import { useSubscription, useWorkspace } from "@app/context";
+import { useSubscription, useProject } from "@app/context";
import { EventType } from "@app/hooks/api/auditLogs/enums";
import { TSecretSync } from "@app/hooks/api/secretSyncs";
import { LogsSection } from "@app/pages/organization/AuditLogsPage/components/LogsSection";
@@ -19,7 +19,7 @@ type Props = {
export const SecretSyncAuditLogsSection = ({ secretSync }: Props) => {
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const auditLogsRetentionDays = subscription?.auditLogsRetentionDays ?? 30;
@@ -37,7 +37,7 @@ export const SecretSyncAuditLogsSection = ({ secretSync }: Props) => {
<LogsSection
refetchInterval={4000}
showFilters={false}
- project={currentWorkspace}
+ project={currentProject}
presets={{
eventMetadata: { syncId: secretSync.id },
startDate: new Date(
diff --git a/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx b/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
index d864d9a444..ad037b1259 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
@@ -2,8 +2,8 @@ import { Helmet } from "react-helmet";
import { useTranslation } from "react-i18next";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
-import { ProjectVersion } from "@app/hooks/api/workspace/types";
+import { useProject } from "@app/context";
+import { ProjectVersion } from "@app/hooks/api/projects/types";
import { ProjectGeneralTab } from "@app/pages/project/SettingsPage/components/ProjectGeneralTab";
import { EncryptionTab } from "./components/EncryptionTab";
@@ -13,14 +13,14 @@ import { WorkflowIntegrationTab } from "./components/WorkflowIntegrationSection"
export const SettingsPage = () => {
const { t } = useTranslation();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const tabs = [
{ name: "General", key: "tab-project-general", Component: ProjectGeneralTab },
{ name: "Secrets Management", key: "tab-secret-general", Component: SecretSettingsTab },
{
name: "Encryption",
key: "tab-project-encryption",
- isHidden: currentWorkspace?.version !== ProjectVersion.V3,
+ isHidden: currentProject?.version !== ProjectVersion.V3,
Component: EncryptionTab
},
{
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/AutoCapitalizationSection/AutoCapitalizationSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/AutoCapitalizationSection/AutoCapitalizationSection.tsx
index 648360789b..3bc9ca0ad0 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/AutoCapitalizationSection/AutoCapitalizationSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/AutoCapitalizationSection/AutoCapitalizationSection.tsx
@@ -3,22 +3,22 @@ import { useTranslation } from "react-i18next";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Checkbox } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
-import { useToggleAutoCapitalization } from "@app/hooks/api";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
+import { useUpdateProject } from "@app/hooks/api";
export const AutoCapitalizationSection = () => {
const { t } = useTranslation();
- const { currentWorkspace } = useWorkspace();
- const { mutateAsync } = useToggleAutoCapitalization();
+ const { currentProject } = useProject();
+ const { mutateAsync } = useUpdateProject();
const handleToggleCapitalizationToggle = async (state: boolean) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
await mutateAsync({
- workspaceID: currentWorkspace.id,
- state
+ projectId: currentProject.id,
+ autoCapitalization: state
});
const text = `Successfully ${state ? "enabled" : "disabled"} auto capitalization`;
@@ -44,7 +44,7 @@ export const AutoCapitalizationSection = () => {
<Checkbox
id="autoCapitalization"
isDisabled={!isAllowed}
- isChecked={currentWorkspace?.autoCapitalization ?? false}
+ isChecked={currentProject?.autoCapitalization ?? false}
onCheckedChange={(state) => {
handleToggleCapitalizationToggle(state as boolean);
}}
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx
index 5e489ba698..1d6d8b34aa 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx
@@ -1,20 +1,20 @@
import { createNotification } from "@app/components/notifications";
import { Button } from "@app/components/v2";
-import { useProjectPermission, useWorkspace } from "@app/context";
+import { useProjectPermission, useProject } from "@app/context";
import { useBackfillSecretReference } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
export const BackfillSecretReferenceSecretion = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { membership } = useProjectPermission();
const backfillSecretReferences = useBackfillSecretReference();
- if (!currentWorkspace) return null;
+ if (!currentProject) return null;
const handleBackfill = async () => {
if (backfillSecretReferences.isPending) return;
try {
- await backfillSecretReferences.mutateAsync({ projectId: currentWorkspace.id || "" });
+ await backfillSecretReferences.mutateAsync({ projectId: currentProject.id || "" });
createNotification({ text: "Successfully re-indexed secret references", type: "success" });
} catch {
createNotification({ text: "Failed to re-index secret references", type: "error" });
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EncryptionTab/EncryptionTab.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EncryptionTab/EncryptionTab.tsx
index 68592323e7..23ae0c3f7c 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EncryptionTab/EncryptionTab.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EncryptionTab/EncryptionTab.tsx
@@ -21,7 +21,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useOrganization,
- useWorkspace
+ useProject
} from "@app/context";
import { usePopUp, useToggle } from "@app/hooks";
import {
@@ -32,7 +32,7 @@ import {
} from "@app/hooks/api";
import { fetchProjectKmsBackup } from "@app/hooks/api/kms/queries";
import { INTERNAL_KMS_KEY_ID, KmsType } from "@app/hooks/api/kms/types";
-import { Organization, Workspace } from "@app/hooks/api/types";
+import { Organization, Project } from "@app/hooks/api/types";
const formSchema = z.object({
kmsKeyId: z.string()
@@ -44,32 +44,29 @@ const BackupConfirmationModal = ({
isOpen,
onOpenChange,
org,
- workspace
+ project
}: {
isOpen: boolean;
onOpenChange: (state: boolean) => void;
org?: Organization;
- workspace?: Workspace;
+ project?: Project;
}) => {
const [isGeneratingBackup, setGeneratingBackup] = useToggle();
const downloadKmsBackup = async () => {
- if (!workspace || !org) {
+ if (!project || !org) {
return;
}
setGeneratingBackup.on();
try {
- const { secretManager } = await fetchProjectKmsBackup(workspace.id);
+ const { secretManager } = await fetchProjectKmsBackup(project.id);
const [, , kmsFunction] = secretManager.split(".");
const file = secretManager;
const blob = new Blob([file], { type: "text/plain;charset=utf-8" });
- FileSaver.saveAs(
- blob,
- `kms-backup-${org.slug}-${workspace.slug}-${kmsFunction}.infisical.txt`
- );
+ FileSaver.saveAs(blob, `kms-backup-${org.slug}-${project.slug}-${kmsFunction}.infisical.txt`);
onOpenChange(false);
} catch (err) {
@@ -110,20 +107,20 @@ const LoadBackupModal = ({
isOpen,
onOpenChange,
org,
- workspace
+ workspace: project
}: {
isOpen: boolean;
onOpenChange: (state: boolean) => void;
org?: Organization;
- workspace: Workspace;
+ workspace: Project;
}) => {
const fileUploadRef = useRef<HTMLInputElement>(null);
- const { mutateAsync: loadKmsBackup, isPending } = useLoadProjectKmsBackup(workspace.id);
+ const { mutateAsync: loadKmsBackup, isPending } = useLoadProjectKmsBackup(project.id);
const [backupContent, setBackupContent] = useState("");
const [backupFileName, setBackupFileName] = useState("");
const uploadKmsBackup = async () => {
- if (!workspace || !org) {
+ if (!project || !org) {
return;
}
@@ -222,13 +219,13 @@ const LoadBackupModal = ({
export const EncryptionTab = () => {
const { currentOrg } = useOrganization();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: externalKmsList } = useGetExternalKmsList(currentOrg.id);
- const { data: activeKms } = useGetActiveProjectKms(currentWorkspace.id);
+ const { data: activeKms } = useGetActiveProjectKms(currentProject.id);
const { mutateAsync: updateProjectKms, isPending: isUpdatingProjectKms } = useUpdateProjectKms(
- currentWorkspace.id
+ currentProject.id
);
const { popUp, handlePopUpToggle, handlePopUpOpen } = usePopUp([
"createBackupConfirmation",
@@ -336,13 +333,13 @@ export const EncryptionTab = () => {
isOpen={popUp.createBackupConfirmation.isOpen}
onOpenChange={(state: boolean) => handlePopUpToggle("createBackupConfirmation", state)}
org={currentOrg}
- workspace={currentWorkspace}
+ project={currentProject}
/>
<LoadBackupModal
isOpen={popUp.loadBackup.isOpen}
onOpenChange={(state: boolean) => handlePopUpToggle("loadBackup", state)}
org={currentOrg}
- workspace={currentWorkspace}
+ workspace={currentProject}
/>
</div>
);
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/AddEnvironmentModal.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/AddEnvironmentModal.tsx
index 0832dfe9da..611504a141 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/AddEnvironmentModal.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/AddEnvironmentModal.tsx
@@ -4,15 +4,15 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalClose, ModalContent } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateWsEnvironment } from "@app/hooks/api";
-import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
+import { ProjectEnv } from "@app/hooks/api/projects/types";
import { slugSchema } from "@app/lib/schemas";
type Props = {
isOpen: boolean;
onOpenChange: (isOpen: boolean) => void;
- onComplete?: (environment: WorkspaceEnv) => void;
+ onComplete?: (environment: ProjectEnv) => void;
};
const schema = z.object({
@@ -25,11 +25,11 @@ const schema = z.object({
export type FormData = z.infer<typeof schema>;
type ContentProps = {
- onComplete: (environment: WorkspaceEnv) => void;
+ onComplete: (environment: ProjectEnv) => void;
};
const Content = ({ onComplete }: ContentProps) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync, isPending } = useCreateWsEnvironment();
const { control, handleSubmit } = useForm<FormData>({
resolver: zodResolver(schema)
@@ -37,10 +37,10 @@ const Content = ({ onComplete }: ContentProps) => {
const onFormSubmit = async ({ environmentName, environmentSlug }: FormData) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
const env = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
name: environmentName,
slug: environmentSlug
});
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
index 34acf0c7b0..2ee03beefe 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
@@ -10,7 +10,7 @@ import {
ProjectPermissionSub,
useProjectPermission,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { useDeleteWsEnvironment } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -21,14 +21,14 @@ import { UpdateEnvironmentModal } from "./UpdateEnvironmentModal";
export const EnvironmentSection = () => {
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { permission } = useProjectPermission();
const deleteWsEnvironment = useDeleteWsEnvironment();
const isMoreEnvironmentsAllowed =
- subscription?.environmentLimit && currentWorkspace?.environments
- ? currentWorkspace.environments.length < subscription.environmentLimit
+ subscription?.environmentLimit && currentProject?.environments
+ ? currentProject.environments.length < subscription.environmentLimit
: true;
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
@@ -40,10 +40,10 @@ export const EnvironmentSection = () => {
const onEnvDeleteSubmit = async (id: string) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
await deleteWsEnvironment.mutateAsync({
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
id
});
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
index 0626db2819..c0314dee96 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
@@ -19,7 +19,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useSubscription,
- useWorkspace
+ useProject
} from "@app/context";
import { useUpdateWsEnvironment } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -40,17 +40,17 @@ type Props = {
};
export const EnvironmentTable = ({ handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { subscription } = useSubscription();
const updateEnvironment = useUpdateWsEnvironment();
const handleReorderEnv = async (id: string, position: number) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
await updateEnvironment.mutateAsync({
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
id,
position
});
@@ -69,13 +69,13 @@ export const EnvironmentTable = ({ handlePopUpOpen }: Props) => {
};
const isMoreEnvironmentsAllowed =
- subscription?.environmentLimit && currentWorkspace?.environments
- ? currentWorkspace.environments.length <= subscription.environmentLimit
+ subscription?.environmentLimit && currentProject?.environments
+ ? currentProject.environments.length <= subscription.environmentLimit
: true;
const environmentsOverPlanLimit =
- subscription?.environmentLimit && currentWorkspace?.environments
- ? Math.max(0, currentWorkspace.environments.length - subscription.environmentLimit)
+ subscription?.environmentLimit && currentProject?.environments
+ ? Math.max(0, currentProject.environments.length - subscription.environmentLimit)
: 0;
return (
@@ -89,7 +89,7 @@ export const EnvironmentTable = ({ handlePopUpOpen }: Props) => {
</Tr>
</THead>
<TBody>
- {currentWorkspace.environments.map(({ name, slug, id }, pos) => (
+ {currentProject.environments.map(({ name, slug, id }, pos) => (
<Tr key={id}>
<Td>{name}</Td>
<Td>{slug}</Td>
@@ -102,15 +102,12 @@ export const EnvironmentTable = ({ handlePopUpOpen }: Props) => {
<IconButton
className="mr-3 py-2"
onClick={() =>
- handleReorderEnv(
- id,
- Math.min(currentWorkspace.environments.length, pos + 2)
- )
+ handleReorderEnv(id, Math.min(currentProject.environments.length, pos + 2))
}
colorSchema="primary"
variant="plain"
ariaLabel="update"
- isDisabled={pos === currentWorkspace.environments.length - 1 || !isAllowed}
+ isDisabled={pos === currentProject.environments.length - 1 || !isAllowed}
>
<FontAwesomeIcon icon={faArrowDown} />
</IconButton>
@@ -183,7 +180,7 @@ export const EnvironmentTable = ({ handlePopUpOpen }: Props) => {
</Td>
</Tr>
))}
- {currentWorkspace.environments?.length === 0 && (
+ {currentProject.environments?.length === 0 && (
<Tr>
<Td colSpan={3}>
<EmptyState title="No environments found" />
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/UpdateEnvironmentModal.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/UpdateEnvironmentModal.tsx
index f40091303c..e2d64ee72f 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/UpdateEnvironmentModal.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/UpdateEnvironmentModal.tsx
@@ -4,7 +4,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useUpdateWsEnvironment } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { slugSchema } from "@app/lib/schemas";
@@ -23,7 +23,7 @@ const schema = z.object({
export type FormData = z.infer<typeof schema>;
export const UpdateEnvironmentModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync, isPending } = useUpdateWsEnvironment();
const { control, handleSubmit, reset } = useForm<FormData>({
resolver: zodResolver(schema),
@@ -34,10 +34,10 @@ export const UpdateEnvironmentModal = ({ popUp, handlePopUpClose, handlePopUpTog
const onFormSubmit = async ({ name, slug }: FormData) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
await mutateAsync({
- workspaceId: currentWorkspace.id,
+ projectId: currentProject.id,
name,
slug,
id: oldEnvId
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/PointInTimeVersionLimitSection/PointInTimeVersionLimitSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/PointInTimeVersionLimitSection/PointInTimeVersionLimitSection.tsx
index 288500d269..bc56ebde9f 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/PointInTimeVersionLimitSection/PointInTimeVersionLimitSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/PointInTimeVersionLimitSection/PointInTimeVersionLimitSection.tsx
@@ -4,9 +4,9 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input } from "@app/components/v2";
-import { useProjectPermission, useWorkspace } from "@app/context";
+import { useProjectPermission, useProject } from "@app/context";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
-import { useUpdateWorkspaceVersionLimit } from "@app/hooks/api/workspace/queries";
+import { useUpdateProject } from "@app/hooks/api";
const formSchema = z.object({
pitVersionLimit: z.coerce.number().min(1).max(100)
@@ -15,9 +15,9 @@ const formSchema = z.object({
type TForm = z.infer<typeof formSchema>;
export const PointInTimeVersionLimitSection = () => {
- const { mutateAsync: updatePitVersion } = useUpdateWorkspaceVersionLimit();
+ const { mutateAsync: updateProject } = useUpdateProject();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject, projectId } = useProject();
const { membership } = useProjectPermission();
const {
@@ -27,17 +27,17 @@ export const PointInTimeVersionLimitSection = () => {
} = useForm<TForm>({
resolver: zodResolver(formSchema),
values: {
- pitVersionLimit: currentWorkspace?.pitVersionLimit || 10
+ pitVersionLimit: currentProject?.pitVersionLimit || 10
}
});
- if (!currentWorkspace) return null;
+ if (!currentProject) return null;
const handleVersionLimitSubmit = async ({ pitVersionLimit }: TForm) => {
try {
- await updatePitVersion({
+ await updateProject({
pitVersionLimit,
- projectSlug: currentWorkspace.slug
+ projectId
});
createNotification({
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretDetectionIgnoreValuesSection/SecretDetectionIgnoreValuesSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretDetectionIgnoreValuesSection/SecretDetectionIgnoreValuesSection.tsx
index 5869aa1273..f7856f8f82 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretDetectionIgnoreValuesSection/SecretDetectionIgnoreValuesSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretDetectionIgnoreValuesSection/SecretDetectionIgnoreValuesSection.tsx
@@ -7,7 +7,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, IconButton, Input } from "@app/components/v2";
-import { useProjectPermission, useWorkspace } from "@app/context";
+import { useProjectPermission, useProject } from "@app/context";
import { useUpdateProject } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
@@ -23,7 +23,7 @@ const formSchema = z.object({
type TForm = z.infer<typeof formSchema>;
export const SecretDetectionIgnoreValuesSection = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { membership } = useProjectPermission();
const { mutateAsync: updateProject } = useUpdateProject();
@@ -45,19 +45,19 @@ export const SecretDetectionIgnoreValuesSection = () => {
});
useEffect(() => {
- const existingIgnoreValues = currentWorkspace?.secretDetectionIgnoreValues || [];
+ const existingIgnoreValues = currentProject?.secretDetectionIgnoreValues || [];
reset({
ignoreValues:
existingIgnoreValues.length > 0
? existingIgnoreValues.map((value) => ({ value }))
: [{ value: "" }] // Show one empty field by default
});
- }, [currentWorkspace?.secretDetectionIgnoreValues, reset]);
+ }, [currentProject?.secretDetectionIgnoreValues, reset]);
const handleIgnoreValuesSubmit = async ({ ignoreValues }: TForm) => {
try {
await updateProject({
- projectID: currentWorkspace.id,
+ projectId: currentProject.id,
secretDetectionIgnoreValues: ignoreValues.map((item) => item.value)
});
@@ -75,7 +75,7 @@ export const SecretDetectionIgnoreValuesSection = () => {
const isAdmin = membership.roles.includes(ProjectMembershipRole.Admin);
- if (!currentWorkspace) return null;
+ if (!currentProject) return null;
return (
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx
index 0dd145e415..83639d2041 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx
@@ -3,11 +3,11 @@ import { useState } from "react";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Checkbox } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
-import { useUpdateProject } from "@app/hooks/api/workspace/queries";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
+import { useUpdateProject } from "@app/hooks/api/projects/queries";
export const SecretSharingSection = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync: updateProject } = useUpdateProject();
const [isLoading, setIsLoading] = useState(false);
@@ -16,13 +16,13 @@ export const SecretSharingSection = () => {
setIsLoading(true);
try {
- if (!currentWorkspace?.id) {
+ if (!currentProject?.id) {
setIsLoading(false);
return;
}
await updateProject({
- projectID: currentWorkspace.id,
+ projectId: currentProject.id,
secretSharing: state
});
@@ -50,7 +50,7 @@ export const SecretSharingSection = () => {
<Checkbox
id="secretSharing"
isDisabled={!isAllowed || isLoading}
- isChecked={currentWorkspace?.secretSharing ?? true}
+ isChecked={currentProject?.secretSharing ?? true}
onCheckedChange={(state) => handleToggle(state as boolean)}
>
This feature enables your project members to securely share secrets.
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSnapshotsLegacySection/SecretSnapshotsLegacySection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSnapshotsLegacySection/SecretSnapshotsLegacySection.tsx
index 69c2bcbfda..90b866e964 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSnapshotsLegacySection/SecretSnapshotsLegacySection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSnapshotsLegacySection/SecretSnapshotsLegacySection.tsx
@@ -3,11 +3,11 @@ import { useState } from "react";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Checkbox } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
-import { useUpdateProject } from "@app/hooks/api/workspace/queries";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
+import { useUpdateProject } from "@app/hooks/api/projects/queries";
export const SecretSnapshotsLegacySection = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync: updateProject } = useUpdateProject();
const [isLoading, setIsLoading] = useState(false);
@@ -16,13 +16,13 @@ export const SecretSnapshotsLegacySection = () => {
setIsLoading(true);
try {
- if (!currentWorkspace?.id) {
+ if (!currentProject?.id) {
setIsLoading(false);
return;
}
await updateProject({
- projectID: currentWorkspace.id,
+ projectId: currentProject.id,
showSnapshotsLegacy: state
});
@@ -50,7 +50,7 @@ export const SecretSnapshotsLegacySection = () => {
<Checkbox
id="showSnapshotsLegacy"
isDisabled={!isAllowed || isLoading}
- isChecked={currentWorkspace?.showSnapshotsLegacy ?? false}
+ isChecked={currentProject?.showSnapshotsLegacy ?? false}
onCheckedChange={(state) => handleToggle(state as boolean)}
>
This feature enables your project members to view secret snapshots in the legacy
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx
index 96c667050a..1d4c8e4923 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx
@@ -4,7 +4,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalClose, ModalContent } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateWsTag } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { slugSchema } from "@app/lib/schemas";
@@ -27,7 +27,7 @@ type Props = {
};
export const AddSecretTagModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const createWsTag = useCreateWsTag();
const {
control,
@@ -40,10 +40,10 @@ export const AddSecretTagModal = ({ popUp, handlePopUpClose, handlePopUpToggle }
const onFormSubmit = async ({ slug }: FormData) => {
try {
- if (!currentWorkspace?.id) return;
+ if (!currentProject?.id) return;
await createWsTag.mutateAsync({
- workspaceID: currentWorkspace?.id,
+ projectId: currentProject?.id,
tagSlug: slug,
tagColor: ""
});
@@ -73,7 +73,7 @@ export const AddSecretTagModal = ({ popUp, handlePopUpClose, handlePopUpToggle }
}}
>
<ModalContent
- title={`Add a tag for ${currentWorkspace?.name ?? ""}`}
+ title={`Add a tag for ${currentProject?.name ?? ""}`}
subTitle="Specify your tag name, and the slug will be created automatically."
>
<form onSubmit={handleSubmit(onFormSubmit)}>
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsSection.tsx
index 26be8eb173..01b34c30f1 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsSection.tsx
@@ -8,7 +8,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useProjectPermission,
- useWorkspace
+ useProject
} from "@app/context";
import { usePopUp } from "@app/hooks";
import { useDeleteWsTag } from "@app/hooks/api";
@@ -23,7 +23,7 @@ export const SecretTagsSection = (): JSX.Element => {
"CreateSecretTag",
"deleteTagConfirmation"
] as const);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { permission } = useProjectPermission();
const deleteWsTag = useDeleteWsTag();
@@ -31,7 +31,7 @@ export const SecretTagsSection = (): JSX.Element => {
const onDeleteApproved = async () => {
try {
await deleteWsTag.mutateAsync({
- projectId: currentWorkspace?.id || "",
+ projectId: currentProject?.id || "",
tagID: (popUp?.deleteTagConfirmation?.data as DeleteModalData)?.id
});
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsTable.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsTable.tsx
index d0633eb120..15d8ef7cbd 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsTable.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsTable.tsx
@@ -24,7 +24,7 @@ import {
THead,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import {
getUserTablePreference,
PreferenceKey,
@@ -53,8 +53,8 @@ enum TagsOrderBy {
}
export const SecretTagsTable = ({ handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const { data: tags = [], isPending } = useGetWsTags(currentWorkspace?.id ?? "");
+ const { currentProject } = useProject();
+ const { data: tags = [], isPending } = useGetWsTags(currentProject?.id ?? "");
const {
search,
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/WebhooksTab.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/WebhooksTab.tsx
index ea2f39dc46..700ddd6627 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/WebhooksTab.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/WebhooksTab.tsx
@@ -18,7 +18,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { withProjectPermission } from "@app/hoc";
import { usePopUp } from "@app/hooks";
import {
@@ -35,8 +35,8 @@ export const WebhooksTab = withProjectPermission(
() => {
const { t } = useTranslation();
- const { currentWorkspace } = useWorkspace();
- const workspaceId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const workspaceId = currentProject?.id || "";
const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
"addWebhook",
"deleteWebhook"
@@ -302,7 +302,7 @@ export const WebhooksTab = withProjectPermission(
</TableContainer>
</div>
<AddWebhookForm
- environments={currentWorkspace?.environments}
+ environments={currentProject?.environments}
isOpen={popUp?.addWebhook?.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("addWebhook", isOpen)}
onCreateWebhook={handleWebhookCreate}
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/WorkflowIntegrationTab.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/WorkflowIntegrationTab.tsx
index 5b5f92bbb9..ce8a3a70c3 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/WorkflowIntegrationTab.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/WorkflowIntegrationTab.tsx
@@ -15,7 +15,7 @@ import {
THead,
Tr
} from "@app/components/v2";
-import { OrgPermissionActions, OrgPermissionSubjects, useWorkspace } from "@app/context";
+import { OrgPermissionActions, OrgPermissionSubjects, useProject } from "@app/context";
import { usePopUp } from "@app/hooks";
import {
useDeleteProjectWorkflowIntegration,
@@ -47,16 +47,16 @@ export const WorkflowIntegrationTab = () => {
"editIntegration"
] as const);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: slackConfig, isPending: isSlackConfigLoading } =
useGetWorkspaceWorkflowIntegrationConfig({
- workspaceId: currentWorkspace?.id ?? "",
+ projectId: currentProject?.id ?? "",
integration: WorkflowIntegrationPlatform.SLACK
});
const { data: microsoftTeamsConfig, isPending: isMicrosoftTeamsConfigLoading } =
useGetWorkspaceWorkflowIntegrationConfig({
- workspaceId: currentWorkspace?.id ?? "",
+ projectId: currentProject?.id ?? "",
integration: WorkflowIntegrationPlatform.MICROSOFT_TEAMS
});
@@ -66,12 +66,12 @@ export const WorkflowIntegrationTab = () => {
integrationType: WorkflowIntegrationPlatform,
integrationId: string
) => {
- if (!currentWorkspace.id) {
+ if (!currentProject.id) {
return;
}
await deleteIntegration({
- projectId: currentWorkspace?.id ?? "",
+ projectId: currentProject?.id ?? "",
integration: integrationType,
integrationId
});
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/AddWorkflowIntegrationModal.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/AddWorkflowIntegrationModal.tsx
index 8601c1c027..28a3c83d3b 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/AddWorkflowIntegrationModal.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/AddWorkflowIntegrationModal.tsx
@@ -6,7 +6,7 @@ import { AnimatePresence, motion } from "framer-motion";
import { twMerge } from "tailwind-merge";
import { Modal, ModalContent } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useGetWorkspaceWorkflowIntegrationConfig } from "@app/hooks/api";
import { WorkflowIntegrationPlatform } from "@app/hooks/api/workflowIntegrations/types";
@@ -40,14 +40,14 @@ export const AddWorkflowIntegrationModal = ({ isOpen, onToggle }: Props) => {
const [wizardStep, setWizardStep] = useState(WizardSteps.SelectPlatform);
const [selectedPlatform, setSelectedPlatform] = useState<string | null>(null);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: microsoftTeamsConfig } = useGetWorkspaceWorkflowIntegrationConfig({
- workspaceId: currentWorkspace?.id ?? "",
+ projectId: currentProject?.id ?? "",
integration: WorkflowIntegrationPlatform.MICROSOFT_TEAMS
});
const { data: slackConfig } = useGetWorkspaceWorkflowIntegrationConfig({
- workspaceId: currentWorkspace?.id ?? "",
+ projectId: currentProject?.id ?? "",
integration: WorkflowIntegrationPlatform.SLACK
});
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/MicrosoftTeamsIntegrationForm.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/MicrosoftTeamsIntegrationForm.tsx
index 2bf4bb7db7..2bfe8cece8 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/MicrosoftTeamsIntegrationForm.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/MicrosoftTeamsIntegrationForm.tsx
@@ -19,7 +19,7 @@ import {
SelectItem,
Switch
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
ProjectPermissionActions,
ProjectPermissionSub
@@ -95,13 +95,13 @@ type Props = {
};
export const MicrosoftTeamsIntegrationForm = ({ onClose }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: microsoftTeamsConfig } = useGetWorkspaceWorkflowIntegrationConfig({
- workspaceId: currentWorkspace?.id ?? "",
+ projectId: currentProject?.id ?? "",
integration: WorkflowIntegrationPlatform.MICROSOFT_TEAMS
});
const { data: microsoftTeamsIntegrations } = useGetMicrosoftTeamsIntegrations(
- currentWorkspace?.orgId
+ currentProject?.orgId
);
const { mutateAsync: updateProjectMicrosoftTeamsConfig } =
@@ -131,12 +131,12 @@ export const MicrosoftTeamsIntegrationForm = ({ onClose }: Props) => {
const handleIntegrationSave = async (data: TMicrosoftTeamsConfigForm) => {
try {
- if (!currentWorkspace) {
+ if (!currentProject) {
return;
}
await updateProjectMicrosoftTeamsConfig({
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
isAccessRequestNotificationEnabled: data.isAccessRequestNotificationEnabled,
isSecretRequestNotificationEnabled: data.isSecretRequestNotificationEnabled,
...(data.isAccessRequestNotificationEnabled && {
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/SlackIntegrationForm.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/SlackIntegrationForm.tsx
index 74c9ce55ec..26cae7f61a 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/SlackIntegrationForm.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/SlackIntegrationForm.tsx
@@ -19,7 +19,7 @@ import {
SelectItem,
Switch
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
ProjectPermissionActions,
ProjectPermissionSub
@@ -47,12 +47,12 @@ type Props = {
};
export const SlackIntegrationForm = ({ onClose }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: slackConfig } = useGetWorkspaceWorkflowIntegrationConfig({
- workspaceId: currentWorkspace?.id ?? "",
+ projectId: currentProject?.id ?? "",
integration: WorkflowIntegrationPlatform.SLACK
});
- const { data: workflowIntegrations } = useGetWorkflowIntegrations(currentWorkspace?.orgId);
+ const { data: workflowIntegrations } = useGetWorkflowIntegrations(currentProject?.orgId);
const { mutateAsync: updateProjectSlackConfig } = useUpdateProjectWorkflowIntegrationConfig();
const slackIntegrations = workflowIntegrations?.filter(
@@ -77,13 +77,13 @@ export const SlackIntegrationForm = ({ onClose }: Props) => {
const handleIntegrationSave = async (data: TSlackConfigForm) => {
try {
- if (!currentWorkspace) {
+ if (!currentProject) {
return;
}
await updateProjectSlackConfig({
...data,
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
integration: WorkflowIntegrationPlatform.SLACK,
integrationId: data.slackIntegrationId,
accessRequestChannels: data.accessRequestChannels.filter(Boolean).join(", "),
diff --git a/frontend/src/pages/secret-manager/integrations/AwsParameterStoreAuthorizePage/AwsParameterStoreAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/AwsParameterStoreAuthorizePage/AwsParameterStoreAuthorizePage.tsx
index e67e1e328a..16493ad0ff 100644
--- a/frontend/src/pages/secret-manager/integrations/AwsParameterStoreAuthorizePage/AwsParameterStoreAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/AwsParameterStoreAuthorizePage/AwsParameterStoreAuthorizePage.tsx
@@ -16,7 +16,7 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
enum AwsAuthType {
@@ -40,7 +40,7 @@ type TForm = z.infer<typeof formSchema>;
export const AWSParameterStoreAuthorizeIntegrationPage = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync } = useSaveIntegrationAccessToken();
const { control, handleSubmit, formState, watch } = useForm<TForm>({
@@ -55,7 +55,7 @@ export const AWSParameterStoreAuthorizeIntegrationPage = () => {
const handleFormSubmit = async (data: TForm) => {
try {
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "aws-parameter-store",
...(data.type === AwsAuthType.AssumeRole
? {
@@ -70,7 +70,7 @@ export const AWSParameterStoreAuthorizeIntegrationPage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/aws-parameter-store/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/AwsParameterStoreConfigurePage/AwsParamterStoreConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/AwsParameterStoreConfigurePage/AwsParamterStoreConfigurePage.tsx
index bbdd2d71ba..5b5d97f6af 100644
--- a/frontend/src/pages/secret-manager/integrations/AwsParameterStoreConfigurePage/AwsParamterStoreConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/AwsParameterStoreConfigurePage/AwsParamterStoreConfigurePage.tsx
@@ -26,7 +26,7 @@ import {
Tabs
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import { useGetIntegrationAuthById } from "@app/hooks/api/integrationAuth";
import { useGetIntegrationAuthAwsKmsKeys } from "@app/hooks/api/integrationAuth/queries";
@@ -77,7 +77,7 @@ export const AWSParameterStoreConfigurePage = () => {
from: ROUTE_PATHS.SecretManager.Integratons.AwsParameterStoreConfigurePage.id,
select: (el) => el.integrationAuthId
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: integrationAuth, isPending: isintegrationAuthLoading } = useGetIntegrationAuthById(
(integrationAuthId as string) ?? ""
@@ -97,11 +97,11 @@ export const AWSParameterStoreConfigurePage = () => {
const [kmsKeyId, setKmsKeyId] = useState("");
useEffect(() => {
- if (currentWorkspace) {
- setSelectedSourceEnvironment(currentWorkspace.environments[0].slug);
+ if (currentProject) {
+ setSelectedSourceEnvironment(currentProject.environments[0].slug);
setSelectedAWSRegion(awsRegions[0].slug);
}
- }, [currentWorkspace]);
+ }, [currentProject]);
const { data: integrationAuthAwsKmsKeys, isPending: isIntegrationAuthAwsKmsKeysLoading } =
useGetIntegrationAuthAwsKmsKeys({
@@ -158,7 +158,7 @@ export const AWSParameterStoreConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -226,7 +226,7 @@ export const AWSParameterStoreConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`flyio-environment-${sourceEnvironment.slug}`}
@@ -261,7 +261,7 @@ export const AWSParameterStoreConfigurePage = () => {
</FormControl>
<FormControl label="Path" errorText={pathErrorText} isError={pathErrorText !== ""}>
<Input
- placeholder={`/${currentWorkspace.name
+ placeholder={`/${currentProject.name
.toLowerCase()
.replace(/ /g, "-")}/${selectedSourceEnvironment}/`}
value={path}
diff --git a/frontend/src/pages/secret-manager/integrations/AwsSecretManagerAuthorizePage/AwsSecretManagerAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/AwsSecretManagerAuthorizePage/AwsSecretManagerAuthorizePage.tsx
index bdc18d8dd4..ba250587d9 100644
--- a/frontend/src/pages/secret-manager/integrations/AwsSecretManagerAuthorizePage/AwsSecretManagerAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/AwsSecretManagerAuthorizePage/AwsSecretManagerAuthorizePage.tsx
@@ -16,7 +16,7 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
enum AwsAuthType {
@@ -41,7 +41,7 @@ type TForm = z.infer<typeof formSchema>;
export const AWSSecretManagerAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { control, handleSubmit, formState, watch } = useForm<TForm>({
resolver: zodResolver(formSchema),
@@ -54,7 +54,7 @@ export const AWSSecretManagerAuthorizePage = () => {
const handleFormSubmit = async (data: TForm) => {
try {
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "aws-secret-manager",
...(data.type === AwsAuthType.AssumeRole
? {
@@ -68,7 +68,7 @@ export const AWSSecretManagerAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/aws-secret-manager/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/AwsSecretManagerConfigurePage/AwsSecretManagerConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/AwsSecretManagerConfigurePage/AwsSecretManagerConfigurePage.tsx
index bd73fc5960..6c82b7edde 100644
--- a/frontend/src/pages/secret-manager/integrations/AwsSecretManagerConfigurePage/AwsSecretManagerConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/AwsSecretManagerConfigurePage/AwsSecretManagerConfigurePage.tsx
@@ -30,7 +30,7 @@ import {
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import { useGetIntegrationAuthById } from "@app/hooks/api/integrationAuth";
import { useGetIntegrationAuthAwsKmsKeys } from "@app/hooks/api/integrationAuth/queries";
@@ -150,7 +150,7 @@ export const AwsSecretManagerConfigurePage = () => {
select: (el) => el.integrationAuthId
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: integrationAuth, isPending: isintegrationAuthLoading } = useGetIntegrationAuthById(
(integrationAuthId as string) ?? ""
);
@@ -162,11 +162,11 @@ export const AwsSecretManagerConfigurePage = () => {
});
useEffect(() => {
- if (currentWorkspace) {
- setValue("sourceEnvironment", currentWorkspace.environments[0].slug);
+ if (currentProject) {
+ setValue("sourceEnvironment", currentProject.environments[0].slug);
setValue("awsRegion", awsRegions[0].slug);
}
- }, [currentWorkspace]);
+ }, [currentProject]);
const handleButtonClick = async ({
secretName,
@@ -206,7 +206,7 @@ export const AwsSecretManagerConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -286,7 +286,7 @@ export const AwsSecretManagerConfigurePage = () => {
field.onChange(val);
}}
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
@@ -383,7 +383,7 @@ export const AwsSecretManagerConfigurePage = () => {
isError={Boolean(error)}
>
<Input
- placeholder={`${currentWorkspace.name
+ placeholder={`${currentProject.name
.toLowerCase()
.replace(/ /g, "-")}/${selectedSourceEnvironment}`}
{...field}
diff --git a/frontend/src/pages/secret-manager/integrations/AzureAppConfigurationConfigurePage/AzureAppConfigurationConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/AzureAppConfigurationConfigurePage/AzureAppConfigurationConfigurePage.tsx
index 1e107807ec..5fec15b443 100644
--- a/frontend/src/pages/secret-manager/integrations/AzureAppConfigurationConfigurePage/AzureAppConfigurationConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/AzureAppConfigurationConfigurePage/AzureAppConfigurationConfigurePage.tsx
@@ -21,11 +21,11 @@ import {
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import { useGetIntegrationAuthById } from "@app/hooks/api/integrationAuth";
import { IntegrationSyncBehavior } from "@app/hooks/api/integrations/types";
-import { useGetWorkspaceById } from "@app/hooks/api/workspace";
+import { useGetWorkspaceById } from "@app/hooks/api/projects";
import { IntegrationsListPageTabs } from "@app/types/integrations";
const schema = z.object({
@@ -84,9 +84,9 @@ export const AzureAppConfigurationConfigurePage = () => {
from: ROUTE_PATHS.SecretManager.Integratons.AzureAppConfigurationsConfigurePage.id,
select: (el) => el.integrationAuthId
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
- const { data: workspace } = useGetWorkspaceById(currentWorkspace.id);
+ const { data: workspace } = useGetWorkspaceById(currentProject.id);
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
useEffect(() => {
@@ -133,7 +133,7 @@ export const AzureAppConfigurationConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
diff --git a/frontend/src/pages/secret-manager/integrations/AzureAppConfigurationOauthCallbackPage/AzureAppConfigurationOauthCallbackPage.tsx b/frontend/src/pages/secret-manager/integrations/AzureAppConfigurationOauthCallbackPage/AzureAppConfigurationOauthCallbackPage.tsx
index d15fea903b..046fac9138 100644
--- a/frontend/src/pages/secret-manager/integrations/AzureAppConfigurationOauthCallbackPage/AzureAppConfigurationOauthCallbackPage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/AzureAppConfigurationOauthCallbackPage/AzureAppConfigurationOauthCallbackPage.tsx
@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useAuthorizeIntegration } from "@app/hooks/api";
export const AzureAppConfigurationOauthCallbackPage = () => {
@@ -12,7 +12,7 @@ export const AzureAppConfigurationOauthCallbackPage = () => {
const { code, state } = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.AzureAppConfigurationsOauthCallbackPage.id
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
useEffect(() => {
(async () => {
@@ -22,7 +22,7 @@ export const AzureAppConfigurationOauthCallbackPage = () => {
localStorage.removeItem("latestCSRFToken");
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
code: code as string,
integration: "azure-app-configuration"
});
@@ -30,7 +30,7 @@ export const AzureAppConfigurationOauthCallbackPage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/azure-app-configuration/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/AzureDevopsAuthorizePage/AzureDevopsAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/AzureDevopsAuthorizePage/AzureDevopsAuthorizePage.tsx
index 25cc9c6170..4a03c9c3ef 100644
--- a/frontend/src/pages/secret-manager/integrations/AzureDevopsAuthorizePage/AzureDevopsAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/AzureDevopsAuthorizePage/AzureDevopsAuthorizePage.tsx
@@ -5,7 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const AzureDevopsAuthorizePage = () => {
@@ -16,7 +16,7 @@ export const AzureDevopsAuthorizePage = () => {
const [devopsOrgName, setDevopsOrgName] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const handleButtonClick = async () => {
try {
@@ -31,7 +31,7 @@ export const AzureDevopsAuthorizePage = () => {
localStorage.setItem("azure-devops-org-name", devopsOrgName);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "azure-devops",
accessToken: btoa(`:${apiKey}`) // This is a base64 encoding of the API key without any username
});
@@ -41,7 +41,7 @@ export const AzureDevopsAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/azure-devops/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/AzureDevopsConfigurePage/AzureDevopsConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/AzureDevopsConfigurePage/AzureDevopsConfigurePage.tsx
index b06859e1f1..3d092fa264 100644
--- a/frontend/src/pages/secret-manager/integrations/AzureDevopsConfigurePage/AzureDevopsConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/AzureDevopsConfigurePage/AzureDevopsConfigurePage.tsx
@@ -14,13 +14,13 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
useGetIntegrationAuthById
} from "@app/hooks/api/integrationAuth";
-import { useGetWorkspaceById } from "@app/hooks/api/workspace";
+import { useGetWorkspaceById } from "@app/hooks/api/projects";
import { IntegrationsListPageTabs } from "@app/types/integrations";
export const AzureDevopsConfigurePage = () => {
@@ -31,9 +31,9 @@ export const AzureDevopsConfigurePage = () => {
from: ROUTE_PATHS.SecretManager.Integratons.AzureDevopsConfigurePage.id,
select: (el) => el.integrationAuthId
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
- const { data: workspace } = useGetWorkspaceById(currentWorkspace.id);
+ const { data: workspace } = useGetWorkspaceById(currentProject.id);
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const { data: integrationAuthApps } = useGetIntegrationAuthApps({
integrationAuthId: (integrationAuthId as string) ?? "",
@@ -82,7 +82,7 @@ export const AzureDevopsConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
diff --git a/frontend/src/pages/secret-manager/integrations/AzureKeyVaultConfigurePage/AzureKeyVaultConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/AzureKeyVaultConfigurePage/AzureKeyVaultConfigurePage.tsx
index e5ccd3dfae..91f0d54407 100644
--- a/frontend/src/pages/secret-manager/integrations/AzureKeyVaultConfigurePage/AzureKeyVaultConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/AzureKeyVaultConfigurePage/AzureKeyVaultConfigurePage.tsx
@@ -11,11 +11,11 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import { useGetIntegrationAuthById } from "@app/hooks/api/integrationAuth";
import { IntegrationSyncBehavior } from "@app/hooks/api/integrations/types";
-import { useGetWorkspaceById } from "@app/hooks/api/workspace";
+import { useGetWorkspaceById } from "@app/hooks/api/projects";
import { IntegrationsListPageTabs } from "@app/types/integrations";
const initialSyncBehaviors = [
@@ -38,9 +38,9 @@ export const AzureKeyVaultConfigurePage = () => {
from: ROUTE_PATHS.SecretManager.Integratons.AzureKeyVaultConfigurePage.id,
select: (el) => el.integrationAuthId
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
- const { data: workspace } = useGetWorkspaceById(currentWorkspace.id);
+ const { data: workspace } = useGetWorkspaceById(currentProject.id);
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
@@ -90,7 +90,7 @@ export const AzureKeyVaultConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
diff --git a/frontend/src/pages/secret-manager/integrations/AzureKeyVaultOauthCallbackPage/AzureKeyVaultOauthCallback.tsx b/frontend/src/pages/secret-manager/integrations/AzureKeyVaultOauthCallbackPage/AzureKeyVaultOauthCallback.tsx
index ef98d1cba8..90a93edcea 100644
--- a/frontend/src/pages/secret-manager/integrations/AzureKeyVaultOauthCallbackPage/AzureKeyVaultOauthCallback.tsx
+++ b/frontend/src/pages/secret-manager/integrations/AzureKeyVaultOauthCallbackPage/AzureKeyVaultOauthCallback.tsx
@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useAuthorizeIntegration } from "@app/hooks/api";
export const AzureKeyVaultOauthCallbackPage = () => {
@@ -12,7 +12,7 @@ export const AzureKeyVaultOauthCallbackPage = () => {
const { code, state } = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.AzureKeyVaultOauthCallbackPage.id
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
useEffect(() => {
(async () => {
@@ -22,7 +22,7 @@ export const AzureKeyVaultOauthCallbackPage = () => {
localStorage.removeItem("latestCSRFToken");
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
code: code as string,
integration: "azure-key-vault"
});
@@ -30,7 +30,7 @@ export const AzureKeyVaultOauthCallbackPage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/azure-key-vault/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/BitbucketConfigurePage/BitbucketConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/BitbucketConfigurePage/BitbucketConfigurePage.tsx
index 10dafdb763..022a8e8d7f 100644
--- a/frontend/src/pages/secret-manager/integrations/BitbucketConfigurePage/BitbucketConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/BitbucketConfigurePage/BitbucketConfigurePage.tsx
@@ -16,7 +16,7 @@ import {
Spinner
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
useCreateIntegration,
useGetIntegrationAuthApps,
@@ -96,7 +96,7 @@ export const BitbucketConfigurePage = () => {
from: ROUTE_PATHS.SecretManager.Integratons.BitbucketConfigurePage.id,
select: (el) => el.integrationAuthId
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: bitbucketWorkspaces, isPending: isBitbucketWorkspacesLoading } =
useGetIntegrationAuthBitbucketWorkspaces((integrationAuthId as string) ?? "");
@@ -150,7 +150,7 @@ export const BitbucketConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -171,18 +171,18 @@ export const BitbucketConfigurePage = () => {
bitbucketRepo ||
!bitbucketRepos ||
!bitbucketWorkspaces ||
- !currentWorkspace
+ !currentProject
)
return;
reset({
targetRepo: bitbucketRepos[0],
targetWorkspace: bitbucketWorkspaces[0],
- sourceEnvironment: currentWorkspace.environments[0],
+ sourceEnvironment: currentProject.environments[0],
secretPath: "/",
scope: ScopeOptions[0]
});
- }, [bitbucketWorkspaces, bitbucketRepos, currentWorkspace]);
+ }, [bitbucketWorkspaces, bitbucketRepos, currentProject]);
if (isBitbucketWorkspacesLoading || isBitbucketReposLoading)
return (
@@ -217,9 +217,9 @@ export const BitbucketConfigurePage = () => {
value={value}
getOptionLabel={(option) => option.name}
onChange={onChange}
- options={currentWorkspace?.environments}
+ options={currentProject?.environments}
placeholder="Select a project environment"
- isDisabled={!currentWorkspace?.environments.length}
+ isDisabled={!currentProject?.environments.length}
/>
</FormControl>
)}
diff --git a/frontend/src/pages/secret-manager/integrations/BitbucketOauthCallbackPage/BitbucketOauthCallbackPage.tsx b/frontend/src/pages/secret-manager/integrations/BitbucketOauthCallbackPage/BitbucketOauthCallbackPage.tsx
index 1e3d302f2e..8b23f46ab1 100644
--- a/frontend/src/pages/secret-manager/integrations/BitbucketOauthCallbackPage/BitbucketOauthCallbackPage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/BitbucketOauthCallbackPage/BitbucketOauthCallbackPage.tsx
@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useAuthorizeIntegration } from "@app/hooks/api";
export const BitbucketOauthCallbackPage = () => {
@@ -11,7 +11,7 @@ export const BitbucketOauthCallbackPage = () => {
const { code, state } = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.BitbucketOauthCallbackPage.id
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
useEffect(() => {
(async () => {
@@ -21,7 +21,7 @@ export const BitbucketOauthCallbackPage = () => {
localStorage.removeItem("latestCSRFToken");
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
code: code as string,
integration: "bitbucket"
});
@@ -29,7 +29,7 @@ export const BitbucketOauthCallbackPage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/bitbucket/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/ChecklyAuthorizePage/ChecklyAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/ChecklyAuthorizePage/ChecklyAuthorizePage.tsx
index 5dd711fc06..43521fd2e0 100644
--- a/frontend/src/pages/secret-manager/integrations/ChecklyAuthorizePage/ChecklyAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/ChecklyAuthorizePage/ChecklyAuthorizePage.tsx
@@ -5,13 +5,13 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const ChecklyAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [accessToken, setAccessToken] = useState("");
const [accessTokenErrorText, setAccessTokenErrorText] = useState("");
@@ -28,7 +28,7 @@ export const ChecklyAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "checkly",
accessToken
});
@@ -38,7 +38,7 @@ export const ChecklyAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/checkly/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/ChecklyConfigurePage/ChecklyConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/ChecklyConfigurePage/ChecklyConfigurePage.tsx
index 2e02f7cf2a..e09a1361a1 100644
--- a/frontend/src/pages/secret-manager/integrations/ChecklyConfigurePage/ChecklyConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/ChecklyConfigurePage/ChecklyConfigurePage.tsx
@@ -19,14 +19,14 @@ import {
Tabs
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
useGetIntegrationAuthById,
useGetIntegrationAuthChecklyGroups
} from "@app/hooks/api/integrationAuth";
-import { useGetWorkspaceById } from "@app/hooks/api/workspace";
+import { useGetWorkspaceById } from "@app/hooks/api/projects";
import { IntegrationsListPageTabs } from "@app/types/integrations";
enum TabSections {
@@ -42,7 +42,7 @@ export const ChecklyConfigurePage = () => {
from: ROUTE_PATHS.SecretManager.Integratons.ChecklyConfigurePage.id,
select: (el) => el.integrationAuthId
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
const [secretPath, setSecretPath] = useState("/");
@@ -53,7 +53,7 @@ export const ChecklyConfigurePage = () => {
const [isLoading, setIsLoading] = useState(false);
- const { data: workspace } = useGetWorkspaceById(currentWorkspace.id);
+ const { data: workspace } = useGetWorkspaceById(currentProject.id);
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const { data: integrationAuthApps, isPending: isIntegrationAuthAppsLoading } =
useGetIntegrationAuthApps({
@@ -115,7 +115,7 @@ export const ChecklyConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
diff --git a/frontend/src/pages/secret-manager/integrations/CircleCIAuthorizePage/CircleCIAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/CircleCIAuthorizePage/CircleCIAuthorizePage.tsx
index e64227fc37..088c22e1d1 100644
--- a/frontend/src/pages/secret-manager/integrations/CircleCIAuthorizePage/CircleCIAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/CircleCIAuthorizePage/CircleCIAuthorizePage.tsx
@@ -5,7 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const CircleCIAuthorizePage = () => {
@@ -15,7 +15,7 @@ export const CircleCIAuthorizePage = () => {
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const handleButtonClick = async () => {
try {
@@ -28,7 +28,7 @@ export const CircleCIAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "circleci",
accessToken: apiKey
});
@@ -38,7 +38,7 @@ export const CircleCIAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/circleci/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/CircleCIConfigurePage/CircleCIConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/CircleCIConfigurePage/CircleCIConfigurePage.tsx
index f03f35af8a..36777af291 100644
--- a/frontend/src/pages/secret-manager/integrations/CircleCIConfigurePage/CircleCIConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/CircleCIConfigurePage/CircleCIConfigurePage.tsx
@@ -18,7 +18,7 @@ import {
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration, useGetIntegrationAuthCircleCIOrganizations } from "@app/hooks/api";
import { CircleCiScope } from "@app/hooks/api/integrationAuth/types";
import { IntegrationsListPageTabs } from "@app/types/integrations";
@@ -45,7 +45,7 @@ type TFormData = z.infer<typeof formSchema>;
export const CircleCIConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync, isPending: isCreatingIntegration } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.CircleConfigurePage.id,
@@ -56,7 +56,7 @@ export const CircleCIConfigurePage = () => {
resolver: zodResolver(formSchema),
defaultValues: {
secretPath: "/",
- sourceEnvironment: currentWorkspace?.environments[0],
+ sourceEnvironment: currentProject?.environments[0],
scope: CircleCiScope.Project
}
});
@@ -105,7 +105,7 @@ export const CircleCIConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -179,9 +179,9 @@ export const CircleCIConfigurePage = () => {
value={value}
getOptionLabel={(option) => option.name}
onChange={onChange}
- options={currentWorkspace?.environments}
+ options={currentProject?.environments}
placeholder="Select a project environment"
- isDisabled={!currentWorkspace?.environments.length}
+ isDisabled={!currentProject?.environments.length}
/>
</FormControl>
)}
diff --git a/frontend/src/pages/secret-manager/integrations/Cloud66AuthorizePage/Cloud66AuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/Cloud66AuthorizePage/Cloud66AuthorizePage.tsx
index 8fc9dd5caa..1a464cadcd 100644
--- a/frontend/src/pages/secret-manager/integrations/Cloud66AuthorizePage/Cloud66AuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/Cloud66AuthorizePage/Cloud66AuthorizePage.tsx
@@ -2,14 +2,14 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const Cloud66AuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
@@ -26,7 +26,7 @@ export const Cloud66AuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "cloud-66",
accessToken: apiKey
});
@@ -36,7 +36,7 @@ export const Cloud66AuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/cloud-66/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/Cloud66ConfigurePage/Cloud66ConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/Cloud66ConfigurePage/Cloud66ConfigurePage.tsx
index 6de5e3bc35..68535d70e3 100644
--- a/frontend/src/pages/secret-manager/integrations/Cloud66ConfigurePage/Cloud66ConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/Cloud66ConfigurePage/Cloud66ConfigurePage.tsx
@@ -11,7 +11,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -28,7 +28,7 @@ export const Cloud66ConfigurePage = () => {
select: (el) => el.integrationAuthId
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const { data: integrationAuthApps } = useGetIntegrationAuthApps({
integrationAuthId: (integrationAuthId as string) ?? ""
@@ -40,10 +40,10 @@ export const Cloud66ConfigurePage = () => {
const [isLoading, setIsLoading] = useState(false);
useEffect(() => {
- if (currentWorkspace) {
- setSelectedSourceEnvironment(currentWorkspace.environments[0].slug);
+ if (currentProject) {
+ setSelectedSourceEnvironment(currentProject.environments[0].slug);
}
- }, [currentWorkspace]);
+ }, [currentProject]);
useEffect(() => {
if (integrationAuthApps) {
@@ -77,7 +77,7 @@ export const Cloud66ConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -98,7 +98,7 @@ export const Cloud66ConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/CloudflarePagesAuthorizePage/CloudflarePagesAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/CloudflarePagesAuthorizePage/CloudflarePagesAuthorizePage.tsx
index 16feba2836..08a00f2c63 100644
--- a/frontend/src/pages/secret-manager/integrations/CloudflarePagesAuthorizePage/CloudflarePagesAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/CloudflarePagesAuthorizePage/CloudflarePagesAuthorizePage.tsx
@@ -2,7 +2,7 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const CloudflarePagesAuthorizePage = () => {
@@ -14,7 +14,7 @@ export const CloudflarePagesAuthorizePage = () => {
const [accountIdErrorText, setAccountIdErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate();
const handleButtonClick = async () => {
@@ -30,7 +30,7 @@ export const CloudflarePagesAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "cloudflare-pages",
accessId: accountId,
accessToken: accessKey
@@ -43,7 +43,7 @@ export const CloudflarePagesAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/cloudflare-pages/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/CloudflarePagesConfigurePage/CloudflarePagesConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/CloudflarePagesConfigurePage/CloudflarePagesConfigurePage.tsx
index 1ff6e75d50..69225d9ae6 100644
--- a/frontend/src/pages/secret-manager/integrations/CloudflarePagesConfigurePage/CloudflarePagesConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/CloudflarePagesConfigurePage/CloudflarePagesConfigurePage.tsx
@@ -14,7 +14,7 @@ import {
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration, useGetWorkspaceById } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -31,7 +31,7 @@ export const CloudflarePagesConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.CloudflarePagesConfigurePage.id,
@@ -39,7 +39,7 @@ export const CloudflarePagesConfigurePage = () => {
});
const [secretPath, setSecretPath] = useState("/");
- const { data: workspace } = useGetWorkspaceById(currentWorkspace.id);
+ const { data: workspace } = useGetWorkspaceById(currentProject.id);
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const { data: integrationAuthApps } = useGetIntegrationAuthApps({
integrationAuthId: (integrationAuthId as string) ?? ""
@@ -96,7 +96,7 @@ export const CloudflarePagesConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
diff --git a/frontend/src/pages/secret-manager/integrations/CloudflareWorkersAuthorizePage/CloudflareWorkersAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/CloudflareWorkersAuthorizePage/CloudflareWorkersAuthorizePage.tsx
index e2829c76a8..dd0b16a6ba 100644
--- a/frontend/src/pages/secret-manager/integrations/CloudflareWorkersAuthorizePage/CloudflareWorkersAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/CloudflareWorkersAuthorizePage/CloudflareWorkersAuthorizePage.tsx
@@ -2,13 +2,13 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const CloudflareWorkersAuthorizePage = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync } = useSaveIntegrationAccessToken();
const [accessKey, setAccessKey] = useState("");
@@ -30,7 +30,7 @@ export const CloudflareWorkersAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "cloudflare-workers",
accessId: accountId,
accessToken: accessKey
@@ -43,7 +43,7 @@ export const CloudflareWorkersAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/cloudflare-workers/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/CloudflareWorkersConfigurePage/CloudflareWorkersConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/CloudflareWorkersConfigurePage/CloudflareWorkersConfigurePage.tsx
index bfc4b766a6..a5d28bb952 100644
--- a/frontend/src/pages/secret-manager/integrations/CloudflareWorkersConfigurePage/CloudflareWorkersConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/CloudflareWorkersConfigurePage/CloudflareWorkersConfigurePage.tsx
@@ -6,7 +6,7 @@ import { createNotification } from "@app/components/notifications";
import { Button, Card, CardTitle, FormControl, Select, SelectItem } from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -17,7 +17,7 @@ import { IntegrationsListPageTabs } from "@app/types/integrations";
export const CloudflareWorkersConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.CloudflareWorkersConfigurePage.id,
@@ -29,7 +29,7 @@ export const CloudflareWorkersConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [secretPath, setSecretPath] = useState("/");
@@ -69,7 +69,7 @@ export const CloudflareWorkersConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -107,7 +107,7 @@ export const CloudflareWorkersConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/CodefreshAuthorizePage/CodefreshAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/CodefreshAuthorizePage/CodefreshAuthorizePage.tsx
index 02e0d13780..353447fc71 100644
--- a/frontend/src/pages/secret-manager/integrations/CodefreshAuthorizePage/CodefreshAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/CodefreshAuthorizePage/CodefreshAuthorizePage.tsx
@@ -2,7 +2,7 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const CodefreshAuthorizePage = () => {
@@ -12,7 +12,7 @@ export const CodefreshAuthorizePage = () => {
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const handleButtonClick = async () => {
try {
@@ -25,7 +25,7 @@ export const CodefreshAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "codefresh",
accessToken: apiKey
});
@@ -35,7 +35,7 @@ export const CodefreshAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/codefresh/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/CodefreshConfigurePage/CodefreshConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/CodefreshConfigurePage/CodefreshConfigurePage.tsx
index e99ad4ea81..80a54b621a 100644
--- a/frontend/src/pages/secret-manager/integrations/CodefreshConfigurePage/CodefreshConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/CodefreshConfigurePage/CodefreshConfigurePage.tsx
@@ -11,7 +11,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -23,7 +23,7 @@ export const CodefreshConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.CodefreshConfigurePage.id,
select: (el) => el.integrationAuthId
@@ -35,7 +35,7 @@ export const CodefreshConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [targetApp, setTargetApp] = useState("");
const [secretPath, setSecretPath] = useState("/");
@@ -73,7 +73,7 @@ export const CodefreshConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -94,7 +94,7 @@ export const CodefreshConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/DatabricksAuthorizePage/DatabricksAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/DatabricksAuthorizePage/DatabricksAuthorizePage.tsx
index 25de9cd24f..0ba804dfcd 100644
--- a/frontend/src/pages/secret-manager/integrations/DatabricksAuthorizePage/DatabricksAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/DatabricksAuthorizePage/DatabricksAuthorizePage.tsx
@@ -5,7 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const DatabricksAuthorizePage = () => {
@@ -17,7 +17,7 @@ export const DatabricksAuthorizePage = () => {
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
const [instanceURLErrorText, setInstanceURLErrorText] = useState("");
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const handleButtonClick = async () => {
try {
@@ -33,7 +33,7 @@ export const DatabricksAuthorizePage = () => {
}
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "databricks",
url: instanceURL.replace(/\/$/, ""),
accessToken: apiKey
@@ -42,7 +42,7 @@ export const DatabricksAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/databricks/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/DatabricksConfigurePage/DatabricksConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/DatabricksConfigurePage/DatabricksConfigurePage.tsx
index 0f3d097286..a140a03396 100644
--- a/frontend/src/pages/secret-manager/integrations/DatabricksConfigurePage/DatabricksConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/DatabricksConfigurePage/DatabricksConfigurePage.tsx
@@ -20,7 +20,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -32,7 +32,7 @@ export const DatabricksConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync, isPending } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.DatabricksConfigurePage.id,
@@ -49,7 +49,7 @@ export const DatabricksConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [targetScope, setTargetScope] = useState("");
const [secretPath, setSecretPath] = useState("/");
@@ -89,7 +89,7 @@ export const DatabricksConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -143,7 +143,7 @@ export const DatabricksConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/DigitalOceanAppPlatformAuthorizePage/DigitalOceanAppPlatformAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/DigitalOceanAppPlatformAuthorizePage/DigitalOceanAppPlatformAuthorizePage.tsx
index 3910dac15e..769881971f 100644
--- a/frontend/src/pages/secret-manager/integrations/DigitalOceanAppPlatformAuthorizePage/DigitalOceanAppPlatformAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/DigitalOceanAppPlatformAuthorizePage/DigitalOceanAppPlatformAuthorizePage.tsx
@@ -2,7 +2,7 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const DigitalOceanAppPlatformAuthorizePage = () => {
@@ -12,7 +12,7 @@ export const DigitalOceanAppPlatformAuthorizePage = () => {
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const handleButtonClick = async () => {
try {
@@ -25,7 +25,7 @@ export const DigitalOceanAppPlatformAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "digital-ocean-app-platform",
accessToken: apiKey
});
@@ -35,7 +35,7 @@ export const DigitalOceanAppPlatformAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/digital-ocean-app-platform/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/DigitalOceanAppPlatformConfigurePage/DigitalOceanAppPlatformConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/DigitalOceanAppPlatformConfigurePage/DigitalOceanAppPlatformConfigurePage.tsx
index e88d98976c..2c6f083485 100644
--- a/frontend/src/pages/secret-manager/integrations/DigitalOceanAppPlatformConfigurePage/DigitalOceanAppPlatformConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/DigitalOceanAppPlatformConfigurePage/DigitalOceanAppPlatformConfigurePage.tsx
@@ -11,7 +11,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -23,7 +23,7 @@ export const DigitalOceanAppPlatformConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.DigitalOceanAppPlatformConfigurePage.id,
@@ -36,7 +36,7 @@ export const DigitalOceanAppPlatformConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [targetApp, setTargetApp] = useState("");
const [secretPath, setSecretPath] = useState("/");
@@ -74,7 +74,7 @@ export const DigitalOceanAppPlatformConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -95,7 +95,7 @@ export const DigitalOceanAppPlatformConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/FlyioAuthorizePage/FlyioAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/FlyioAuthorizePage/FlyioAuthorizePage.tsx
index 5fa42df529..a6d4075495 100644
--- a/frontend/src/pages/secret-manager/integrations/FlyioAuthorizePage/FlyioAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/FlyioAuthorizePage/FlyioAuthorizePage.tsx
@@ -8,7 +8,7 @@ import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
const schema = z.object({
@@ -19,7 +19,7 @@ type FormData = z.infer<typeof schema>;
export const FlyioAuthorizePage = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { control, handleSubmit } = useForm<FormData>({
resolver: zodResolver(schema),
@@ -37,7 +37,7 @@ export const FlyioAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "flyio",
accessToken
});
@@ -46,7 +46,7 @@ export const FlyioAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/flyio/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/FlyioConfigurePage/FlyioConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/FlyioConfigurePage/FlyioConfigurePage.tsx
index 0beb61bdf4..c034ce3f11 100644
--- a/frontend/src/pages/secret-manager/integrations/FlyioConfigurePage/FlyioConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/FlyioConfigurePage/FlyioConfigurePage.tsx
@@ -21,7 +21,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -34,7 +34,7 @@ export const FlyioConfigurePage = () => {
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.FlyioConfigurePage.id,
@@ -50,7 +50,7 @@ export const FlyioConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [secretPath, setSecretPath] = useState("/");
@@ -88,7 +88,7 @@ export const FlyioConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -144,7 +144,7 @@ export const FlyioConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/GcpSecretManagerAuthorizePage/GcpSecretManagerAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/GcpSecretManagerAuthorizePage/GcpSecretManagerAuthorizePage.tsx
index 044be41c94..1d47db0e12 100644
--- a/frontend/src/pages/secret-manager/integrations/GcpSecretManagerAuthorizePage/GcpSecretManagerAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/GcpSecretManagerAuthorizePage/GcpSecretManagerAuthorizePage.tsx
@@ -11,7 +11,7 @@ import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
import { Button, Card, CardTitle, FormControl, TextArea } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { localStorageService } from "@app/helpers/localStorage";
import { useGetCloudIntegrations, useSaveIntegrationAccessToken } from "@app/hooks/api";
@@ -31,7 +31,7 @@ export const GcpSecretManagerAuthorizePage = () => {
});
const { data: cloudIntegrations } = useGetCloudIntegrations();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync } = useSaveIntegrationAccessToken();
@@ -47,7 +47,7 @@ export const GcpSecretManagerAuthorizePage = () => {
const state = crypto.randomBytes(16).toString("hex");
localStorage.setItem("latestCSRFToken", state);
- localStorageService.setIntegrationProjectId(currentWorkspace.id);
+ localStorageService.setIntegrationProjectId(currentProject.id);
if (!integrationOption.clientId) {
createIntegrationMissingEnvVarsNotification(integrationOption.slug);
@@ -63,7 +63,7 @@ export const GcpSecretManagerAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "gcp-secret-manager",
refreshToken: accessToken
});
@@ -72,7 +72,7 @@ export const GcpSecretManagerAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/gcp-secret-manager/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/GcpSecretManagerConfigurePage/GcpSecretManagerConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/GcpSecretManagerConfigurePage/GcpSecretManagerConfigurePage.tsx
index c4f8403bdd..85af1961f1 100644
--- a/frontend/src/pages/secret-manager/integrations/GcpSecretManagerConfigurePage/GcpSecretManagerConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/GcpSecretManagerConfigurePage/GcpSecretManagerConfigurePage.tsx
@@ -26,7 +26,7 @@ import {
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { usePopUp } from "@app/hooks";
import { useCreateIntegration } from "@app/hooks/api";
import {
@@ -59,7 +59,7 @@ export const GcpSecretManagerConfigurePage = () => {
"confirmIntegration"
] as const);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { control, handleSubmit, setValue, watch } = useForm<FormData>({
resolver: zodResolver(schema),
defaultValues: {
@@ -69,7 +69,7 @@ export const GcpSecretManagerConfigurePage = () => {
shouldLabel: false,
labelName: "managed-by",
labelValue: "infisical",
- selectedSourceEnvironment: currentWorkspace.environments[0].slug
+ selectedSourceEnvironment: currentProject.environments[0].slug
}
});
@@ -153,7 +153,7 @@ export const GcpSecretManagerConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -241,7 +241,7 @@ export const GcpSecretManagerConfigurePage = () => {
onValueChange={(e) => onChange(e)}
className="w-full"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/GcpSecretManagerOauthCallbackPage/GcpSecretManagerOauthCallbackPage.tsx b/frontend/src/pages/secret-manager/integrations/GcpSecretManagerOauthCallbackPage/GcpSecretManagerOauthCallbackPage.tsx
index 67cb0fac59..8e8fd5b0c0 100644
--- a/frontend/src/pages/secret-manager/integrations/GcpSecretManagerOauthCallbackPage/GcpSecretManagerOauthCallbackPage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/GcpSecretManagerOauthCallbackPage/GcpSecretManagerOauthCallbackPage.tsx
@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useAuthorizeIntegration } from "@app/hooks/api";
export const GcpSecretManagerOauthCallbackPage = () => {
@@ -12,7 +12,7 @@ export const GcpSecretManagerOauthCallbackPage = () => {
const { code, state } = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.GcpSecretManagerOauthCallbackPage.id
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
useEffect(() => {
(async () => {
@@ -22,7 +22,7 @@ export const GcpSecretManagerOauthCallbackPage = () => {
if (state !== localStorage.getItem("latestCSRFToken")) return;
localStorage.removeItem("latestCSRFToken");
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
code: code as string,
integration: "gcp-secret-manager"
});
@@ -30,7 +30,7 @@ export const GcpSecretManagerOauthCallbackPage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/gcp-secret-manager/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/GithubAuthorizePage/GithubAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/GithubAuthorizePage/GithubAuthorizePage.tsx
index 623c5762cf..e4fe73feb8 100644
--- a/frontend/src/pages/secret-manager/integrations/GithubAuthorizePage/GithubAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/GithubAuthorizePage/GithubAuthorizePage.tsx
@@ -15,7 +15,7 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { localStorageService } from "@app/helpers/localStorage";
import { useGetCloudIntegrations } from "@app/hooks/api";
@@ -31,7 +31,7 @@ export const GithubAuthorizePage = () => {
const { data: cloudIntegrations } = useGetCloudIntegrations();
const githubIntegration = cloudIntegrations?.find((integration) => integration.slug === "github");
const [selectedAuthMethod, setSelectedAuthMethod] = useState<AuthMethod>(AuthMethod.APP);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
return (
<div className="flex h-full w-full items-center justify-center">
@@ -84,7 +84,7 @@ export const GithubAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/select-integration-auth",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationSlug: "github"
@@ -102,7 +102,7 @@ export const GithubAuthorizePage = () => {
const state = crypto.randomBytes(16).toString("hex");
localStorage.setItem("latestCSRFToken", state);
- localStorageService.setIntegrationProjectId(currentWorkspace.id);
+ localStorageService.setIntegrationProjectId(currentProject.id);
window.location.assign(
`https://github.com/login/oauth/authorize?client_id=${githubIntegration?.clientId}&response_type=code&scope=repo,admin:org&redirect_uri=${window.location.origin}/integrations/github/oauth2/callback&state=${state}`
);
diff --git a/frontend/src/pages/secret-manager/integrations/GithubConfigurePage/GithubConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/GithubConfigurePage/GithubConfigurePage.tsx
index aa71c793e5..7dad0d29a7 100644
--- a/frontend/src/pages/secret-manager/integrations/GithubConfigurePage/GithubConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/GithubConfigurePage/GithubConfigurePage.tsx
@@ -37,7 +37,7 @@ import {
Tabs
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
useCreateIntegration,
useGetIntegrationAuthApps,
@@ -142,7 +142,7 @@ export const GithubConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.GithubConfigurePage.id,
select: (el) => el.integrationAuthId
@@ -166,7 +166,7 @@ export const GithubConfigurePage = () => {
repoIds: [],
visibility: "all",
shouldEnableDelete: false,
- selectedSourceEnvironment: currentWorkspace.environments[0].slug
+ selectedSourceEnvironment: currentProject.environments[0].slug
}
});
@@ -269,7 +269,7 @@ export const GithubConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -367,7 +367,7 @@ export const GithubConfigurePage = () => {
onValueChange={onChange}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/GithubOauthCallbackPage/GithubOauthCallbackPage.tsx b/frontend/src/pages/secret-manager/integrations/GithubOauthCallbackPage/GithubOauthCallbackPage.tsx
index 66520e7f5a..2855539cfe 100644
--- a/frontend/src/pages/secret-manager/integrations/GithubOauthCallbackPage/GithubOauthCallbackPage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/GithubOauthCallbackPage/GithubOauthCallbackPage.tsx
@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useAuthorizeIntegration } from "@app/hooks/api";
export const GithubOauthCallbackPage = () => {
@@ -16,7 +16,7 @@ export const GithubOauthCallbackPage = () => {
} = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.GithubOauthCallbackPage.id
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
useEffect(() => {
(async () => {
@@ -29,7 +29,7 @@ export const GithubOauthCallbackPage = () => {
localStorage.removeItem("latestCSRFToken");
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
code: code as string,
installationId,
integration: "github"
@@ -38,7 +38,7 @@ export const GithubOauthCallbackPage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/github/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/GitlabAuthorizePage/GitlabAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/GitlabAuthorizePage/GitlabAuthorizePage.tsx
index 2ce82d97cb..cf77aa3120 100644
--- a/frontend/src/pages/secret-manager/integrations/GitlabAuthorizePage/GitlabAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/GitlabAuthorizePage/GitlabAuthorizePage.tsx
@@ -8,7 +8,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { localStorageService } from "@app/helpers/localStorage";
import { useGetCloudIntegrations } from "@app/hooks/api";
@@ -29,7 +29,7 @@ export const GitlabAuthorizePage = () => {
});
const { data: cloudIntegrations } = useGetCloudIntegrations();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const onFormSubmit = ({ gitLabURL }: FormData) => {
if (!cloudIntegrations) return;
@@ -49,12 +49,12 @@ export const GitlabAuthorizePage = () => {
const csrfToken = crypto.randomBytes(16).toString("hex");
localStorage.setItem("latestCSRFToken", csrfToken);
- localStorageService.setIntegrationProjectId(currentWorkspace.id);
+ localStorageService.setIntegrationProjectId(currentProject.id);
const state = `${csrfToken}|${
(gitLabURL as string).trim() === "" ? "" : (gitLabURL as string).trim()
}`;
- localStorageService.setIntegrationProjectId(currentWorkspace.id);
+ localStorageService.setIntegrationProjectId(currentProject.id);
const link = `${baseURL}/oauth/authorize?client_id=${integrationOption.clientId}&redirect_uri=${window.location.origin}/integrations/gitlab/oauth2/callback&response_type=code&state=${state}`;
window.location.assign(link);
diff --git a/frontend/src/pages/secret-manager/integrations/GitlabConfigurePage/GitlabConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/GitlabConfigurePage/GitlabConfigurePage.tsx
index 6fb388b715..13d2081ad6 100644
--- a/frontend/src/pages/secret-manager/integrations/GitlabConfigurePage/GitlabConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/GitlabConfigurePage/GitlabConfigurePage.tsx
@@ -26,7 +26,7 @@ import {
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { usePopUp } from "@app/hooks";
import { useCreateIntegration } from "@app/hooks/api";
import {
@@ -76,7 +76,7 @@ export const GitlabConfigurePage = () => {
const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
"confirmIntegration"
] as const);
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { control, handleSubmit, setValue, watch } = useForm<FormData>({
resolver: zodResolver(schema),
@@ -85,7 +85,7 @@ export const GitlabConfigurePage = () => {
secretPath: "/",
secretPrefix: "",
secretSuffix: "",
- selectedSourceEnvironment: currentWorkspace.environments[0].slug,
+ selectedSourceEnvironment: currentProject.environments[0].slug,
initialSyncBehavior: IntegrationSyncBehavior.PREFER_SOURCE
}
});
@@ -177,7 +177,7 @@ export const GitlabConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -267,7 +267,7 @@ export const GitlabConfigurePage = () => {
onValueChange={(e) => onChange(e)}
className="w-full"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/GitlabOauthCallbackPage/GitlabOauthCallbackPage.tsx b/frontend/src/pages/secret-manager/integrations/GitlabOauthCallbackPage/GitlabOauthCallbackPage.tsx
index c53cfd628c..e312f04384 100644
--- a/frontend/src/pages/secret-manager/integrations/GitlabOauthCallbackPage/GitlabOauthCallbackPage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/GitlabOauthCallbackPage/GitlabOauthCallbackPage.tsx
@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateAppConnection, useUpdateAppConnection } from "@app/hooks/api/appConnections";
import { GitLabConnectionMethod } from "@app/hooks/api/appConnections/types/gitlab-connection";
@@ -14,7 +14,7 @@ export const GitLabOAuthCallbackPage = () => {
const { code, state } = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.GitlabOauthCallbackPage.id
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
useEffect(() => {
(async () => {
@@ -65,7 +65,7 @@ export const GitLabOAuthCallbackPage = () => {
});
} else {
appConnection = await createAppConnection({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
...connectionData
});
}
@@ -87,7 +87,7 @@ export const GitLabOAuthCallbackPage = () => {
});
}
})();
- }, [code, state, navigate, createAppConnection, updateAppConnection, currentWorkspace.id]);
+ }, [code, state, navigate, createAppConnection, updateAppConnection, currentProject.id]);
return (
<div className="flex h-screen items-center justify-center">
diff --git a/frontend/src/pages/secret-manager/integrations/HashicorpVaultAuthorizePage/HashicorpVaultAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/HashicorpVaultAuthorizePage/HashicorpVaultAuthorizePage.tsx
index ae200968a0..8a8cbbc4c2 100644
--- a/frontend/src/pages/secret-manager/integrations/HashicorpVaultAuthorizePage/HashicorpVaultAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/HashicorpVaultAuthorizePage/HashicorpVaultAuthorizePage.tsx
@@ -9,7 +9,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, Card, CardBody, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
const formSchema = z.object({
@@ -25,7 +25,7 @@ export const HashicorpVaultAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const {
control,
handleSubmit,
@@ -43,7 +43,7 @@ export const HashicorpVaultAuthorizePage = () => {
const handleFormSubmit = async (formData: TForm) => {
try {
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "hashicorp-vault",
accessId: formData.vaultRoleID,
accessToken: formData.vaultSecretID,
@@ -53,7 +53,7 @@ export const HashicorpVaultAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/hashicorp-vault/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/HashicorpVaultConfigurePage/HashicorpVaultConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/HashicorpVaultConfigurePage/HashicorpVaultConfigurePage.tsx
index af9af585e8..48b31dd80d 100644
--- a/frontend/src/pages/secret-manager/integrations/HashicorpVaultConfigurePage/HashicorpVaultConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/HashicorpVaultConfigurePage/HashicorpVaultConfigurePage.tsx
@@ -25,7 +25,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { isValidPath } from "@app/helpers/string";
import { useCreateIntegration } from "@app/hooks/api";
import { useGetIntegrationAuthById } from "@app/hooks/api/integrationAuth";
@@ -61,7 +61,7 @@ export const HashicorpVaultConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.HashicorpVaultConfigurePage.id,
select: (el) => el.integrationAuthId
@@ -72,8 +72,8 @@ export const HashicorpVaultConfigurePage = () => {
);
const formSchema = useMemo(() => {
- return generateFormSchema(currentWorkspace?.environments.map((env) => env.slug) ?? []);
- }, [currentWorkspace?.environments]);
+ return generateFormSchema(currentProject?.environments.map((env) => env.slug) ?? []);
+ }, [currentProject?.environments]);
const {
control,
@@ -103,7 +103,7 @@ export const HashicorpVaultConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -177,7 +177,7 @@ export const HashicorpVaultConfigurePage = () => {
onValueChange={field.onChange}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`vault-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/HasuraCloudAuthorizePage/HasuraCloudAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/HasuraCloudAuthorizePage/HasuraCloudAuthorizePage.tsx
index 8c29a0c698..e079665620 100644
--- a/frontend/src/pages/secret-manager/integrations/HasuraCloudAuthorizePage/HasuraCloudAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/HasuraCloudAuthorizePage/HasuraCloudAuthorizePage.tsx
@@ -8,7 +8,7 @@ import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
const schema = z.object({
@@ -23,7 +23,7 @@ export const HasuraCloudAuthorizePage = () => {
const [isLoading, setIsLoading] = useState(false);
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { control, handleSubmit } = useForm<FormData>({
resolver: zodResolver(schema),
defaultValues: {
@@ -36,7 +36,7 @@ export const HasuraCloudAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "hasura-cloud",
accessToken
});
@@ -45,7 +45,7 @@ export const HasuraCloudAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/hasura-cloud/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/HasuraCloudConfigurePage/HasuraCloudConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/HasuraCloudConfigurePage/HasuraCloudConfigurePage.tsx
index a42451e8ec..cfcba8058c 100644
--- a/frontend/src/pages/secret-manager/integrations/HasuraCloudConfigurePage/HasuraCloudConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/HasuraCloudConfigurePage/HasuraCloudConfigurePage.tsx
@@ -9,7 +9,7 @@ import { z } from "zod";
import { Button, Card, CardTitle, FormControl, Select, SelectItem } from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -38,7 +38,7 @@ export const HasuraCloudConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.HasuraCloudConfigurePage.id,
select: (el) => el.integrationAuthId
@@ -72,7 +72,7 @@ export const HasuraCloudConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -137,7 +137,7 @@ export const HasuraCloudConfigurePage = () => {
field.onChange(val);
}}
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/HerokuConfigurePage/HerokuConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/HerokuConfigurePage/HerokuConfigurePage.tsx
index c36961ffad..6d00ce873e 100644
--- a/frontend/src/pages/secret-manager/integrations/HerokuConfigurePage/HerokuConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/HerokuConfigurePage/HerokuConfigurePage.tsx
@@ -10,7 +10,7 @@ import { z } from "zod";
import { Button, Card, CardTitle, FormControl, Select, SelectItem } from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
// import { RadioGroup } from "@app/components/v2/RadioGroup";
import { useCreateIntegration } from "@app/hooks/api";
import {
@@ -41,13 +41,13 @@ type FormData = z.infer<typeof schema>;
export const HerokuConfigurePage = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { control, handleSubmit, setValue, watch } = useForm<FormData>({
resolver: zodResolver(schema),
defaultValues: {
secretPath: "/",
initialSyncBehavior: IntegrationSyncBehavior.PREFER_SOURCE,
- selectedSourceEnvironment: currentWorkspace.environments[0].slug
+ selectedSourceEnvironment: currentProject.environments[0].slug
}
});
@@ -100,7 +100,7 @@ export const HerokuConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -158,7 +158,7 @@ export const HerokuConfigurePage = () => {
onValueChange={(e) => onChange(e)}
className="w-full"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/HerokuOauthCallbackPage/HerokuOauthCallbackPage.tsx b/frontend/src/pages/secret-manager/integrations/HerokuOauthCallbackPage/HerokuOauthCallbackPage.tsx
index 226f84cc75..91e2b9d88b 100644
--- a/frontend/src/pages/secret-manager/integrations/HerokuOauthCallbackPage/HerokuOauthCallbackPage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/HerokuOauthCallbackPage/HerokuOauthCallbackPage.tsx
@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateAppConnection, useUpdateAppConnection } from "@app/hooks/api/appConnections";
import { HerokuConnectionMethod } from "@app/hooks/api/appConnections/types/heroku-connection";
@@ -15,7 +15,7 @@ export const HerokuOAuthCallbackPage = () => {
from: ROUTE_PATHS.SecretManager.Integratons.HerokuOauthCallbackPage.id
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
useEffect(() => {
(async () => {
@@ -67,7 +67,7 @@ export const HerokuOAuthCallbackPage = () => {
});
} else {
appConnection = await createAppConnection({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
...connectionData
});
}
@@ -88,7 +88,7 @@ export const HerokuOAuthCallbackPage = () => {
});
}
})();
- }, [code, state, navigate, createAppConnection, updateAppConnection, currentWorkspace.id]);
+ }, [code, state, navigate, createAppConnection, updateAppConnection, currentProject.id]);
return (
<div className="flex h-screen items-center justify-center">
diff --git a/frontend/src/pages/secret-manager/integrations/LaravelForgeAuthorizePage/LaravelForgeAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/LaravelForgeAuthorizePage/LaravelForgeAuthorizePage.tsx
index d67a6ce1da..c607472c7c 100644
--- a/frontend/src/pages/secret-manager/integrations/LaravelForgeAuthorizePage/LaravelForgeAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/LaravelForgeAuthorizePage/LaravelForgeAuthorizePage.tsx
@@ -2,13 +2,13 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const LaravelForgeAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
const [serverId, setServerId] = useState("");
@@ -33,7 +33,7 @@ export const LaravelForgeAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "laravel-forge",
accessId: serverId,
accessToken: apiKey
@@ -44,7 +44,7 @@ export const LaravelForgeAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/laravel-forge/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/LaravelForgeConfigurePage/LaravelForgeConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/LaravelForgeConfigurePage/LaravelForgeConfigurePage.tsx
index 91963e7492..55a5ac3602 100644
--- a/frontend/src/pages/secret-manager/integrations/LaravelForgeConfigurePage/LaravelForgeConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/LaravelForgeConfigurePage/LaravelForgeConfigurePage.tsx
@@ -11,7 +11,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -23,7 +23,7 @@ export const LaravelForgeConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.LaravelForgeConfigurePage.id,
select: (el) => el.integrationAuthId
@@ -35,7 +35,7 @@ export const LaravelForgeConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [targetApp, setTargetApp] = useState("");
const [secretPath, setSecretPath] = useState("/");
@@ -74,7 +74,7 @@ export const LaravelForgeConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -95,7 +95,7 @@ export const LaravelForgeConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/NetlifyConfigurePage/NetlifyConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/NetlifyConfigurePage/NetlifyConfigurePage.tsx
index 7450b5cf0a..40ecc3bc54 100644
--- a/frontend/src/pages/secret-manager/integrations/NetlifyConfigurePage/NetlifyConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/NetlifyConfigurePage/NetlifyConfigurePage.tsx
@@ -11,7 +11,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -30,7 +30,7 @@ export const NetlifyConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.NetlifyConfigurePage.id,
select: (el) => el.integrationAuthId
@@ -42,7 +42,7 @@ export const NetlifyConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [targetApp, setTargetApp] = useState("");
const [targetEnvironment, setTargetEnvironment] = useState(netlifyEnvironments[0].slug);
@@ -81,7 +81,7 @@ export const NetlifyConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -106,7 +106,7 @@ export const NetlifyConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/NetlifyOauthCallbackPage/NetlifyOauthCallbackPage.tsx b/frontend/src/pages/secret-manager/integrations/NetlifyOauthCallbackPage/NetlifyOauthCallbackPage.tsx
index 330984622e..a89318f4f3 100644
--- a/frontend/src/pages/secret-manager/integrations/NetlifyOauthCallbackPage/NetlifyOauthCallbackPage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/NetlifyOauthCallbackPage/NetlifyOauthCallbackPage.tsx
@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useAuthorizeIntegration } from "@app/hooks/api";
export const NetlifyOauthCallbackPage = () => {
@@ -12,7 +12,7 @@ export const NetlifyOauthCallbackPage = () => {
const { code, state } = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.NetlifyOuathCallbackPage.id
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
useEffect(() => {
(async () => {
@@ -22,7 +22,7 @@ export const NetlifyOauthCallbackPage = () => {
localStorage.removeItem("latestCSRFToken");
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
code: code as string,
integration: "netlify"
});
@@ -30,7 +30,7 @@ export const NetlifyOauthCallbackPage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/netlify/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/NorthflankAuthorizePage/NorthflankAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/NorthflankAuthorizePage/NorthflankAuthorizePage.tsx
index b203a02dca..005a4914e9 100644
--- a/frontend/src/pages/secret-manager/integrations/NorthflankAuthorizePage/NorthflankAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/NorthflankAuthorizePage/NorthflankAuthorizePage.tsx
@@ -2,13 +2,13 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const NorthflankAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
@@ -25,7 +25,7 @@ export const NorthflankAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "northflank",
accessToken: apiKey
});
@@ -35,7 +35,7 @@ export const NorthflankAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/northflank/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/NorthflankConfigurePage/NorthflankConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/NorthflankConfigurePage/NorthflankConfigurePage.tsx
index 7f01c32ee9..9ff1e18c8c 100644
--- a/frontend/src/pages/secret-manager/integrations/NorthflankConfigurePage/NorthflankConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/NorthflankConfigurePage/NorthflankConfigurePage.tsx
@@ -11,7 +11,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -24,9 +24,9 @@ export const NorthflankConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [secretPath, setSecretPath] = useState("/");
const [targetAppId, setTargetAppId] = useState("");
@@ -95,7 +95,7 @@ export const NorthflankConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -116,7 +116,7 @@ export const NorthflankConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/OctopusDeployAuthorizePage/OctopusDeployAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/OctopusDeployAuthorizePage/OctopusDeployAuthorizePage.tsx
index 789ea3c49c..b1998cfa4b 100644
--- a/frontend/src/pages/secret-manager/integrations/OctopusDeployAuthorizePage/OctopusDeployAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/OctopusDeployAuthorizePage/OctopusDeployAuthorizePage.tsx
@@ -8,7 +8,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { removeTrailingSlash } from "@app/helpers/string";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
@@ -22,7 +22,7 @@ type TForm = z.infer<typeof formSchema>;
export const OctopusDeployAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync, isPending } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { control, handleSubmit } = useForm<TForm>({
resolver: zodResolver(formSchema)
@@ -31,7 +31,7 @@ export const OctopusDeployAuthorizePage = () => {
const onSubmit = async ({ instanceUrl, apiKey }: TForm) => {
try {
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "octopus-deploy",
url: removeTrailingSlash(instanceUrl),
accessToken: apiKey
@@ -40,7 +40,7 @@ export const OctopusDeployAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/octopus-deploy/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/OctopusDeployConfigurePage/OctopusDeployConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/OctopusDeployConfigurePage/OctopusDeployConfigurePage.tsx
index 458c4a997e..bddd884f4f 100644
--- a/frontend/src/pages/secret-manager/integrations/OctopusDeployConfigurePage/OctopusDeployConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/OctopusDeployConfigurePage/OctopusDeployConfigurePage.tsx
@@ -16,7 +16,7 @@ import {
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration, useGetIntegrationAuthApps } from "@app/hooks/api";
import {
useGetIntegrationAuthOctopusDeployScopeValues,
@@ -56,7 +56,7 @@ export const OctopusDeployConfigurePage = () => {
}
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.OctopusDeployCloudConfigurePage.id,
select: (el) => el.integrationAuthId
@@ -137,7 +137,7 @@ export const OctopusDeployConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -153,16 +153,16 @@ export const OctopusDeployConfigurePage = () => {
};
useEffect(() => {
- if (!octopusDeployResources || !octopusDeploySpaces || !currentWorkspace) return;
+ if (!octopusDeployResources || !octopusDeploySpaces || !currentProject) return;
reset({
targetResource: octopusDeployResources[0],
targetSpace: octopusDeploySpaces.find((space) => space.IsDefault),
- sourceEnvironment: currentWorkspace.environments[0],
+ sourceEnvironment: currentProject.environments[0],
secretPath: "/",
scope: OctopusDeployScope.Project
});
- }, [octopusDeploySpaces, octopusDeployResources, currentWorkspace]);
+ }, [octopusDeploySpaces, octopusDeployResources, currentProject]);
if (isLoadingOctopusDeploySpaces || isOctopusDeployResourcesLoading)
return (
@@ -196,9 +196,9 @@ export const OctopusDeployConfigurePage = () => {
value={value}
getOptionLabel={(option) => option.name}
onChange={onChange}
- options={currentWorkspace?.environments}
+ options={currentProject?.environments}
placeholder="Select a project environment"
- isDisabled={!currentWorkspace?.environments.length}
+ isDisabled={!currentProject?.environments.length}
/>
</FormControl>
)}
diff --git a/frontend/src/pages/secret-manager/integrations/QoveryAuthorizePage/QoveryAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/QoveryAuthorizePage/QoveryAuthorizePage.tsx
index 607b1962b6..369046df92 100644
--- a/frontend/src/pages/secret-manager/integrations/QoveryAuthorizePage/QoveryAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/QoveryAuthorizePage/QoveryAuthorizePage.tsx
@@ -5,12 +5,12 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const QoveryAuthorizePage = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync } = useSaveIntegrationAccessToken();
const [accessToken, setAccessToken] = useState("");
@@ -28,7 +28,7 @@ export const QoveryAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "qovery",
accessToken
});
@@ -38,7 +38,7 @@ export const QoveryAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/qovery/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/QoveryConfigurePage/QoveryConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/QoveryConfigurePage/QoveryConfigurePage.tsx
index bc0f24c900..977f4fdd10 100644
--- a/frontend/src/pages/secret-manager/integrations/QoveryConfigurePage/QoveryConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/QoveryConfigurePage/QoveryConfigurePage.tsx
@@ -19,7 +19,7 @@ import {
Tabs
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import { useGetIntegrationAuthById } from "@app/hooks/api/integrationAuth";
import {
@@ -55,7 +55,7 @@ enum TabSections {
export const QoveryConfigurePage = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync } = useCreateIntegration();
const integrationAuthId = useSearch({
@@ -67,7 +67,7 @@ export const QoveryConfigurePage = () => {
const [scope, setScope] = useState("application");
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [secretPath, setSecretPath] = useState("/");
@@ -178,7 +178,7 @@ export const QoveryConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -241,7 +241,7 @@ export const QoveryConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/RailwayAuthorizePage/RailwayAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/RailwayAuthorizePage/RailwayAuthorizePage.tsx
index 5acc04b1b2..c17bd2da00 100644
--- a/frontend/src/pages/secret-manager/integrations/RailwayAuthorizePage/RailwayAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/RailwayAuthorizePage/RailwayAuthorizePage.tsx
@@ -2,13 +2,13 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const RailwayAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
@@ -25,7 +25,7 @@ export const RailwayAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "railway",
accessToken: apiKey
});
@@ -35,7 +35,7 @@ export const RailwayAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/railway/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/RailwayConfigurePage/RailwayConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/RailwayConfigurePage/RailwayConfigurePage.tsx
index 835e592774..1d24f7ce7a 100644
--- a/frontend/src/pages/secret-manager/integrations/RailwayConfigurePage/RailwayConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/RailwayConfigurePage/RailwayConfigurePage.tsx
@@ -11,7 +11,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -25,13 +25,13 @@ export const RailwayConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [targetAppId, setTargetAppId] = useState("");
const [targetEnvironmentId, setTargetEnvironmentId] = useState("");
const [targetServiceId, setTargetServiceId] = useState("");
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [secretPath, setSecretPath] = useState("/");
const [isLoading, setIsLoading] = useState(false);
@@ -110,7 +110,7 @@ export const RailwayConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -139,7 +139,7 @@ export const RailwayConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/RenderAuthorizePage/RenderAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/RenderAuthorizePage/RenderAuthorizePage.tsx
index 8be39cb9e5..576400ad1d 100644
--- a/frontend/src/pages/secret-manager/integrations/RenderAuthorizePage/RenderAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/RenderAuthorizePage/RenderAuthorizePage.tsx
@@ -5,13 +5,13 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const RenderAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
@@ -28,7 +28,7 @@ export const RenderAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "render",
accessToken: apiKey
});
@@ -38,7 +38,7 @@ export const RenderAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/render/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/RenderConfigurePage/RenderConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/RenderConfigurePage/RenderConfigurePage.tsx
index 3d156cdac3..4a2ef30d12 100644
--- a/frontend/src/pages/secret-manager/integrations/RenderConfigurePage/RenderConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/RenderConfigurePage/RenderConfigurePage.tsx
@@ -23,7 +23,7 @@ import {
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -44,13 +44,13 @@ export const RenderConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { control, handleSubmit, setValue, watch } = useForm<FormData>({
resolver: zodResolver(schema),
defaultValues: {
secretPath: "/",
shouldAutoRedeploy: false,
- selectedSourceEnvironment: currentWorkspace.environments[0].slug
+ selectedSourceEnvironment: currentProject.environments[0].slug
}
});
@@ -106,7 +106,7 @@ export const RenderConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -167,7 +167,7 @@ export const RenderConfigurePage = () => {
onValueChange={(e) => onChange(e)}
className="w-full"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/RundeckAuthorizePage/RundeckAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/RundeckAuthorizePage/RundeckAuthorizePage.tsx
index f67b22b374..8ef2af0549 100644
--- a/frontend/src/pages/secret-manager/integrations/RundeckAuthorizePage/RundeckAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/RundeckAuthorizePage/RundeckAuthorizePage.tsx
@@ -8,7 +8,7 @@ import { useNavigate } from "@tanstack/react-router";
import z from "zod";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
const schema = z.object({
@@ -25,7 +25,7 @@ export const RundeckAuthorizePage = () => {
const [isLoading, setIsLoading] = useState(false);
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { control, handleSubmit } = useForm<FormData>({
resolver: zodResolver(schema),
@@ -40,7 +40,7 @@ export const RundeckAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "rundeck",
accessToken: authToken,
url: rundeckURL.trim()
@@ -50,7 +50,7 @@ export const RundeckAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/rundeck/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/RundeckConfigurePage/RundeckConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/RundeckConfigurePage/RundeckConfigurePage.tsx
index 7c8dada9f3..555a5cc5cc 100644
--- a/frontend/src/pages/secret-manager/integrations/RundeckConfigurePage/RundeckConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/RundeckConfigurePage/RundeckConfigurePage.tsx
@@ -17,7 +17,7 @@ import {
} from "@app/components/v2";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import { useGetIntegrationAuthById } from "@app/hooks/api/integrationAuth";
import { IntegrationsListPageTabs } from "@app/types/integrations";
@@ -44,7 +44,7 @@ export const RundeckConfigurePage = () => {
});
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.RundeckConfigurePage.id,
@@ -73,7 +73,7 @@ export const RundeckConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -138,7 +138,7 @@ export const RundeckConfigurePage = () => {
field.onChange(val);
}}
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
@@ -171,7 +171,7 @@ export const RundeckConfigurePage = () => {
isError={Boolean(error)}
>
<Input
- placeholder={`keys/project/${currentWorkspace.name
+ placeholder={`keys/project/${currentProject.name
.toLowerCase()
.replace(/ /g, "-")}/${selectedSourceEnvironment}`}
{...field}
diff --git a/frontend/src/pages/secret-manager/integrations/SelectIntegrationAuthPage/SelectIntegrationAuthPage.tsx b/frontend/src/pages/secret-manager/integrations/SelectIntegrationAuthPage/SelectIntegrationAuthPage.tsx
index d06ab24fb1..b2db178c60 100644
--- a/frontend/src/pages/secret-manager/integrations/SelectIntegrationAuthPage/SelectIntegrationAuthPage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/SelectIntegrationAuthPage/SelectIntegrationAuthPage.tsx
@@ -6,7 +6,7 @@ import { useNavigate, useSearch } from "@tanstack/react-router";
import { Button, Card, CardTitle, ContentLoader } from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useOrganization, useWorkspace } from "@app/context";
+import { useOrganization, useProject } from "@app/context";
import {
useDuplicateIntegrationAuth,
useGetCloudIntegrations,
@@ -20,7 +20,7 @@ export const SelectIntegrationAuthPage = () => {
const navigate = useNavigate();
const { data: cloudIntegrations } = useGetCloudIntegrations();
const { currentOrg } = useOrganization();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const orgId = currentOrg?.id || "";
const integrationSlug = useSearch({
@@ -50,10 +50,10 @@ export const SelectIntegrationAuthPage = () => {
if (integrationSlug === "github") {
const sameProjectIntegrationAuths = filteredIntegrationAuths.filter(
- (auth) => auth.projectId === currentWorkspace?.id
+ (auth) => auth.projectId === currentProject?.id
);
const differentProjectIntegrationAuths = filteredIntegrationAuths.filter(
- (auth) => auth.projectId !== currentWorkspace?.id
+ (auth) => auth.projectId !== currentProject?.id
);
const installationIds = new Set<string>();
@@ -117,11 +117,11 @@ export const SelectIntegrationAuthPage = () => {
const handleConnectionSelect = async (integrationAuth: IntegrationAuth) => {
if (integrationSlug === "github") {
- if (integrationAuth.projectId === currentWorkspace?.id) {
+ if (integrationAuth.projectId === currentProject?.id) {
navigate({
to: "/projects/secret-management/$projectId/integrations/github/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
@@ -130,14 +130,14 @@ export const SelectIntegrationAuthPage = () => {
} else {
// we create a copy of the existing integration auth from another project to the current project
const newIntegrationAuth = await duplicateIntegrationAuth({
- projectId: currentWorkspace?.id || "",
+ projectId: currentProject?.id || "",
integrationAuthId: integrationAuth.id
});
navigate({
to: "/projects/secret-management/$projectId/integrations/github/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: newIntegrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/SupabaseAuthorizePage/SupabaseAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/SupabaseAuthorizePage/SupabaseAuthorizePage.tsx
index 5ec969e118..210efea1c3 100644
--- a/frontend/src/pages/secret-manager/integrations/SupabaseAuthorizePage/SupabaseAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/SupabaseAuthorizePage/SupabaseAuthorizePage.tsx
@@ -2,13 +2,13 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const SupabaseAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
@@ -25,7 +25,7 @@ export const SupabaseAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "supabase",
accessToken: apiKey
});
@@ -35,7 +35,7 @@ export const SupabaseAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/supabase/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/SupabaseConfigurePage/SupabaseConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/SupabaseConfigurePage/SupabaseConfigurePage.tsx
index 333c61a8ec..38183a5adf 100644
--- a/frontend/src/pages/secret-manager/integrations/SupabaseConfigurePage/SupabaseConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/SupabaseConfigurePage/SupabaseConfigurePage.tsx
@@ -11,7 +11,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -22,7 +22,7 @@ import { IntegrationsListPageTabs } from "@app/types/integrations";
export const SupabaseConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.SupabaseConfigurePage.id,
select: (el) => el.integrationAuthId
@@ -34,7 +34,7 @@ export const SupabaseConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [secretPath, setSecretPath] = useState("/");
const [targetApp, setTargetApp] = useState("");
@@ -73,7 +73,7 @@ export const SupabaseConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -94,7 +94,7 @@ export const SupabaseConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/TeamcityAuthorizePage/TeamcityAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/TeamcityAuthorizePage/TeamcityAuthorizePage.tsx
index 4698fac598..7ece98cd70 100644
--- a/frontend/src/pages/secret-manager/integrations/TeamcityAuthorizePage/TeamcityAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/TeamcityAuthorizePage/TeamcityAuthorizePage.tsx
@@ -5,14 +5,14 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const TeamcityAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
const [serverUrl, setServerUrl] = useState("");
@@ -37,7 +37,7 @@ export const TeamcityAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "teamcity",
accessToken: apiKey,
url: serverUrl
@@ -48,7 +48,7 @@ export const TeamcityAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/teamcity/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/TeamcityConfigurePage/TeamcityConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/TeamcityConfigurePage/TeamcityConfigurePage.tsx
index 9291d0d5fd..8e7d0fe973 100644
--- a/frontend/src/pages/secret-manager/integrations/TeamcityConfigurePage/TeamcityConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/TeamcityConfigurePage/TeamcityConfigurePage.tsx
@@ -14,7 +14,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -26,7 +26,7 @@ import { IntegrationsListPageTabs } from "@app/types/integrations";
export const TeamcityConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.TeamcityConfigurePage.id,
@@ -34,7 +34,7 @@ export const TeamcityConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [targetAppId, setTargetAppId] = useState("");
const [targetBuildConfigId, setTargetBuildConfigId] = useState<string>("");
@@ -92,7 +92,7 @@ export const TeamcityConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -149,7 +149,7 @@ export const TeamcityConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/TerraformCloudAuthorizePage/TerraformCloudAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/TerraformCloudAuthorizePage/TerraformCloudAuthorizePage.tsx
index eac1fa0c0e..4275875c4b 100644
--- a/frontend/src/pages/secret-manager/integrations/TerraformCloudAuthorizePage/TerraformCloudAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/TerraformCloudAuthorizePage/TerraformCloudAuthorizePage.tsx
@@ -5,13 +5,13 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const TerraformCloudAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
@@ -37,7 +37,7 @@ export const TerraformCloudAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "terraform-cloud",
accessId: workspacesId,
accessToken: apiKey
@@ -48,7 +48,7 @@ export const TerraformCloudAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/terraform-cloud/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/TerraformCloudConfigurePage/TerraformCloudConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/TerraformCloudConfigurePage/TerraformCloudConfigurePage.tsx
index a2d73feca6..ba44dfaa47 100644
--- a/frontend/src/pages/secret-manager/integrations/TerraformCloudConfigurePage/TerraformCloudConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/TerraformCloudConfigurePage/TerraformCloudConfigurePage.tsx
@@ -14,7 +14,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -44,7 +44,7 @@ export const TerraformCloudConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.TerraformCloudConfigurePage.id,
@@ -56,7 +56,7 @@ export const TerraformCloudConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [targetApp, setTargetApp] = useState("");
const [secretPath, setSecretPath] = useState("/");
@@ -107,7 +107,7 @@ export const TerraformCloudConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -160,7 +160,7 @@ export const TerraformCloudConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/TravisCIAuthorizePage/TravisCIAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/TravisCIAuthorizePage/TravisCIAuthorizePage.tsx
index 3323aed7d8..f588493115 100644
--- a/frontend/src/pages/secret-manager/integrations/TravisCIAuthorizePage/TravisCIAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/TravisCIAuthorizePage/TravisCIAuthorizePage.tsx
@@ -2,12 +2,12 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const TravisCIAuthorizePage = () => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { mutateAsync } = useSaveIntegrationAccessToken();
const [apiKey, setApiKey] = useState("");
@@ -25,7 +25,7 @@ export const TravisCIAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "travisci",
accessToken: apiKey
});
@@ -35,7 +35,7 @@ export const TravisCIAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/travisci/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/TravisCIConfigurePage/TravisCIConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/TravisCIConfigurePage/TravisCIConfigurePage.tsx
index 66c3a80223..e71a6ab319 100644
--- a/frontend/src/pages/secret-manager/integrations/TravisCIConfigurePage/TravisCIConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/TravisCIConfigurePage/TravisCIConfigurePage.tsx
@@ -11,7 +11,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -23,7 +23,7 @@ export const TravisCIConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.TravisCIConfigurePage.id,
@@ -36,7 +36,7 @@ export const TravisCIConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [targetApp, setTargetApp] = useState("");
const [secretPath, setSecretPath] = useState("/");
@@ -74,7 +74,7 @@ export const TravisCIConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -95,7 +95,7 @@ export const TravisCIConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/VercelConfigurePage/VercelConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/VercelConfigurePage/VercelConfigurePage.tsx
index 25c209f09f..c2b668f616 100644
--- a/frontend/src/pages/secret-manager/integrations/VercelConfigurePage/VercelConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/VercelConfigurePage/VercelConfigurePage.tsx
@@ -20,7 +20,7 @@ import {
Tooltip
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -52,9 +52,9 @@ export const VercelConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [secretPath, setSecretPath] = useState("/");
const [initialSyncBehavior, setInitialSyncBehavior] = useState<IntegrationSyncBehavior>(
@@ -134,7 +134,7 @@ export const VercelConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -206,7 +206,7 @@ export const VercelConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`azure-key-vault-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/integrations/VercelOauthCallbackPage/VercelOauthCallbackPage.tsx b/frontend/src/pages/secret-manager/integrations/VercelOauthCallbackPage/VercelOauthCallbackPage.tsx
index 02fb22eab1..f3b5b05c41 100644
--- a/frontend/src/pages/secret-manager/integrations/VercelOauthCallbackPage/VercelOauthCallbackPage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/VercelOauthCallbackPage/VercelOauthCallbackPage.tsx
@@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useAuthorizeIntegration } from "@app/hooks/api";
export const VercelOauthCallbackPage = () => {
@@ -12,7 +12,7 @@ export const VercelOauthCallbackPage = () => {
const { code, state } = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.VercelOauthCallbackPage.id
});
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
useEffect(() => {
(async () => {
@@ -22,7 +22,7 @@ export const VercelOauthCallbackPage = () => {
localStorage.removeItem("latestCSRFToken");
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
code: code as string,
integration: "vercel"
});
@@ -30,7 +30,7 @@ export const VercelOauthCallbackPage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/vercel/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/WindmillAuthorizePage/WindmillAuthorizePage.tsx b/frontend/src/pages/secret-manager/integrations/WindmillAuthorizePage/WindmillAuthorizePage.tsx
index 36e791e567..3cd3ff335c 100644
--- a/frontend/src/pages/secret-manager/integrations/WindmillAuthorizePage/WindmillAuthorizePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/WindmillAuthorizePage/WindmillAuthorizePage.tsx
@@ -2,14 +2,14 @@ import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { isInfisicalCloud } from "@app/helpers/platform";
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
export const WindmillAuthorizePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useSaveIntegrationAccessToken();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
const [apiUrl, setApiUrl] = useState<string | null>(null);
@@ -68,7 +68,7 @@ export const WindmillAuthorizePage = () => {
setIsLoading(true);
const integrationAuth = await mutateAsync({
- workspaceId: currentWorkspace.id,
+ workspaceId: currentProject.id,
integration: "windmill",
accessToken: apiKey,
url: apiUrl ?? undefined
@@ -79,7 +79,7 @@ export const WindmillAuthorizePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations/windmill/create",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
integrationAuthId: integrationAuth.id
diff --git a/frontend/src/pages/secret-manager/integrations/WindmillConfigurePage/WindmillConfigurePage.tsx b/frontend/src/pages/secret-manager/integrations/WindmillConfigurePage/WindmillConfigurePage.tsx
index 17929b2a3a..7f781c89e6 100644
--- a/frontend/src/pages/secret-manager/integrations/WindmillConfigurePage/WindmillConfigurePage.tsx
+++ b/frontend/src/pages/secret-manager/integrations/WindmillConfigurePage/WindmillConfigurePage.tsx
@@ -11,7 +11,7 @@ import {
SelectItem
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateIntegration } from "@app/hooks/api";
import {
useGetIntegrationAuthApps,
@@ -23,7 +23,7 @@ export const WindmillConfigurePage = () => {
const navigate = useNavigate();
const { mutateAsync } = useCreateIntegration();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const integrationAuthId = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.WindmillConfigurePage.id,
@@ -36,7 +36,7 @@ export const WindmillConfigurePage = () => {
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(
- currentWorkspace.environments[0].slug
+ currentProject.environments[0].slug
);
const [secretPath, setSecretPath] = useState("/");
const [targetApp, setTargetApp] = useState("");
@@ -76,7 +76,7 @@ export const WindmillConfigurePage = () => {
navigate({
to: "/projects/secret-management/$projectId/integrations",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
selectedTab: IntegrationsListPageTabs.NativeIntegrations
@@ -97,7 +97,7 @@ export const WindmillConfigurePage = () => {
onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500"
>
- {currentWorkspace?.environments.map((sourceEnvironment) => (
+ {currentProject?.environments.map((sourceEnvironment) => (
<SelectItem
value={sourceEnvironment.slug}
key={`source-environment-${sourceEnvironment.slug}`}
diff --git a/frontend/src/pages/secret-manager/layout.tsx b/frontend/src/pages/secret-manager/layout.tsx
index 73c3278d07..19a794239c 100644
--- a/frontend/src/pages/secret-manager/layout.tsx
+++ b/frontend/src/pages/secret-manager/layout.tsx
@@ -1,9 +1,9 @@
import { createFileRoute } from "@tanstack/react-router";
import { BreadcrumbTypes } from "@app/components/v2";
-import { workspaceKeys } from "@app/hooks/api";
+import { projectKeys } from "@app/hooks/api";
import { fetchUserProjectPermissions, roleQueryKeys } from "@app/hooks/api/roles/queries";
-import { fetchWorkspaceById } from "@app/hooks/api/workspace/queries";
+import { fetchProjectById } from "@app/hooks/api/projects/queries";
import { ProjectSelect } from "@app/layouts/ProjectLayout/components/ProjectSelect";
import { SecretManagerLayout } from "@app/layouts/SecretManagerLayout";
@@ -14,15 +14,15 @@ export const Route = createFileRoute(
beforeLoad: async ({ params, context }) => {
const project = await context.queryClient.ensureQueryData({
- queryKey: workspaceKeys.getWorkspaceById(params.projectId),
- queryFn: () => fetchWorkspaceById(params.projectId)
+ queryKey: projectKeys.getProjectById(params.projectId),
+ queryFn: () => fetchProjectById(params.projectId)
});
await context.queryClient.ensureQueryData({
queryKey: roleQueryKeys.getUserProjectPermissions({
- workspaceId: params.projectId
+ projectId: params.projectId
}),
- queryFn: () => fetchUserProjectPermissions({ workspaceId: params.projectId })
+ queryFn: () => fetchUserProjectPermissions({ projectId: params.projectId })
});
return {
diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningScanRow.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningScanRow.tsx
index 6dc7ceb35d..804c4d7908 100644
--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningScanRow.tsx
+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningScanRow.tsx
@@ -18,7 +18,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useToggle } from "@app/hooks";
import {
SecretScanningScanStatus,
@@ -41,7 +41,7 @@ export const SecretScanningScanRow = ({ scan }: Props) => {
resolvedFindings,
type
} = scan;
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const totalFindings = resolvedFindings + unresolvedFindings;
const navigate = useNavigate();
@@ -97,7 +97,7 @@ export const SecretScanningScanRow = ({ scan }: Props) => {
navigate({
to: "/projects/secret-scanning/$projectId/findings",
params: {
- projectId: currentWorkspace.id
+ projectId: currentProject.id
},
search: {
search: `scanId:${id}`
diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx
index 019ca3467e..9ce2d728b6 100644
--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx
+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx
@@ -5,7 +5,7 @@ import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { ProjectPermissionCan } from "@app/components/permissions";
import { CreateSecretScanningDataSourceModal } from "@app/components/secret-scanning";
import { Button, Spinner } from "@app/components/v2";
-import { ProjectPermissionSub, useSubscription, useWorkspace } from "@app/context";
+import { ProjectPermissionSub, useSubscription, useProject } from "@app/context";
import { ProjectPermissionSecretScanningDataSourceActions } from "@app/context/ProjectPermissionContext/types";
import { usePopUp } from "@app/hooks";
import { useListSecretScanningDataSources } from "@app/hooks/api/secretScanningV2";
@@ -20,10 +20,10 @@ export const SecretScanningDataSourcesSection = () => {
const { subscription } = useSubscription();
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: dataSources = [], isPending: isDataSourcesPending } =
- useListSecretScanningDataSources(currentWorkspace.id, {
+ useListSecretScanningDataSources(currentProject.id, {
refetchInterval: 30000,
enabled: subscription.secretScanning
});
diff --git a/frontend/src/pages/secret-scanning/SecretScanningFindingsPage/components/SecretScanningFindingsSection.tsx b/frontend/src/pages/secret-scanning/SecretScanningFindingsPage/components/SecretScanningFindingsSection.tsx
index 82ea049f90..4a9cf1ad01 100644
--- a/frontend/src/pages/secret-scanning/SecretScanningFindingsPage/components/SecretScanningFindingsSection.tsx
+++ b/frontend/src/pages/secret-scanning/SecretScanningFindingsPage/components/SecretScanningFindingsSection.tsx
@@ -2,16 +2,16 @@ import { faArrowUpRightFromSquare, faBookOpen } from "@fortawesome/free-solid-sv
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { ContentLoader } from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useListSecretScanningFindings } from "@app/hooks/api/secretScanningV2";
import { SecretScanningFindingsTable } from "./SecretScanningFindingsTable";
export const SecretScanningFindingsSection = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: findings = [], isPending: isFindingsPending } = useListSecretScanningFindings(
- currentWorkspace.id,
+ currentProject.id,
{
refetchInterval: 30000
}
diff --git a/frontend/src/pages/secret-scanning/SettingsPage/components/ProjectScanningConfigTab/ProjectScanningConfigTab.tsx b/frontend/src/pages/secret-scanning/SettingsPage/components/ProjectScanningConfigTab/ProjectScanningConfigTab.tsx
index e8d3206d8d..d071ea59ec 100644
--- a/frontend/src/pages/secret-scanning/SettingsPage/components/ProjectScanningConfigTab/ProjectScanningConfigTab.tsx
+++ b/frontend/src/pages/secret-scanning/SettingsPage/components/ProjectScanningConfigTab/ProjectScanningConfigTab.tsx
@@ -1,16 +1,16 @@
import { faBan } from "@fortawesome/free-solid-svg-icons";
import { AccessRestrictedBanner, ContentLoader, EmptyState } from "@app/components/v2";
-import { useSubscription, useWorkspace } from "@app/context";
+import { useSubscription, useProject } from "@app/context";
import { useGetSecretScanningConfig } from "@app/hooks/api/secretScanningV2";
import { SecretScanningConfigForm } from "./SecretScanningConfigForm";
export const ProjectScanningConfigTab = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { subscription } = useSubscription();
const { data: config, isPending: isConfigPending } = useGetSecretScanningConfig(
- currentWorkspace.id,
+ currentProject.id,
{ enabled: subscription.secretScanning }
);
diff --git a/frontend/src/pages/secret-scanning/layout.tsx b/frontend/src/pages/secret-scanning/layout.tsx
index 38899a2336..c5e9694f89 100644
--- a/frontend/src/pages/secret-scanning/layout.tsx
+++ b/frontend/src/pages/secret-scanning/layout.tsx
@@ -1,9 +1,9 @@
import { createFileRoute } from "@tanstack/react-router";
import { BreadcrumbTypes } from "@app/components/v2";
-import { workspaceKeys } from "@app/hooks/api";
+import { projectKeys } from "@app/hooks/api";
import { fetchUserProjectPermissions, roleQueryKeys } from "@app/hooks/api/roles/queries";
-import { fetchWorkspaceById } from "@app/hooks/api/workspace/queries";
+import { fetchProjectById } from "@app/hooks/api/projects/queries";
import { ProjectSelect } from "@app/layouts/ProjectLayout/components/ProjectSelect";
import { SecretScanningLayout } from "@app/layouts/SecretScanningLayout";
@@ -13,15 +13,15 @@ export const Route = createFileRoute(
component: SecretScanningLayout,
beforeLoad: async ({ params, context }) => {
const project = await context.queryClient.ensureQueryData({
- queryKey: workspaceKeys.getWorkspaceById(params.projectId),
- queryFn: () => fetchWorkspaceById(params.projectId)
+ queryKey: projectKeys.getProjectById(params.projectId),
+ queryFn: () => fetchProjectById(params.projectId)
});
await context.queryClient.ensureQueryData({
queryKey: roleQueryKeys.getUserProjectPermissions({
- workspaceId: params.projectId
+ projectId: params.projectId
}),
- queryFn: () => fetchUserProjectPermissions({ workspaceId: params.projectId })
+ queryFn: () => fetchUserProjectPermissions({ projectId: params.projectId })
});
return {
diff --git a/frontend/src/pages/ssh/SettingsPage/components/ProjectSshTab/components/ProjectSshConfigCasSection.tsx b/frontend/src/pages/ssh/SettingsPage/components/ProjectSshTab/components/ProjectSshConfigCasSection.tsx
index 503717326f..7b00b3ea03 100644
--- a/frontend/src/pages/ssh/SettingsPage/components/ProjectSshTab/components/ProjectSshConfigCasSection.tsx
+++ b/frontend/src/pages/ssh/SettingsPage/components/ProjectSshTab/components/ProjectSshConfigCasSection.tsx
@@ -6,7 +6,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, FormControl, Select, SelectItem } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import {
useGetProjectSshConfig,
useListWorkspaceSshCas,
@@ -23,9 +23,9 @@ const schema = z
export type FormData = z.infer<typeof schema>;
export const ProjectSshConfigCasSection = () => {
- const { currentWorkspace } = useWorkspace();
- const { data: sshConfig } = useGetProjectSshConfig(currentWorkspace.id);
- const { data: sshCas } = useListWorkspaceSshCas(currentWorkspace.id);
+ const { currentProject } = useProject();
+ const { data: sshConfig } = useGetProjectSshConfig(currentProject.id);
+ const { data: sshCas } = useListWorkspaceSshCas(currentProject.id);
const { mutate: updateProjectSshConfig } = useUpdateProjectSshConfig();
const {
@@ -49,7 +49,7 @@ export const ProjectSshConfigCasSection = () => {
const onFormSubmit = async ({ defaultUserSshCaId, defaultHostSshCaId }: FormData) => {
try {
await updateProjectSshConfig({
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
defaultUserSshCaId: defaultUserSshCaId || undefined,
defaultHostSshCaId: defaultHostSshCaId || undefined
});
diff --git a/frontend/src/pages/ssh/SshCaByIDPage/SshCaByIDPage.tsx b/frontend/src/pages/ssh/SshCaByIDPage/SshCaByIDPage.tsx
index 8bed6e6476..88a8c7f600 100644
--- a/frontend/src/pages/ssh/SshCaByIDPage/SshCaByIDPage.tsx
+++ b/frontend/src/pages/ssh/SshCaByIDPage/SshCaByIDPage.tsx
@@ -15,7 +15,7 @@ import {
Tooltip
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useDeleteSshCa, useGetSshCaById } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -23,9 +23,9 @@ import { SshCaModal } from "../SshCasPage/components/SshCaModal";
import { SshCaDetailsSection, SshCertificateTemplatesSection } from "./components";
const Page = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate();
- const projectId = currentWorkspace?.id || "";
+ const projectId = currentProject?.id || "";
const caId = useParams({
from: ROUTE_PATHS.Ssh.SshCaByIDPage.id,
select: (el) => el.caId
diff --git a/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateModal.tsx b/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateModal.tsx
index 5c46739316..6e0baa5026 100644
--- a/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateModal.tsx
+++ b/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateModal.tsx
@@ -14,7 +14,7 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
SshCertTemplateStatus,
useGetSshCertTemplate,
@@ -71,8 +71,8 @@ enum SshCertificateOperation {
}
export const SshCertificateModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const [operation, setOperation] = useState<SshCertificateOperation>(
SshCertificateOperation.SIGN_SSH_KEY
);
diff --git a/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateTemplateModal.tsx b/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateTemplateModal.tsx
index 55d4104ace..17c7a552ee 100644
--- a/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateTemplateModal.tsx
+++ b/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateTemplateModal.tsx
@@ -16,7 +16,7 @@ import {
SelectItem,
Switch
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
useCreateSshCertTemplate,
useGetSshCaById,
@@ -77,7 +77,7 @@ type Props = {
};
export const SshCertificateTemplateModal = ({ popUp, handlePopUpToggle, sshCaId }: Props) => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const { data: ca } = useGetSshCaById(sshCaId);
@@ -85,7 +85,7 @@ export const SshCertificateTemplateModal = ({ popUp, handlePopUpToggle, sshCaId
(popUp?.sshCertificateTemplate?.data as { id: string })?.id || ""
);
- const { data: cas } = useListWorkspaceSshCas(currentWorkspace?.id || "");
+ const { data: cas } = useListWorkspaceSshCas(currentProject?.id || "");
const { mutateAsync: createSshCertTemplate } = useCreateSshCertTemplate();
const { mutateAsync: updateSshCertTemplate } = useUpdateSshCertTemplate();
diff --git a/frontend/src/pages/ssh/SshCasPage/components/SshCaModal.tsx b/frontend/src/pages/ssh/SshCasPage/components/SshCaModal.tsx
index 758af52a95..4c8ce4e193 100644
--- a/frontend/src/pages/ssh/SshCasPage/components/SshCaModal.tsx
+++ b/frontend/src/pages/ssh/SshCasPage/components/SshCaModal.tsx
@@ -15,7 +15,7 @@ import {
SelectItem,
TextArea
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useCreateSshCa, useGetSshCaById, useUpdateSshCa } from "@app/hooks/api";
import {
SshCaKeySource,
@@ -54,8 +54,8 @@ export type FormData = z.infer<typeof schema>;
export const SshCaModal = ({ popUp, handlePopUpToggle }: Props) => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
const { data: ca } = useGetSshCaById((popUp?.sshCa?.data as { caId: string })?.caId || "");
const { mutateAsync: createMutateAsync } = useCreateSshCa();
diff --git a/frontend/src/pages/ssh/SshCasPage/components/SshCaTable.tsx b/frontend/src/pages/ssh/SshCasPage/components/SshCaTable.tsx
index 37a086f37c..c94f736647 100644
--- a/frontend/src/pages/ssh/SshCasPage/components/SshCaTable.tsx
+++ b/frontend/src/pages/ssh/SshCasPage/components/SshCaTable.tsx
@@ -21,7 +21,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { SshCaStatus, useListWorkspaceSshCas } from "@app/hooks/api";
import { caStatusToNameMap, getCaStatusBadgeVariant } from "@app/hooks/api/ca/constants";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -35,8 +35,8 @@ type Props = {
export const SshCaTable = ({ handlePopUpOpen }: Props) => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
- const { data, isPending } = useListWorkspaceSshCas(currentWorkspace?.id || "");
+ const { currentProject } = useProject();
+ const { data, isPending } = useListWorkspaceSshCas(currentProject?.id || "");
return (
<div>
@@ -63,7 +63,7 @@ export const SshCaTable = ({ handlePopUpOpen }: Props) => {
navigate({
to: "/projects/ssh/$projectId/ca/$caId",
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
caId: ca.id
}
})
diff --git a/frontend/src/pages/ssh/SshCertsPage/components/SshCertificatesTable.tsx b/frontend/src/pages/ssh/SshCertsPage/components/SshCertificatesTable.tsx
index c48b407ac6..1ebf3112cf 100644
--- a/frontend/src/pages/ssh/SshCertsPage/components/SshCertificatesTable.tsx
+++ b/frontend/src/pages/ssh/SshCertsPage/components/SshCertificatesTable.tsx
@@ -15,7 +15,7 @@ import {
THead,
Tr
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import { useListWorkspaceSshCertificates } from "@app/hooks/api";
import { getSshCertStatusBadgeDetails } from "./SshCertificatesTable.utils";
@@ -23,12 +23,12 @@ import { getSshCertStatusBadgeDetails } from "./SshCertificatesTable.utils";
const PER_PAGE_INIT = 25;
export const SshCertificatesTable = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(PER_PAGE_INIT);
const { data, isPending } = useListWorkspaceSshCertificates({
- projectId: currentWorkspace?.id || "",
+ projectId: currentProject?.id || "",
offset: (page - 1) * perPage,
limit: perPage
});
diff --git a/frontend/src/pages/ssh/SshHostGroupDetailsByIDPage/SshHostGroupDetailsByIDPage.tsx b/frontend/src/pages/ssh/SshHostGroupDetailsByIDPage/SshHostGroupDetailsByIDPage.tsx
index 6b43e83240..e030a8fa06 100644
--- a/frontend/src/pages/ssh/SshHostGroupDetailsByIDPage/SshHostGroupDetailsByIDPage.tsx
+++ b/frontend/src/pages/ssh/SshHostGroupDetailsByIDPage/SshHostGroupDetailsByIDPage.tsx
@@ -16,7 +16,7 @@ import {
Tooltip
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useDeleteSshHostGroup, useGetSshHostGroupById } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -24,9 +24,9 @@ import { SshHostGroupModal } from "../SshHostsPage/components/SshHostGroupModal"
import { SshHostGroupDetailsSection, SshHostGroupHostsSection } from "./components";
const Page = () => {
- const { currentWorkspace } = useWorkspace();
+ const { currentProject } = useProject();
const navigate = useNavigate();
- const projectId = currentWorkspace?.id || "";
+ const projectId = currentProject?.id || "";
const sshHostGroupId = useParams({
from: ROUTE_PATHS.Ssh.SshHostGroupDetailsByIDPage.id,
select: (el) => el.sshHostGroupId
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupModal.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupModal.tsx
index 84be5a96d7..4905695d48 100644
--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupModal.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupModal.tsx
@@ -17,7 +17,7 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
useCreateSshHostGroup,
useGetSshHostGroupById,
@@ -56,8 +56,8 @@ const schema = z
export type FormData = z.infer<typeof schema>;
export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace.id;
+ const { currentProject } = useProject();
+ const projectId = currentProject.id;
const { data: sshHostGroups } = useListWorkspaceSshHostGroups(projectId);
const { data: members = [] } = useGetWorkspaceUsers(projectId);
const { data: groups = [] } = useListWorkspaceGroups(projectId);
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsTable.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsTable.tsx
index daedabdc91..af3a97dc6a 100644
--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsTable.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsTable.tsx
@@ -28,7 +28,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useListWorkspaceSshHostGroups } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -41,8 +41,8 @@ type Props = {
export const SshHostGroupsTable = ({ handlePopUpOpen }: Props) => {
const navigate = useNavigate();
- const { currentWorkspace } = useWorkspace();
- const { data, isPending } = useListWorkspaceSshHostGroups(currentWorkspace?.id || "");
+ const { currentProject } = useProject();
+ const { data, isPending } = useListWorkspaceSshHostGroups(currentProject?.id || "");
return (
<div>
<TableContainer>
@@ -69,7 +69,7 @@ export const SshHostGroupsTable = ({ handlePopUpOpen }: Props) => {
navigate({
to: "/projects/ssh/$projectId/ssh-host-groups/$sshHostGroupId",
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
sshHostGroupId: group.id
}
})
@@ -170,7 +170,7 @@ export const SshHostGroupsTable = ({ handlePopUpOpen }: Props) => {
navigate({
to: "/projects/ssh/$projectId/ssh-host-groups/$sshHostGroupId",
params: {
- projectId: currentWorkspace.id,
+ projectId: currentProject.id,
sshHostGroupId: group.id
}
});
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx
index 5619a75c4c..e1ea75143a 100644
--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx
@@ -18,7 +18,7 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { useProject } from "@app/context";
import {
useCreateSshHost,
useGetSshHostById,
@@ -68,9 +68,9 @@ const schema = z
export type FormData = z.infer<typeof schema>;
export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
- const { data: sshHosts } = useListWorkspaceSshHosts(currentWorkspace.id);
+ const { currentProject } = useProject();
+ const projectId = currentProject?.id || "";
+ const { data: sshHosts } = useListWorkspaceSshHosts(currentProject.id);
const { data: members = [] } = useGetWorkspaceUsers(projectId);
const { data: groups = [] } = useListWorkspaceGroups(projectId);
const [expandedMappings, setExpandedMappings] = useState<Record<number, boolean>>({});
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostsTable.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostsTable.tsx
index 62f563ccec..f29f0147e7 100644
--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostsTable.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostsTable.tsx
@@ -30,7 +30,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionSshHostActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionSshHostActions, ProjectPermissionSub, useProject } from "@app/context";
import { fetchSshHostUserCaPublicKey, useListWorkspaceSshHosts } from "@app/hooks/api";
import { LoginMappingSource } from "@app/hooks/api/sshHost/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -43,8 +43,8 @@ type Props = {
};
export const SshHostsTable = ({ handlePopUpOpen }: Props) => {
- const { currentWorkspace } = useWorkspace();
- const { data, isPending } = useListWorkspaceSshHosts(currentWorkspace?.id || "");
+ const { currentProject } = useProject();
+ const { data, isPending } = useListWorkspaceSshHosts(currentProject?.id || "");
const downloadTxtFile = (filename: string, content: string) => {
const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
diff --git a/frontend/src/pages/ssh/layout.tsx b/frontend/src/pages/ssh/layout.tsx
index 008aca3935..a18e15f540 100644
--- a/frontend/src/pages/ssh/layout.tsx
+++ b/frontend/src/pages/ssh/layout.tsx
@@ -1,9 +1,9 @@
import { createFileRoute } from "@tanstack/react-router";
import { BreadcrumbTypes } from "@app/components/v2";
-import { workspaceKeys } from "@app/hooks/api";
+import { projectKeys } from "@app/hooks/api";
import { fetchUserProjectPermissions, roleQueryKeys } from "@app/hooks/api/roles/queries";
-import { fetchWorkspaceById } from "@app/hooks/api/workspace/queries";
+import { fetchProjectById } from "@app/hooks/api/projects/queries";
import { ProjectSelect } from "@app/layouts/ProjectLayout/components/ProjectSelect";
import { SshLayout } from "@app/layouts/SshLayout";
@@ -13,15 +13,15 @@ export const Route = createFileRoute(
component: SshLayout,
beforeLoad: async ({ params, context }) => {
const project = await context.queryClient.ensureQueryData({
- queryKey: workspaceKeys.getWorkspaceById(params.projectId),
- queryFn: () => fetchWorkspaceById(params.projectId)
+ queryKey: projectKeys.getProjectById(params.projectId),
+ queryFn: () => fetchProjectById(params.projectId)
});
await context.queryClient.ensureQueryData({
queryKey: roleQueryKeys.getUserProjectPermissions({
- workspaceId: params.projectId
+ projectId: params.projectId
}),
- queryFn: () => fetchUserProjectPermissions({ workspaceId: params.projectId })
+ queryFn: () => fetchUserProjectPermissions({ projectId: params.projectId })
});
return {