addressed reviews

This commit is contained in:
x032205
2025-10-02 18:46:14 -04:00
parent 1678fba06e
commit e77c024af5
37 changed files with 1011 additions and 856 deletions

View File

@@ -73,9 +73,9 @@ export const useDeletePamResource = () => {
export const useCreatePamAccount = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: async ({ resourceId, resourceType, ...params }: TCreatePamAccountDTO) => {
mutationFn: async ({ resourceType, ...params }: TCreatePamAccountDTO) => {
const { data } = await apiRequest.post<{ account: TPamAccount }>(
`/api/v1/pam/resources/${resourceType}/${resourceId}/accounts`,
`/api/v1/pam/accounts/${resourceType}`,
params
);
@@ -90,14 +90,9 @@ export const useCreatePamAccount = () => {
export const useUpdatePamAccount = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: async ({
resourceId,
resourceType,
accountId,
...params
}: TUpdatePamAccountDTO) => {
mutationFn: async ({ resourceType, accountId, ...params }: TUpdatePamAccountDTO) => {
const { data } = await apiRequest.patch<{ account: TPamAccount }>(
`/api/v1/pam/resources/${resourceType}/${resourceId}/accounts/${accountId}`,
`/api/v1/pam/accounts/${resourceType}/${accountId}`,
params
);
@@ -112,9 +107,9 @@ export const useUpdatePamAccount = () => {
export const useDeletePamAccount = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: async ({ resourceId, resourceType, accountId }: TDeletePamAccountDTO) => {
mutationFn: async ({ resourceType, accountId }: TDeletePamAccountDTO) => {
const { data } = await apiRequest.delete<{ account: TPamAccount }>(
`/api/v1/pam/resources/${resourceType}/${resourceId}/accounts/${accountId}`
`/api/v1/pam/accounts/${resourceType}/${accountId}`
);
return data.account;

View File

@@ -72,13 +72,11 @@ export type TUpdatePamAccountDTO = Partial<
Pick<TPamAccount, "name" | "description" | "credentials">
> & {
accountId: string;
resourceId: string;
resourceType: PamResourceType;
};
export type TDeletePamAccountDTO = {
accountId: string;
resourceId: string;
resourceType: PamResourceType;
};

View File

@@ -100,7 +100,7 @@ export const LogsFilter = ({ presets, setFilter, filter, project }: Props) => {
secretEvents.includes(eventType)
);
const showSecretsSection =
project?.type !== ProjectType.PAM &&
selectedProject?.type !== ProjectType.PAM &&
(hasSecretEventFilter || currentSelectedEventTypes.length === 0);
const filteredEventTypes = useMemo(() => {

View File

@@ -16,13 +16,10 @@ type Props = {
export const PamAccessAccountModal = ({ isOpen, onOpenChange, account }: Props) => {
const [duration, setDuration] = useState("4h");
const isDurationValid = useMemo(() => ms(duration || "1s") > 0, [duration]);
const isDurationValid = useMemo(() => duration && ms(duration || "1s") > 0, [duration]);
const command = useMemo(
() =>
account
? `infisical pam access ${account.id}${duration ? ` --duration ${duration}` : ""}`
: "",
() => (account ? `infisical pam access ${account.id} --duration ${duration}` : ""),
[account, duration]
);

View File

@@ -79,7 +79,6 @@ const UpdateForm = ({ account, onComplete }: UpdateFormProps) => {
try {
const updatedAccount = await updatePamAccount.mutateAsync({
accountId: account.id,
resourceId: account.resourceId,
resourceType: account.resource.resourceType,
...formData
});

View File

@@ -1,6 +1,10 @@
import { z } from "zod";
export const BaseSqlAccountSchema = z.object({
username: z.string().trim().min(1, "Username required").max(255, "Username must be 255 characters or less"),
username: z
.string()
.trim()
.min(1, "Username required")
.max(255, "Username must be 255 characters or less"),
password: z.string().trim().min(1, "Password required")
});

View File

@@ -16,7 +16,6 @@ export const PamDeleteAccountModal = ({ isOpen, onOpenChange, account }: Props)
const {
id: accountId,
name,
resourceId,
resource: { resourceType }
} = account;
@@ -24,7 +23,6 @@ export const PamDeleteAccountModal = ({ isOpen, onOpenChange, account }: Props)
try {
await deletePamAccount.mutateAsync({
accountId,
resourceId,
resourceType
});

View File

@@ -17,7 +17,7 @@ export const PamResourceHeader = ({ resourceType, onBack }: Props) => {
/>
<div>
<div className="flex items-center text-mineshaft-300">{details.name}</div>
<p className="text-sm leading-4 text-mineshaft-400">External resource</p>
<p className="text-sm leading-4 text-mineshaft-400">Resource</p>
</div>
{onBack && (
<button

View File

@@ -15,7 +15,7 @@ export const Route = createFileRoute(
{
label: "Access Control",
link: linkOptions({
to: "/projects/secret-management/$projectId/access-management",
to: "/projects/pam/$projectId/access-management",
params: {
projectId: params.projectId
},

View File

@@ -15,7 +15,7 @@ export const Route = createFileRoute(
{
label: "Access Control",
link: linkOptions({
to: "/projects/secret-management/$projectId/access-management",
to: "/projects/pam/$projectId/access-management",
params: {
projectId: params.projectId
},

View File

@@ -15,7 +15,7 @@ export const Route = createFileRoute(
{
label: "Access Control",
link: linkOptions({
to: "/projects/secret-scanning/$projectId/access-management",
to: "/projects/pam/$projectId/access-management",
params: {
projectId: params.projectId
},

View File

@@ -15,7 +15,7 @@ export const Route = createFileRoute(
{
label: "Access Control",
link: linkOptions({
to: "/projects/secret-management/$projectId/access-management",
to: "/projects/pam/$projectId/access-management",
params: {
projectId: params.projectId
},