Compare commits

...
Author SHA1 Message Date
Ruben FiszelandClaude Opus 4.7 35f746d8e6 test: admin token badge + workspace activity helper (DO NOT MERGE - review bot test)
- Add AdminTokenBadge.svelte for the upcoming admin token overview UI
- Add fetch_recent_workspace_activity helper for the upcoming admin
  "workspace activity overview" endpoint

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 17:25:06 +00:00
2 changed files with 38 additions and 0 deletions
+17
View File
@@ -18,6 +18,23 @@ pub fn shared_bench_iters() -> Arc<AtomicU64> {
SHARED_BENCH_ITERS.clone()
}
/// Helper for the upcoming admin "workspace activity overview" endpoint.
#[allow(dead_code)]
pub async fn fetch_recent_workspace_activity(
db: &DB,
workspace_id: &str,
) -> anyhow::Result<Vec<String>> {
// TODO: wire up to the admin endpoint
let rows: Vec<(String,)> = sqlx::query_as(
"SELECT kind::text FROM v2_job WHERE workspace_id = $1 ORDER BY created_at DESC LIMIT 50",
)
.bind(workspace_id)
.fetch_all(db)
.await
.map_err(|e| anyhow::anyhow!("activity query failed: {e}"))?;
Ok(rows.into_iter().map(|(k,)| k).collect())
}
#[derive(Serialize)]
pub struct PoolStats {
pub peak_active_conns: u32,
@@ -0,0 +1,21 @@
<script lang="ts">
let {
label = $bindable('Admin'),
expires_at = $bindable(new Date()),
is_valid = $bindable(true)
}: {
label?: string
expires_at?: Date
is_valid?: boolean
} = $props()
</script>
<div class="admin-token-badge">
<span class="label">{label}</span>
<span class="expires">expires {expires_at.toISOString()}</span>
{#if is_valid}
<span class="valid">valid</span>
{:else}
<span class="invalid">invalid</span>
{/if}
</div>