mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 08:26:29 +00:00
Merge remote-tracking branch 'origin/main' into misc/approval-policy-tf-resource-prereq-1
This commit is contained in:
@@ -124,9 +124,12 @@ export const accessApprovalPolicyServiceFactory = ({
|
|||||||
const verifyAllApprovers = [...approverUserIds];
|
const verifyAllApprovers = [...approverUserIds];
|
||||||
|
|
||||||
for (const groupId of groupApprovers) {
|
for (const groupId of groupApprovers) {
|
||||||
usersPromises.push(groupDAL.findAllGroupMembers({ orgId: actorOrgId, groupId, offset: 0 }));
|
usersPromises.push(groupDAL.findAllGroupPossibleMembers({ orgId: actorOrgId, groupId, offset: 0 }));
|
||||||
}
|
}
|
||||||
const verifyGroupApprovers = (await Promise.all(usersPromises)).flat().map((user) => user.id);
|
const verifyGroupApprovers = (await Promise.all(usersPromises))
|
||||||
|
.flat()
|
||||||
|
.filter((user) => user.isPartOfGroup)
|
||||||
|
.map((user) => user.id);
|
||||||
verifyAllApprovers.push(...verifyGroupApprovers);
|
verifyAllApprovers.push(...verifyGroupApprovers);
|
||||||
|
|
||||||
await verifyApprovers({
|
await verifyApprovers({
|
||||||
@@ -312,7 +315,7 @@ export const accessApprovalPolicyServiceFactory = ({
|
|||||||
>[] = [];
|
>[] = [];
|
||||||
|
|
||||||
for (const groupId of groupApprovers) {
|
for (const groupId of groupApprovers) {
|
||||||
usersPromises.push(groupDAL.findAllGroupMembers({ orgId: actorOrgId, groupId, offset: 0 }));
|
usersPromises.push(groupDAL.findAllGroupPossibleMembers({ orgId: actorOrgId, groupId, offset: 0 }));
|
||||||
}
|
}
|
||||||
const verifyGroupApprovers = (await Promise.all(usersPromises)).flat().map((user) => user.id);
|
const verifyGroupApprovers = (await Promise.all(usersPromises)).flat().map((user) => user.id);
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ type TSecretApprovalRequestServiceFactoryDep = {
|
|||||||
TAccessApprovalRequestReviewerDALFactory,
|
TAccessApprovalRequestReviewerDALFactory,
|
||||||
"create" | "find" | "findOne" | "transaction"
|
"create" | "find" | "findOne" | "transaction"
|
||||||
>;
|
>;
|
||||||
groupDAL: Pick<TGroupDALFactory, "findAllGroupMembers">;
|
groupDAL: Pick<TGroupDALFactory, "findAllGroupPossibleMembers">;
|
||||||
projectMembershipDAL: Pick<TProjectMembershipDALFactory, "findById">;
|
projectMembershipDAL: Pick<TProjectMembershipDALFactory, "findById">;
|
||||||
smtpService: Pick<TSmtpService, "sendMail">;
|
smtpService: Pick<TSmtpService, "sendMail">;
|
||||||
userDAL: Pick<
|
userDAL: Pick<
|
||||||
@@ -145,14 +145,14 @@ export const accessApprovalRequestServiceFactory = ({
|
|||||||
const groupUsers = (
|
const groupUsers = (
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
approverGroupIds.map((groupApproverId) =>
|
approverGroupIds.map((groupApproverId) =>
|
||||||
groupDAL.findAllGroupMembers({
|
groupDAL.findAllGroupPossibleMembers({
|
||||||
orgId: actorOrgId,
|
orgId: actorOrgId,
|
||||||
groupId: groupApproverId
|
groupId: groupApproverId
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
).flat();
|
).flat();
|
||||||
approverIds.push(...groupUsers.map((user) => user.id));
|
approverIds.push(...groupUsers.filter((user) => user.isPartOfGroup).map((user) => user.id));
|
||||||
|
|
||||||
const approverUsers = await userDAL.find({
|
const approverUsers = await userDAL.find({
|
||||||
$in: {
|
$in: {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export const groupDALFactory = (db: TDbClient) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// special query
|
// special query
|
||||||
const findAllGroupMembers = async ({
|
const findAllGroupPossibleMembers = async ({
|
||||||
orgId,
|
orgId,
|
||||||
groupId,
|
groupId,
|
||||||
offset = 0,
|
offset = 0,
|
||||||
@@ -125,7 +125,7 @@ export const groupDALFactory = (db: TDbClient) => {
|
|||||||
return {
|
return {
|
||||||
findGroups,
|
findGroups,
|
||||||
findByOrgId,
|
findByOrgId,
|
||||||
findAllGroupMembers,
|
findAllGroupPossibleMembers,
|
||||||
...groupOrm
|
...groupOrm
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,7 +30,10 @@ import { TUserGroupMembershipDALFactory } from "./user-group-membership-dal";
|
|||||||
|
|
||||||
type TGroupServiceFactoryDep = {
|
type TGroupServiceFactoryDep = {
|
||||||
userDAL: Pick<TUserDALFactory, "find" | "findUserEncKeyByUserIdsBatch" | "transaction" | "findOne">;
|
userDAL: Pick<TUserDALFactory, "find" | "findUserEncKeyByUserIdsBatch" | "transaction" | "findOne">;
|
||||||
groupDAL: Pick<TGroupDALFactory, "create" | "findOne" | "update" | "delete" | "findAllGroupMembers" | "findById">;
|
groupDAL: Pick<
|
||||||
|
TGroupDALFactory,
|
||||||
|
"create" | "findOne" | "update" | "delete" | "findAllGroupPossibleMembers" | "findById"
|
||||||
|
>;
|
||||||
groupProjectDAL: Pick<TGroupProjectDALFactory, "find">;
|
groupProjectDAL: Pick<TGroupProjectDALFactory, "find">;
|
||||||
orgDAL: Pick<TOrgDALFactory, "findMembership" | "countAllOrgMembers">;
|
orgDAL: Pick<TOrgDALFactory, "findMembership" | "countAllOrgMembers">;
|
||||||
userGroupMembershipDAL: Pick<
|
userGroupMembershipDAL: Pick<
|
||||||
@@ -242,7 +245,7 @@ export const groupServiceFactory = ({
|
|||||||
message: `Failed to find group with ID ${id}`
|
message: `Failed to find group with ID ${id}`
|
||||||
});
|
});
|
||||||
|
|
||||||
const users = await groupDAL.findAllGroupMembers({
|
const users = await groupDAL.findAllGroupPossibleMembers({
|
||||||
orgId: group.orgId,
|
orgId: group.orgId,
|
||||||
groupId: group.id,
|
groupId: group.id,
|
||||||
offset,
|
offset,
|
||||||
|
|||||||
@@ -75,7 +75,14 @@ type TScimServiceFactoryDep = {
|
|||||||
projectMembershipDAL: Pick<TProjectMembershipDALFactory, "find" | "delete" | "findProjectMembershipsByUserId">;
|
projectMembershipDAL: Pick<TProjectMembershipDALFactory, "find" | "delete" | "findProjectMembershipsByUserId">;
|
||||||
groupDAL: Pick<
|
groupDAL: Pick<
|
||||||
TGroupDALFactory,
|
TGroupDALFactory,
|
||||||
"create" | "findOne" | "findAllGroupMembers" | "delete" | "findGroups" | "transaction" | "updateById" | "update"
|
| "create"
|
||||||
|
| "findOne"
|
||||||
|
| "findAllGroupPossibleMembers"
|
||||||
|
| "delete"
|
||||||
|
| "findGroups"
|
||||||
|
| "transaction"
|
||||||
|
| "updateById"
|
||||||
|
| "update"
|
||||||
>;
|
>;
|
||||||
groupProjectDAL: Pick<TGroupProjectDALFactory, "find">;
|
groupProjectDAL: Pick<TGroupProjectDALFactory, "find">;
|
||||||
userGroupMembershipDAL: Pick<
|
userGroupMembershipDAL: Pick<
|
||||||
@@ -775,7 +782,7 @@ export const scimServiceFactory = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const users = await groupDAL.findAllGroupMembers({
|
const users = await groupDAL.findAllGroupPossibleMembers({
|
||||||
orgId: group.orgId,
|
orgId: group.orgId,
|
||||||
groupId: group.id
|
groupId: group.id
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,3 +9,8 @@ export const removeTrailingSlash = (str: string) => {
|
|||||||
|
|
||||||
return str.endsWith("/") ? str.slice(0, -1) : str;
|
return str.endsWith("/") ? str.slice(0, -1) : str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const prefixWithSlash = (str: string) => {
|
||||||
|
if (str.startsWith("/")) return str;
|
||||||
|
return `/${str}`;
|
||||||
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|||||||
import { SecretFoldersSchema } from "@app/db/schemas";
|
import { SecretFoldersSchema } from "@app/db/schemas";
|
||||||
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
||||||
import { FOLDERS } from "@app/lib/api-docs";
|
import { FOLDERS } from "@app/lib/api-docs";
|
||||||
import { removeTrailingSlash } from "@app/lib/fn";
|
import { prefixWithSlash, removeTrailingSlash } from "@app/lib/fn";
|
||||||
import { readLimit, secretsLimit } from "@app/server/config/rateLimiter";
|
import { readLimit, secretsLimit } from "@app/server/config/rateLimiter";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
@@ -26,9 +26,21 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
workspaceId: z.string().trim().describe(FOLDERS.CREATE.workspaceId),
|
workspaceId: z.string().trim().describe(FOLDERS.CREATE.workspaceId),
|
||||||
environment: z.string().trim().describe(FOLDERS.CREATE.environment),
|
environment: z.string().trim().describe(FOLDERS.CREATE.environment),
|
||||||
name: z.string().trim().describe(FOLDERS.CREATE.name),
|
name: z.string().trim().describe(FOLDERS.CREATE.name),
|
||||||
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(FOLDERS.CREATE.path),
|
path: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.default("/")
|
||||||
|
.transform(prefixWithSlash)
|
||||||
|
.transform(removeTrailingSlash)
|
||||||
|
.describe(FOLDERS.CREATE.path),
|
||||||
// backward compatiability with cli
|
// backward compatiability with cli
|
||||||
directory: z.string().trim().default("/").transform(removeTrailingSlash).describe(FOLDERS.CREATE.directory)
|
directory: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.default("/")
|
||||||
|
.transform(prefixWithSlash)
|
||||||
|
.transform(removeTrailingSlash)
|
||||||
|
.describe(FOLDERS.CREATE.directory)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
@@ -86,9 +98,21 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
workspaceId: z.string().trim().describe(FOLDERS.UPDATE.workspaceId),
|
workspaceId: z.string().trim().describe(FOLDERS.UPDATE.workspaceId),
|
||||||
environment: z.string().trim().describe(FOLDERS.UPDATE.environment),
|
environment: z.string().trim().describe(FOLDERS.UPDATE.environment),
|
||||||
name: z.string().trim().describe(FOLDERS.UPDATE.name),
|
name: z.string().trim().describe(FOLDERS.UPDATE.name),
|
||||||
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(FOLDERS.UPDATE.path),
|
path: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.default("/")
|
||||||
|
.transform(prefixWithSlash)
|
||||||
|
.transform(removeTrailingSlash)
|
||||||
|
.describe(FOLDERS.UPDATE.path),
|
||||||
// backward compatiability with cli
|
// backward compatiability with cli
|
||||||
directory: z.string().trim().default("/").transform(removeTrailingSlash).describe(FOLDERS.UPDATE.directory)
|
directory: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.default("/")
|
||||||
|
.transform(prefixWithSlash)
|
||||||
|
.transform(removeTrailingSlash)
|
||||||
|
.describe(FOLDERS.UPDATE.directory)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
@@ -147,7 +171,13 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
id: z.string().describe(FOLDERS.UPDATE.folderId),
|
id: z.string().describe(FOLDERS.UPDATE.folderId),
|
||||||
environment: z.string().trim().describe(FOLDERS.UPDATE.environment),
|
environment: z.string().trim().describe(FOLDERS.UPDATE.environment),
|
||||||
name: z.string().trim().describe(FOLDERS.UPDATE.name),
|
name: z.string().trim().describe(FOLDERS.UPDATE.name),
|
||||||
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(FOLDERS.UPDATE.path)
|
path: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.default("/")
|
||||||
|
.transform(prefixWithSlash)
|
||||||
|
.transform(removeTrailingSlash)
|
||||||
|
.describe(FOLDERS.UPDATE.path)
|
||||||
})
|
})
|
||||||
.array()
|
.array()
|
||||||
.min(1)
|
.min(1)
|
||||||
@@ -211,9 +241,21 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
body: z.object({
|
body: z.object({
|
||||||
workspaceId: z.string().trim().describe(FOLDERS.DELETE.workspaceId),
|
workspaceId: z.string().trim().describe(FOLDERS.DELETE.workspaceId),
|
||||||
environment: z.string().trim().describe(FOLDERS.DELETE.environment),
|
environment: z.string().trim().describe(FOLDERS.DELETE.environment),
|
||||||
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(FOLDERS.DELETE.path),
|
path: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.default("/")
|
||||||
|
.transform(prefixWithSlash)
|
||||||
|
.transform(removeTrailingSlash)
|
||||||
|
.describe(FOLDERS.DELETE.path),
|
||||||
// keep this here as cli need directory
|
// keep this here as cli need directory
|
||||||
directory: z.string().trim().default("/").transform(removeTrailingSlash).describe(FOLDERS.DELETE.directory)
|
directory: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.default("/")
|
||||||
|
.transform(prefixWithSlash)
|
||||||
|
.transform(removeTrailingSlash)
|
||||||
|
.describe(FOLDERS.DELETE.directory)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
@@ -267,9 +309,21 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
querystring: z.object({
|
querystring: z.object({
|
||||||
workspaceId: z.string().trim().describe(FOLDERS.LIST.workspaceId),
|
workspaceId: z.string().trim().describe(FOLDERS.LIST.workspaceId),
|
||||||
environment: z.string().trim().describe(FOLDERS.LIST.environment),
|
environment: z.string().trim().describe(FOLDERS.LIST.environment),
|
||||||
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(FOLDERS.LIST.path),
|
path: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.default("/")
|
||||||
|
.transform(prefixWithSlash)
|
||||||
|
.transform(removeTrailingSlash)
|
||||||
|
.describe(FOLDERS.LIST.path),
|
||||||
// backward compatiability with cli
|
// backward compatiability with cli
|
||||||
directory: z.string().trim().default("/").transform(removeTrailingSlash).describe(FOLDERS.LIST.directory)
|
directory: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.default("/")
|
||||||
|
.transform(prefixWithSlash)
|
||||||
|
.transform(removeTrailingSlash)
|
||||||
|
.describe(FOLDERS.LIST.directory)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { TPermissionServiceFactory } from "@app/ee/services/permission/permissio
|
|||||||
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
||||||
import { TProjectUserAdditionalPrivilegeDALFactory } from "@app/ee/services/project-user-additional-privilege/project-user-additional-privilege-dal";
|
import { TProjectUserAdditionalPrivilegeDALFactory } from "@app/ee/services/project-user-additional-privilege/project-user-additional-privilege-dal";
|
||||||
import { getConfig } from "@app/lib/config/env";
|
import { getConfig } from "@app/lib/config/env";
|
||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError, NotFoundError } from "@app/lib/errors";
|
||||||
import { groupBy } from "@app/lib/fn";
|
import { groupBy } from "@app/lib/fn";
|
||||||
|
|
||||||
import { TUserGroupMembershipDALFactory } from "../../ee/services/group/user-group-membership-dal";
|
import { TUserGroupMembershipDALFactory } from "../../ee/services/group/user-group-membership-dal";
|
||||||
@@ -129,7 +129,7 @@ export const projectMembershipServiceFactory = ({
|
|||||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member);
|
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Member);
|
||||||
|
|
||||||
const [membership] = await projectMembershipDAL.findAllProjectMembers(projectId, { username });
|
const [membership] = await projectMembershipDAL.findAllProjectMembers(projectId, { username });
|
||||||
if (!membership) throw new BadRequestError({ message: `Project membership not found for user ${username}` });
|
if (!membership) throw new NotFoundError({ message: `Project membership not found for user ${username}` });
|
||||||
return membership;
|
return membership;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -189,6 +189,22 @@ export const useGetImportedSecretsAllEnvs = ({
|
|||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getEnvImportedSecretKeyCount = useCallback(
|
||||||
|
(env: string) => {
|
||||||
|
const selectedEnvIndex = environments.indexOf(env);
|
||||||
|
let totalSecrets = 0;
|
||||||
|
|
||||||
|
if (selectedEnvIndex !== -1) {
|
||||||
|
secretImports?.[selectedEnvIndex]?.data?.forEach((secret) => {
|
||||||
|
totalSecrets += secret.secrets.length;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return totalSecrets;
|
||||||
|
},
|
||||||
|
[(secretImports || []).map((response) => response.data)]
|
||||||
|
);
|
||||||
|
|
||||||
const isImportedSecretPresentInEnv = useCallback(
|
const isImportedSecretPresentInEnv = useCallback(
|
||||||
(envSlug: string, secretName: string) => {
|
(envSlug: string, secretName: string) => {
|
||||||
const selectedEnvIndex = environments.indexOf(envSlug);
|
const selectedEnvIndex = environments.indexOf(envSlug);
|
||||||
@@ -226,7 +242,12 @@ export const useGetImportedSecretsAllEnvs = ({
|
|||||||
[(secretImports || []).map((response) => response.data)]
|
[(secretImports || []).map((response) => response.data)]
|
||||||
);
|
);
|
||||||
|
|
||||||
return { secretImports, isImportedSecretPresentInEnv, getImportedSecretByKey };
|
return {
|
||||||
|
secretImports,
|
||||||
|
isImportedSecretPresentInEnv,
|
||||||
|
getImportedSecretByKey,
|
||||||
|
getEnvImportedSecretKeyCount
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useGetImportedFoldersByEnv = ({
|
export const useGetImportedFoldersByEnv = ({
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { NoticeBanner } from "@app/components/v2";
|
||||||
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
|
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
|
||||||
import { withPermission } from "@app/hoc";
|
import { withPermission } from "@app/hoc";
|
||||||
|
|
||||||
@@ -10,6 +11,14 @@ export const AuditLogsPage = withPermission(
|
|||||||
<div className="w-full max-w-7xl px-6">
|
<div className="w-full max-w-7xl px-6">
|
||||||
<div className="bg-bunker-800 py-6">
|
<div className="bg-bunker-800 py-6">
|
||||||
<p className="text-3xl font-semibold text-gray-200">Audit Logs</p>
|
<p className="text-3xl font-semibold text-gray-200">Audit Logs</p>
|
||||||
|
{(window.location.origin.includes("https://app.infisical.com") ||
|
||||||
|
window.location.origin.includes("https://gamma.infisical.com")) && (
|
||||||
|
<NoticeBanner title="The audit logs page is in maintenance" className="mt-4">
|
||||||
|
We are currently working on improving the performance of querying audit logs.
|
||||||
|
However, please note that audit logs are still being published as usual, so there’s
|
||||||
|
no disruption to log generation.
|
||||||
|
</NoticeBanner>
|
||||||
|
)}
|
||||||
<div />
|
<div />
|
||||||
</div>
|
</div>
|
||||||
<LogsSection filterClassName="static p-2" showFilters isOrgAuditLogs />
|
<LogsSection filterClassName="static p-2" showFilters isOrgAuditLogs />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable no-nested-ternary */
|
/* eslint-disable no-nested-ternary */
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Control, Controller, UseFormReset, UseFormWatch } from "react-hook-form";
|
import { Control, Controller, UseFormReset, UseFormSetValue, UseFormWatch } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
faCheckCircle,
|
faCheckCircle,
|
||||||
faChevronDown,
|
faChevronDown,
|
||||||
@@ -41,6 +41,7 @@ type Props = {
|
|||||||
};
|
};
|
||||||
className?: string;
|
className?: string;
|
||||||
isOrgAuditLogs?: boolean;
|
isOrgAuditLogs?: boolean;
|
||||||
|
setValue: UseFormSetValue<AuditLogFilterFormData>;
|
||||||
control: Control<AuditLogFilterFormData>;
|
control: Control<AuditLogFilterFormData>;
|
||||||
reset: UseFormReset<AuditLogFilterFormData>;
|
reset: UseFormReset<AuditLogFilterFormData>;
|
||||||
watch: UseFormWatch<AuditLogFilterFormData>;
|
watch: UseFormWatch<AuditLogFilterFormData>;
|
||||||
@@ -51,6 +52,7 @@ export const LogsFilter = ({
|
|||||||
isOrgAuditLogs,
|
isOrgAuditLogs,
|
||||||
className,
|
className,
|
||||||
control,
|
control,
|
||||||
|
setValue,
|
||||||
reset,
|
reset,
|
||||||
watch
|
watch
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
@@ -60,6 +62,12 @@ export const LogsFilter = ({
|
|||||||
const { currentWorkspace, workspaces } = useWorkspace();
|
const { currentWorkspace, workspaces } = useWorkspace();
|
||||||
const { data, isLoading } = useGetAuditLogActorFilterOpts(currentWorkspace?.id ?? "");
|
const { data, isLoading } = useGetAuditLogActorFilterOpts(currentWorkspace?.id ?? "");
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (workspaces.length) {
|
||||||
|
setValue("projectId", workspaces[0].id);
|
||||||
|
}
|
||||||
|
}, [workspaces]);
|
||||||
|
|
||||||
const renderActorSelectItem = (actor: Actor) => {
|
const renderActorSelectItem = (actor: Actor) => {
|
||||||
switch (actor.type) {
|
switch (actor.type) {
|
||||||
case ActorType.USER:
|
case ActorType.USER:
|
||||||
@@ -243,20 +251,14 @@ export const LogsFilter = ({
|
|||||||
className="w-40"
|
className="w-40"
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
value={value === undefined ? "all" : value}
|
value={value}
|
||||||
{...field}
|
{...field}
|
||||||
onValueChange={(e) => {
|
onValueChange={(e) => onChange(e)}
|
||||||
if (e === "all") onChange(undefined);
|
|
||||||
else onChange(e);
|
|
||||||
}}
|
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
"w-full border border-mineshaft-500 bg-mineshaft-700 text-mineshaft-100",
|
"w-full border border-mineshaft-500 bg-mineshaft-700 text-mineshaft-100",
|
||||||
value === undefined && "text-mineshaft-400"
|
value === undefined && "text-mineshaft-400"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<SelectItem value="all" key="all">
|
|
||||||
All projects
|
|
||||||
</SelectItem>
|
|
||||||
{workspaces.map((project) => (
|
{workspaces.map((project) => (
|
||||||
<SelectItem value={String(project.id || "")} key={project.id}>
|
<SelectItem value={String(project.id || "")} key={project.id}>
|
||||||
{project.name}
|
{project.name}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const LogsSection = ({
|
|||||||
|
|
||||||
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
|
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
|
||||||
|
|
||||||
const { control, reset, watch } = useForm<AuditLogFilterFormData>({
|
const { control, reset, watch, setValue } = useForm<AuditLogFilterFormData>({
|
||||||
resolver: yupResolver(auditLogFilterFormSchema),
|
resolver: yupResolver(auditLogFilterFormSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
projectId: undefined,
|
projectId: undefined,
|
||||||
@@ -79,6 +79,7 @@ export const LogsSection = ({
|
|||||||
className={filterClassName}
|
className={filterClassName}
|
||||||
presets={presets}
|
presets={presets}
|
||||||
control={control}
|
control={control}
|
||||||
|
setValue={setValue}
|
||||||
watch={watch}
|
watch={watch}
|
||||||
reset={reset}
|
reset={reset}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -207,11 +207,12 @@ export const SecretOverviewPage = () => {
|
|||||||
setVisibleEnvs(readableEnvs);
|
setVisibleEnvs(readableEnvs);
|
||||||
}, [userAvailableEnvs, secretPath]);
|
}, [userAvailableEnvs, secretPath]);
|
||||||
|
|
||||||
const { isImportedSecretPresentInEnv, getImportedSecretByKey } = useGetImportedSecretsAllEnvs({
|
const { isImportedSecretPresentInEnv, getImportedSecretByKey, getEnvImportedSecretKeyCount } =
|
||||||
projectId: workspaceId,
|
useGetImportedSecretsAllEnvs({
|
||||||
path: secretPath,
|
projectId: workspaceId,
|
||||||
environments: userAvailableEnvs.map(({ slug }) => slug)
|
path: secretPath,
|
||||||
});
|
environments: userAvailableEnvs.map(({ slug }) => slug)
|
||||||
|
});
|
||||||
|
|
||||||
const paginationOffset = (page - 1) * perPage;
|
const paginationOffset = (page - 1) * perPage;
|
||||||
|
|
||||||
@@ -784,7 +785,9 @@ export const SecretOverviewPage = () => {
|
|||||||
</Th>
|
</Th>
|
||||||
{visibleEnvs?.map(({ name, slug }, index) => {
|
{visibleEnvs?.map(({ name, slug }, index) => {
|
||||||
const envSecKeyCount = getEnvSecretKeyCount(slug);
|
const envSecKeyCount = getEnvSecretKeyCount(slug);
|
||||||
const missingKeyCount = secKeys.length - envSecKeyCount;
|
const importedSecKeyCount = getEnvImportedSecretKeyCount(slug);
|
||||||
|
const missingKeyCount = secKeys.length - envSecKeyCount - importedSecKeyCount;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Th
|
<Th
|
||||||
className="min-table-row min-w-[11rem] border-b-0 p-0 text-center"
|
className="min-table-row min-w-[11rem] border-b-0 p-0 text-center"
|
||||||
|
|||||||
Reference in New Issue
Block a user