MCPcopy Create free account
hub / github.com/bytebase/bytebase / buildAuditLogFilter

Function buildAuditLogFilter

frontend/src/react/components/AuditLogTable.tsx:104–122  ·  view source on GitHub ↗
(params: SearchParams)

Source from the content-addressed store, hash-verified

102}
103
104function buildAuditLogFilter(params: SearchParams): AuditLogFilter {
105 const filter: AuditLogFilter = {};
106 const method = params.scopes.find((s) => s.id === "method")?.value;
107 if (method) filter.method = method;
108 const actor = params.scopes.find((s) => s.id === "actor")?.value;
109 if (actor) filter.userEmail = actor;
110 const level = params.scopes.find((s) => s.id === "level")?.value;
111 if (level)
112 filter.level = AuditLog_Severity[level as keyof typeof AuditLog_Severity];
113 const created = params.scopes.find((s) => s.id === "created")?.value;
114 if (created) {
115 const parts = created.split(",");
116 if (parts.length === 2) {
117 filter.createdTsAfter = parseInt(parts[0], 10);
118 filter.createdTsBefore = parseInt(parts[1], 10);
119 }
120 }
121 return filter;
122}
123
124// ============================================================
125// View link helper

Callers 1

AuditLogTableFunction · 0.85

Calls 1

parseIntFunction · 0.85

Tested by

no test coverage detected