Files
tiennm99 b710537f63 refactor(keys): rename openrouter_key_hash to openrouter_delete_hash
The column holds OpenRouter's delete handle (data.hash) used to revoke a key,
not a hash of the key. Migration 0003 renames the column; update repository,
admin revoke action, and the reconcile script.
2026-06-14 14:14:20 +07:00

52 lines
1.3 KiB
JavaScript

import { AdminKeyRowActions } from "./admin-key-row-actions";
/**
* Admin table: username, full key, status, created date. The full raw key is
* shown here intentionally (admin-only, gated route). The delete handle
* (`openrouter_delete_hash`) is never rendered.
*
* @param {{ rows: import('@/lib/keys/api-keys-repository').ApiKeyRow[] }} props
*/
export function AdminKeysTable({ rows }) {
if (!rows.length) {
return (
<div className="panel">
<p className="muted">No keys match.</p>
</div>
);
}
return (
<div className="panel">
<table className="table">
<thead>
<tr>
<th>Username</th>
<th>Key</th>
<th>Status</th>
<th>Created</th>
<th />
</tr>
</thead>
<tbody>
{rows.map((row) => (
<tr key={row.id}>
<td>@{row.github_username}</td>
<td>
<code>{row.openrouter_key ?? "—"}</code>
</td>
<td>{row.status}</td>
<td className="muted">
{new Date(row.created_at).toISOString().slice(0, 10)}
</td>
<td>
<AdminKeyRowActions id={row.id} />
</td>
</tr>
))}
</tbody>
</table>
</div>
);
}