mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 22:46:24 +00:00
feature: access tree
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
export {
|
||||
useAdminDeleteUser,
|
||||
useAdminGrantServerAdminAccess,
|
||||
useCreateAdminUser,
|
||||
useUpdateAdminSlackConfig,
|
||||
useUpdateServerConfig,
|
||||
useUpdateServerEncryptionStrategy,
|
||||
useAdminGrantServerAdminAccess
|
||||
useUpdateServerEncryptionStrategy
|
||||
} from "./mutation";
|
||||
export {
|
||||
useAdminGetUsers,
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
TDeleteFolderDTO,
|
||||
TGetFoldersByEnvDTO,
|
||||
TGetProjectFoldersDTO,
|
||||
TProjectEnvironmentsFolders,
|
||||
TSecretFolder,
|
||||
TUpdateFolderBatchDTO,
|
||||
TUpdateFolderDTO
|
||||
@@ -23,7 +24,9 @@ import {
|
||||
|
||||
export const folderQueryKeys = {
|
||||
getSecretFolders: ({ projectId, environment, path }: TGetProjectFoldersDTO) =>
|
||||
["secret-folders", { projectId, environment, path }] as const
|
||||
["secret-folders", { projectId, environment, path }] as const,
|
||||
getProjectEnvironmentsFolders: (projectId: string) =>
|
||||
["secret-folders", "environment", projectId] as const
|
||||
};
|
||||
|
||||
const fetchProjectFolders = async (workspaceId: string, environment: string, path = "/") => {
|
||||
@@ -37,6 +40,29 @@ const fetchProjectFolders = async (workspaceId: string, environment: string, pat
|
||||
return data.folders;
|
||||
};
|
||||
|
||||
export const useListProjectEnvironmentsFolders = (
|
||||
projectId: string,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
TProjectEnvironmentsFolders,
|
||||
unknown,
|
||||
TProjectEnvironmentsFolders,
|
||||
ReturnType<typeof folderQueryKeys.getProjectEnvironmentsFolders>
|
||||
>,
|
||||
"queryKey" | "queryFn"
|
||||
>
|
||||
) =>
|
||||
useQuery({
|
||||
queryKey: folderQueryKeys.getProjectEnvironmentsFolders(projectId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<TProjectEnvironmentsFolders>(
|
||||
`/api/v1/workspace/${projectId}/folders/project-environments`
|
||||
);
|
||||
return data;
|
||||
},
|
||||
...options
|
||||
});
|
||||
|
||||
export const useGetProjectFolders = ({
|
||||
projectId,
|
||||
environment,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
|
||||
|
||||
export enum ReservedFolders {
|
||||
SecretReplication = "__reserve_replication_"
|
||||
}
|
||||
@@ -6,6 +8,13 @@ export type TSecretFolder = {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
parentId?: string | null;
|
||||
};
|
||||
|
||||
export type TSecretFolderWithPath = TSecretFolder & { path: string };
|
||||
|
||||
export type TProjectEnvironmentsFolders = {
|
||||
[key: string]: WorkspaceEnv & { folders: TSecretFolderWithPath[] };
|
||||
};
|
||||
|
||||
export type TGetProjectFoldersDTO = {
|
||||
|
||||
Reference in New Issue
Block a user