mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 07:35:09 +00:00
improvements: ui improvements & add users to org from project member invite modal
This commit is contained in:
@@ -23,7 +23,8 @@ export const useCreateSecretSync = () => {
|
||||
|
||||
return data.secretSync;
|
||||
},
|
||||
onSuccess: () => queryClient.invalidateQueries({ queryKey: secretSyncKeys.list() })
|
||||
onSuccess: (_, { projectId }) =>
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list(projectId) })
|
||||
});
|
||||
};
|
||||
|
||||
@@ -38,8 +39,8 @@ export const useUpdateSecretSync = () => {
|
||||
|
||||
return data.secretSync;
|
||||
},
|
||||
onSuccess: (_, { syncId, destination }) => {
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list() });
|
||||
onSuccess: (_, { syncId, destination, projectId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list(projectId) });
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.byId(destination, syncId) });
|
||||
}
|
||||
});
|
||||
@@ -55,8 +56,8 @@ export const useDeleteSecretSync = () => {
|
||||
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { syncId, destination }) => {
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list() });
|
||||
onSuccess: (_, { syncId, destination, projectId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list(projectId) });
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.byId(destination, syncId) });
|
||||
}
|
||||
});
|
||||
@@ -72,8 +73,8 @@ export const useTriggerSecretSyncSyncSecrets = () => {
|
||||
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { syncId, destination }) => {
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list() });
|
||||
onSuccess: (_, { syncId, destination, projectId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list(projectId) });
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.byId(destination, syncId) });
|
||||
}
|
||||
});
|
||||
@@ -93,8 +94,8 @@ export const useTriggerSecretSyncImportSecrets = () => {
|
||||
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { syncId, destination }) => {
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list() });
|
||||
onSuccess: (_, { syncId, destination, projectId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list(projectId) });
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.byId(destination, syncId) });
|
||||
}
|
||||
});
|
||||
@@ -110,8 +111,8 @@ export const useTriggerSecretSyncRemoveSecrets = () => {
|
||||
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { syncId, destination }) => {
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list() });
|
||||
onSuccess: (_, { syncId, destination, projectId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list(projectId) });
|
||||
queryClient.invalidateQueries({ queryKey: secretSyncKeys.byId(destination, syncId) });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
export const secretSyncKeys = {
|
||||
all: ["secret-sync"] as const,
|
||||
options: () => [...secretSyncKeys.all, "options"] as const,
|
||||
list: () => [...secretSyncKeys.all, "list"] as const,
|
||||
list: (projectId: string) => [...secretSyncKeys.all, "list", projectId] as const,
|
||||
byId: (destination: SecretSync, syncId: string) =>
|
||||
[...secretSyncKeys.all, destination, "by-id", syncId] as const
|
||||
};
|
||||
@@ -46,6 +46,14 @@ export const useSecretSyncOption = (destination: SecretSync) => {
|
||||
return { syncOption, isPending };
|
||||
};
|
||||
|
||||
export const fetchSecretSyncsByProjectId = async (projectId: string) => {
|
||||
const { data } = await apiRequest.get<TListSecretSyncs>("/api/v1/secret-syncs", {
|
||||
params: { projectId }
|
||||
});
|
||||
|
||||
return data.secretSyncs;
|
||||
};
|
||||
|
||||
export const useListSecretSyncs = (
|
||||
projectId: string,
|
||||
options?: Omit<
|
||||
@@ -54,14 +62,8 @@ export const useListSecretSyncs = (
|
||||
>
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: secretSyncKeys.list(),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<TListSecretSyncs>("/api/v1/secret-syncs", {
|
||||
params: { projectId }
|
||||
});
|
||||
|
||||
return data.secretSyncs;
|
||||
},
|
||||
queryKey: secretSyncKeys.list(projectId),
|
||||
queryFn: () => fetchSecretSyncsByProjectId(projectId),
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
@@ -43,26 +43,31 @@ export type TUpdateSecretSyncDTO = Partial<
|
||||
> & {
|
||||
destination: SecretSync;
|
||||
syncId: string;
|
||||
projectId: string;
|
||||
};
|
||||
|
||||
export type TDeleteSecretSyncDTO = {
|
||||
destination: SecretSync;
|
||||
syncId: string;
|
||||
removeSecrets: boolean;
|
||||
projectId: string;
|
||||
};
|
||||
|
||||
export type TTriggerSecretSyncSyncSecretsDTO = {
|
||||
destination: SecretSync;
|
||||
syncId: string;
|
||||
projectId: string;
|
||||
};
|
||||
|
||||
export type TTriggerSecretSyncImportSecretsDTO = {
|
||||
destination: SecretSync;
|
||||
syncId: string;
|
||||
importBehavior: SecretSyncImportBehavior;
|
||||
projectId: string;
|
||||
};
|
||||
|
||||
export type TTriggerSecretSyncRemoveSecretsDTO = {
|
||||
destination: SecretSync;
|
||||
syncId: string;
|
||||
projectId: string;
|
||||
};
|
||||
|
||||
@@ -206,7 +206,7 @@ export const useGetWorkspaceAuthorizations = <TData = IntegrationAuth[],>(
|
||||
select
|
||||
});
|
||||
|
||||
const fetchWorkspaceIntegrations = async (workspaceId: string) => {
|
||||
export const fetchWorkspaceIntegrations = async (workspaceId: string) => {
|
||||
const { data } = await apiRequest.get<{ integrations: TIntegration[] }>(
|
||||
`/api/v1/workspace/${workspaceId}/integrations`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user