feat(data-table): add column visibility storage functionality for API keys, channels, and usage logs
This commit is contained in:
@@ -49,6 +49,13 @@ const logTypeRowTint: Record<number, string> = {
|
||||
[LOG_TYPE_ENUM.REFUND]: 'bg-blue-50/30 dark:bg-blue-950/15',
|
||||
}
|
||||
|
||||
function getColumnVisibilityStorageKey(
|
||||
logCategory: LogCategory,
|
||||
isAdmin: boolean
|
||||
): string {
|
||||
return `usage-logs:${logCategory}:${isAdmin ? 'admin' : 'user'}:column-visibility`
|
||||
}
|
||||
|
||||
function deserializeLogTypeFilter(value: unknown): unknown[] {
|
||||
const values = Array.isArray(value) ? value : value ? [value] : []
|
||||
return values.filter((item) => String(item) !== LOG_TYPE_ALL_VALUE)
|
||||
@@ -146,6 +153,10 @@ export function UsageLogsTable({ logCategory }: UsageLogsTableProps) {
|
||||
data: logs as Record<string, unknown>[],
|
||||
columns: columns as ColumnDef<Record<string, unknown>>[],
|
||||
columnFilters,
|
||||
columnVisibilityStorageKey: getColumnVisibilityStorageKey(
|
||||
logCategory,
|
||||
isAdmin
|
||||
),
|
||||
pagination,
|
||||
enableRowSelection: false,
|
||||
onPaginationChange,
|
||||
|
||||
Reference in New Issue
Block a user