MCPcopy Index your code
hub / github.com/bytebase/bytebase / useColumnDefs

Function useColumnDefs

frontend/src/react/components/AuditLogTable.tsx:354–483  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

352}
353
354function useColumnDefs(): ColumnDef[] {
355 const { t } = useTranslation();
356 return useMemo(
357 () => [
358 {
359 key: "create_time",
360 title: t("audit-log.table.created-ts"),
361 defaultWidth: 220,
362 minWidth: 160,
363 resizable: true,
364 sortable: true,
365 render: (log: AuditLog) =>
366 formatAbsoluteDateTime(
367 getDateForPbTimestampProtoEs(log.createTime)?.getTime() ?? 0
368 ),
369 },
370 {
371 key: "severity",
372 title: t("audit-log.table.level"),
373 defaultWidth: 60,
374 minWidth: 50,
375 resizable: true,
376 render: (log: AuditLog) => AuditLog_Severity[log.severity],
377 },
378 {
379 key: "method",
380 title: t("audit-log.table.method"),
381 defaultWidth: 280,
382 minWidth: 150,
383 resizable: true,
384 render: (log: AuditLog) => log.method,
385 },
386 {
387 key: "actor",
388 title: t("audit-log.table.actor"),
389 defaultWidth: 200,
390 minWidth: 120,
391 resizable: true,
392 render: (log: AuditLog) => {
393 if (!log.user) return <span>-</span>;
394 const email = extractUserEmail(log.user);
395 return (
396 <a href={`mailto:${email}`} className="text-accent hover:underline">
397 {email}
398 </a>
399 );
400 },
401 },
402 {
403 key: "request",
404 title: t("audit-log.table.request"),
405 defaultWidth: 300,
406 minWidth: 180,
407 resizable: true,
408 render: (log: AuditLog) =>
409 log.request.length > 0 ? (
410 <JSONStringView jsonString={log.request} />
411 ) : (

Callers 1

AuditLogTableFunction · 0.85

Calls 5

formatAbsoluteDateTimeFunction · 0.90
extractUserEmailFunction · 0.90
humanizeDurationV1Function · 0.90
tFunction · 0.50

Tested by

no test coverage detected