mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 14:27:30 +00:00
Requested changes
This commit is contained in:
@@ -48,6 +48,10 @@ export const auditLogDALFactory = (db: TDbClient) => {
|
|||||||
},
|
},
|
||||||
tx?: Knex
|
tx?: Knex
|
||||||
) => {
|
) => {
|
||||||
|
if (!orgId && !projectId) {
|
||||||
|
throw new Error("Either orgId or projectId must be provided");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Find statements
|
// Find statements
|
||||||
const sqlQuery = (tx || db.replicaNode())(TableName.AuditLog)
|
const sqlQuery = (tx || db.replicaNode())(TableName.AuditLog)
|
||||||
@@ -59,11 +63,12 @@ export const auditLogDALFactory = (db: TDbClient) => {
|
|||||||
} else if (projectId) {
|
} else if (projectId) {
|
||||||
void this.where(`${TableName.AuditLog}.projectId`, projectId);
|
void this.where(`${TableName.AuditLog}.projectId`, projectId);
|
||||||
}
|
}
|
||||||
if (userAgentType) {
|
|
||||||
void this.where(`${TableName.AuditLog}.userAgentType`, userAgentType);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (userAgentType) {
|
||||||
|
void sqlQuery.where("userAgentType", userAgentType);
|
||||||
|
}
|
||||||
|
|
||||||
// Select statements
|
// Select statements
|
||||||
void sqlQuery
|
void sqlQuery
|
||||||
.select(selectAllTableCols(TableName.AuditLog))
|
.select(selectAllTableCols(TableName.AuditLog))
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ export const LogsFilter = ({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{isOrgAuditLogs && workspaces.length && (
|
{isOrgAuditLogs && workspaces.length > 0 && (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="projectId"
|
name="projectId"
|
||||||
|
|||||||
@@ -41,8 +41,16 @@ export const LogsTable = ({
|
|||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { currentWorkspace } = useWorkspace();
|
const { currentWorkspace } = useWorkspace();
|
||||||
|
|
||||||
|
// Determine the project ID for filtering
|
||||||
const filterProjectId =
|
const filterProjectId =
|
||||||
filter?.projectId ?? (!isOrgAuditLogs ? currentWorkspace?.id ?? "" : null);
|
// Use the projectId from the filter if it exists
|
||||||
|
filter?.projectId ??
|
||||||
|
// Otherwise, if we're not looking at org-wide audit logs
|
||||||
|
(!isOrgAuditLogs
|
||||||
|
? // Use the current workspace ID (or an empty string if that's null)
|
||||||
|
currentWorkspace?.id ?? ""
|
||||||
|
: // For org-wide audit logs, use null (no specific project filter)
|
||||||
|
null);
|
||||||
|
|
||||||
const { data, isLoading, isFetchingNextPage, hasNextPage, fetchNextPage } = useGetAuditLogs(
|
const { data, isLoading, isFetchingNextPage, hasNextPage, fetchNextPage } = useGetAuditLogs(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user