mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-13 19:29:54 +00:00
feat(infisical-pg): fixing minor compatiability issues with frontend and backend on identity
This commit is contained in:
@@ -63,7 +63,7 @@ const AddTagPopoverContent = ({
|
||||
<div className="ml-7 flex items-center gap-3">
|
||||
<div
|
||||
className="h-[10px] w-[10px] rounded-full"
|
||||
style={{ background: wsTag?.tagColor ? wsTag.tagColor : "#bec2c8" }}
|
||||
style={{ background: wsTag?.color ? wsTag.color : "#bec2c8" }}
|
||||
>
|
||||
{" "}
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export enum IdentityAuthMethod {
|
||||
UNIVERSAL_AUTH = "universal-auth"
|
||||
}
|
||||
UNIVERSAL_AUTH = "universal"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export type IntegrationAuth = {
|
||||
id: string;
|
||||
integration: string;
|
||||
workspace: string;
|
||||
projectId: string;
|
||||
__v: number;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
|
||||
@@ -11,8 +11,9 @@ export type TCloudIntegration = {
|
||||
|
||||
export type TIntegration = {
|
||||
id: string;
|
||||
workspace: string;
|
||||
environment: string;
|
||||
projectId: string;
|
||||
envId: string;
|
||||
environment: { slug: string; name: string; id: string };
|
||||
isActive: boolean;
|
||||
url: any;
|
||||
app: string;
|
||||
|
||||
@@ -15,7 +15,7 @@ const serviceTokenKeys = {
|
||||
|
||||
const fetchWorkspaceServiceTokens = async (workspaceID: string) => {
|
||||
const { data } = await apiRequest.get<{ serviceTokenData: ServiceToken[] }>(
|
||||
`/api/v2/workspace/${workspaceID}/service-token-data`
|
||||
`/api/v1/workspace/${workspaceID}/service-token-data`
|
||||
);
|
||||
|
||||
return data.serviceTokenData;
|
||||
@@ -29,10 +29,11 @@ export const useGetUserWsServiceTokens = ({ workspaceID }: UseGetWorkspaceServic
|
||||
queryFn: () => fetchWorkspaceServiceTokens(workspaceID),
|
||||
enabled: Boolean(workspaceID)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// mutation
|
||||
export const useCreateServiceToken = () => { // TODO: deprecate
|
||||
export const useCreateServiceToken = () => {
|
||||
// TODO: deprecate
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<CreateServiceTokenRes, {}, CreateServiceTokenDTO>({
|
||||
@@ -41,8 +42,8 @@ export const useCreateServiceToken = () => { // TODO: deprecate
|
||||
data.serviceToken += `.${body.randomBytes}`;
|
||||
return data;
|
||||
},
|
||||
onSuccess: ({ serviceTokenData: { workspace } }) => {
|
||||
queryClient.invalidateQueries(serviceTokenKeys.getAllWorkspaceServiceToken(workspace));
|
||||
onSuccess: ({ serviceTokenData: { projectId } }) => {
|
||||
queryClient.invalidateQueries(serviceTokenKeys.getAllWorkspaceServiceToken(projectId));
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -55,8 +56,8 @@ export const useDeleteServiceToken = () => {
|
||||
const { data } = await apiRequest.delete(`/api/v2/service-token/${serviceTokenId}`);
|
||||
return data;
|
||||
},
|
||||
onSuccess: ({ serviceTokenData: { workspace } }) => {
|
||||
queryClient.invalidateQueries(serviceTokenKeys.getAllWorkspaceServiceToken(workspace));
|
||||
onSuccess: ({ serviceTokenData: { projectId } }) => {
|
||||
queryClient.invalidateQueries(serviceTokenKeys.getAllWorkspaceServiceToken(projectId));
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ export type ServiceTokenScope = {
|
||||
export type ServiceToken = {
|
||||
id: string;
|
||||
name: string;
|
||||
workspace: string;
|
||||
projectId: string;
|
||||
scopes: ServiceTokenScope[];
|
||||
user: string;
|
||||
expiresAt: string;
|
||||
|
||||
@@ -2,13 +2,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import {
|
||||
CreateTagDTO,
|
||||
CreateTagRes,
|
||||
DeleteTagDTO,
|
||||
DeleteWsTagRes,
|
||||
UserWsTags,
|
||||
} from "./types";
|
||||
import { CreateTagDTO, DeleteTagDTO, UserWsTags, WsTag } from "./types";
|
||||
|
||||
const workspaceTags = {
|
||||
getWsTags: (workspaceID: string) => ["workspace-tags", { workspaceID }] as const
|
||||
@@ -16,7 +10,7 @@ const workspaceTags = {
|
||||
|
||||
const fetchWsTag = async (workspaceID: string) => {
|
||||
const { data } = await apiRequest.get<{ workspaceTags: UserWsTags }>(
|
||||
`/api/v2/workspace/${workspaceID}/tags`
|
||||
`/api/v1/workspace/${workspaceID}/tags`
|
||||
);
|
||||
|
||||
return data.workspaceTags;
|
||||
@@ -28,38 +22,41 @@ export const useGetWsTags = (workspaceID: string) => {
|
||||
queryFn: () => fetchWsTag(workspaceID),
|
||||
enabled: Boolean(workspaceID)
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const useCreateWsTag = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<CreateTagRes, {}, CreateTagDTO>({
|
||||
return useMutation<WsTag, {}, CreateTagDTO>({
|
||||
mutationFn: async ({ workspaceID, tagName, tagColor, tagSlug }) => {
|
||||
const { data } = await apiRequest.post(`/api/v2/workspace/${workspaceID}/tags`, {
|
||||
name: tagName,
|
||||
tagColor: tagColor || "",
|
||||
slug: tagSlug
|
||||
})
|
||||
return data;
|
||||
const { data } = await apiRequest.post<{ workspaceTag: WsTag }>(
|
||||
`/api/v1/workspace/${workspaceID}/tags`,
|
||||
{
|
||||
name: tagName,
|
||||
color: tagColor || "",
|
||||
slug: tagSlug
|
||||
}
|
||||
);
|
||||
return data.workspaceTag;
|
||||
},
|
||||
onSuccess: (tagData) => {
|
||||
queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.workspace));
|
||||
queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.projectId));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export const useDeleteWsTag = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<DeleteWsTagRes, {}, DeleteTagDTO>({
|
||||
mutationFn: async ({ tagID }) => {
|
||||
const { data } = await apiRequest.delete(`/api/v2/workspace/tags/${tagID}`);
|
||||
return data
|
||||
return useMutation<WsTag, {}, DeleteTagDTO>({
|
||||
mutationFn: async ({ tagID, projectId }) => {
|
||||
const { data } = await apiRequest.delete<{ workspaceTag: WsTag }>(
|
||||
`/api/v1/workspace/${projectId}/tags/${tagID}`
|
||||
);
|
||||
return data.workspaceTag;
|
||||
},
|
||||
onSuccess: (tagData) => {
|
||||
queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.workspace));
|
||||
queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.projectId));
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -4,8 +4,8 @@ export type WsTag = {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
tagColor?: string;
|
||||
workspace: string;
|
||||
color?: string;
|
||||
projectId: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
__v: number;
|
||||
@@ -20,26 +20,7 @@ export type CreateTagDTO = {
|
||||
tagColor: string;
|
||||
};
|
||||
|
||||
export type CreateTagRes = {
|
||||
name: string;
|
||||
slug: string;
|
||||
workspace: string;
|
||||
createdAt: string;
|
||||
tagColor?: string;
|
||||
user: string;
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type DeleteTagDTO = { tagID: string };
|
||||
|
||||
export type DeleteWsTagRes = {
|
||||
name: string;
|
||||
slug: string;
|
||||
workspace: string;
|
||||
createdAt: string;
|
||||
user: string;
|
||||
id: string;
|
||||
};
|
||||
export type DeleteTagDTO = { tagID: string; projectId: string };
|
||||
|
||||
export type SecretTags = {
|
||||
id: string;
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
export type TWebhook = {
|
||||
id: string;
|
||||
workspace: string;
|
||||
environment: string;
|
||||
projectId: string;
|
||||
environment: {
|
||||
slug: string;
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
envId: string;
|
||||
secretPath: string;
|
||||
url: string;
|
||||
lastStatus: "success" | "failed";
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ export const IntegrationsSection = ({
|
||||
<div>
|
||||
<FormControl label="Environment">
|
||||
<Select
|
||||
value={integration.environment}
|
||||
value={integration.environment.slug}
|
||||
isDisabled={integration.isActive}
|
||||
className="min-w-[8rem] border border-mineshaft-700"
|
||||
>
|
||||
|
||||
+6
-6
@@ -97,14 +97,14 @@ export const SecretApprovalRequestChangeItem = ({
|
||||
</Td>
|
||||
<Td>{secretVersion?.comment}</Td>
|
||||
<Td>
|
||||
{secretVersion?.tags?.map(({ name, id: tagId, tagColor }) => (
|
||||
{secretVersion?.tags?.map(({ name, id: tagId, color }) => (
|
||||
<Tag
|
||||
className="flex w-min items-center space-x-2"
|
||||
key={`${secretVersion.id}-${tagId}`}
|
||||
>
|
||||
<div
|
||||
className="h-3 w-3 rounded-full"
|
||||
style={{ backgroundColor: tagColor || "#bec2c8" }}
|
||||
style={{ backgroundColor: color || "#bec2c8" }}
|
||||
/>
|
||||
<div className="text-sm">{name}</div>
|
||||
</Tag>
|
||||
@@ -119,14 +119,14 @@ export const SecretApprovalRequestChangeItem = ({
|
||||
</Td>
|
||||
<Td>{newVersion?.secretComment}</Td>
|
||||
<Td>
|
||||
{newVersion?.tags?.map(({ name, id: tagId, tagColor }) => (
|
||||
{newVersion?.tags?.map(({ name, id: tagId, color }) => (
|
||||
<Tag
|
||||
className="flex w-min items-center space-x-2"
|
||||
key={`${newVersion.id}-${tagId}`}
|
||||
>
|
||||
<div
|
||||
className="h-3 w-3 rounded-full"
|
||||
style={{ backgroundColor: tagColor || "#bec2c8" }}
|
||||
style={{ backgroundColor: color || "#bec2c8" }}
|
||||
/>
|
||||
<div className="text-sm">{name}</div>
|
||||
</Tag>
|
||||
@@ -151,7 +151,7 @@ export const SecretApprovalRequestChangeItem = ({
|
||||
</Td>
|
||||
<Td>
|
||||
{(op === CommitType.CREATE ? newVersion?.tags : secretVersion?.tags)?.map(
|
||||
({ name, id: tagId, tagColor }) => (
|
||||
({ name, id: tagId, color}) => (
|
||||
<Tag
|
||||
className="flex w-min items-center space-x-2"
|
||||
key={`${
|
||||
@@ -160,7 +160,7 @@ export const SecretApprovalRequestChangeItem = ({
|
||||
>
|
||||
<div
|
||||
className="h-3 w-3 rounded-full"
|
||||
style={{ backgroundColor: tagColor || "#bec2c8" }}
|
||||
style={{ backgroundColor: color || "#bec2c8" }}
|
||||
/>
|
||||
<div className="text-sm">{name}</div>
|
||||
</Tag>
|
||||
|
||||
@@ -233,7 +233,7 @@ export const ActionBar = ({
|
||||
</DropdownSubMenuTrigger>
|
||||
<DropdownSubMenuContent className="rounded-l-none">
|
||||
<DropdownMenuLabel>Apply tags to filter secrets</DropdownMenuLabel>
|
||||
{tags.map(({ id, name, tagColor }) => (
|
||||
{tags.map(({ id, name, color }) => (
|
||||
<DropdownMenuItem
|
||||
onClick={(evt) => {
|
||||
evt.preventDefault();
|
||||
@@ -246,7 +246,7 @@ export const ActionBar = ({
|
||||
<div className="flex items-center">
|
||||
<div
|
||||
className="mr-2 h-2 w-2 rounded-full"
|
||||
style={{ background: tagColor || "#bec2c8" }}
|
||||
style={{ background: color || "#bec2c8" }}
|
||||
/>
|
||||
{name}
|
||||
</div>
|
||||
|
||||
@@ -269,7 +269,7 @@ export const SecretDetailSidebar = ({
|
||||
<DropdownMenuContent align="end" className="z-[100]">
|
||||
<DropdownMenuLabel>Apply tags to this secrets</DropdownMenuLabel>
|
||||
{tags.map((tag) => {
|
||||
const { id: tagId, name, tagColor } = tag;
|
||||
const { id: tagId, name, color } = tag;
|
||||
|
||||
const isSelected = selectedTagsGroupById?.[tagId];
|
||||
return (
|
||||
@@ -282,7 +282,7 @@ export const SecretDetailSidebar = ({
|
||||
<div className="flex items-center">
|
||||
<div
|
||||
className="mr-2 h-2 w-2 rounded-full"
|
||||
style={{ background: tagColor || "#bec2c8" }}
|
||||
style={{ background: color || "#bec2c8" }}
|
||||
/>
|
||||
{name}
|
||||
</div>
|
||||
|
||||
@@ -319,7 +319,7 @@ export const SecretItem = memo(
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuLabel>Apply tags to this secrets</DropdownMenuLabel>
|
||||
{tags.map((tag) => {
|
||||
const { id: tagId, name, tagColor } = tag;
|
||||
const { id: tagId, name, color } = tag;
|
||||
|
||||
const isTagSelected = selectedTagsGroupById?.[tagId];
|
||||
return (
|
||||
@@ -332,7 +332,7 @@ export const SecretItem = memo(
|
||||
<div className="flex items-center">
|
||||
<div
|
||||
className="mr-2 h-2 w-2 rounded-full"
|
||||
style={{ background: tagColor || "#bec2c8" }}
|
||||
style={{ background: color || "#bec2c8" }}
|
||||
/>
|
||||
{name}
|
||||
</div>
|
||||
|
||||
@@ -151,14 +151,14 @@ export const SecretItem = ({ mode, preSecret, postSecret }: Props) => {
|
||||
<Td className="border-r border-mineshaft-600">Tags</Td>
|
||||
{isModified && (
|
||||
<Td className="border-r border-mineshaft-600">
|
||||
{preSecret?.tags?.map(({ name, id: tagId, tagColor }) => (
|
||||
{preSecret?.tags?.map(({ name, id: tagId, color }) => (
|
||||
<Tag
|
||||
className="flex w-min items-center space-x-2"
|
||||
key={`${preSecret.id}-${tagId}`}
|
||||
>
|
||||
<div
|
||||
className="h-3 w-3 rounded-full"
|
||||
style={{ backgroundColor: tagColor || "#bec2c8" }}
|
||||
style={{ backgroundColor: color || "#bec2c8" }}
|
||||
/>
|
||||
<div className="text-sm">{name}</div>
|
||||
</Tag>
|
||||
@@ -166,14 +166,14 @@ export const SecretItem = ({ mode, preSecret, postSecret }: Props) => {
|
||||
</Td>
|
||||
)}
|
||||
<Td>
|
||||
{postSecret?.tags?.map(({ name, id: tagId, tagColor }) => (
|
||||
{postSecret?.tags?.map(({ name, id: tagId, color }) => (
|
||||
<Tag
|
||||
className="flex w-min items-center space-x-2"
|
||||
key={`${postSecret.id}-${tagId}`}
|
||||
>
|
||||
<div
|
||||
className="h-3 w-3 rounded-full"
|
||||
style={{ backgroundColor: tagColor || "#bec2c8" }}
|
||||
style={{ backgroundColor: color || "#bec2c8" }}
|
||||
/>
|
||||
<div className="text-sm">{name}</div>
|
||||
</Tag>
|
||||
|
||||
+3
-1
@@ -4,7 +4,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
||||
import { PermissionDeniedBanner, ProjectPermissionCan } from "@app/components/permissions";
|
||||
import { Button, DeleteActionModal } from "@app/components/v2";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub, useProjectPermission } from "@app/context";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub, useProjectPermission, useWorkspace } from "@app/context";
|
||||
import { usePopUp } from "@app/hooks";
|
||||
import { useDeleteWsTag } from "@app/hooks/api";
|
||||
|
||||
@@ -19,6 +19,7 @@ export const SecretTagsSection = (): JSX.Element => {
|
||||
"CreateSecretTag",
|
||||
"deleteTagConfirmation"
|
||||
] as const);
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const permission = useProjectPermission();
|
||||
|
||||
const deleteWsTag = useDeleteWsTag();
|
||||
@@ -26,6 +27,7 @@ export const SecretTagsSection = (): JSX.Element => {
|
||||
const onDeleteApproved = async () => {
|
||||
try {
|
||||
await deleteWsTag.mutateAsync({
|
||||
projectId:currentWorkspace?.id || "",
|
||||
tagID: (popUp?.deleteTagConfirmation?.data as DeleteModalData)?.id
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ export const WebhooksTab = withProjectPermission(
|
||||
<Td className="max-w-xs overflow-hidden text-ellipsis hover:overflow-auto hover:break-all">
|
||||
{url}
|
||||
</Td>
|
||||
<Td>{environment}</Td>
|
||||
<Td>{environment.slug}</Td>
|
||||
<Td>{secretPath}</Td>
|
||||
<Td>
|
||||
{!lastStatus ? (
|
||||
|
||||
Reference in New Issue
Block a user