feat(dashboard): show host for gongfoo runners in gitea view
Some checks failed
build / check (push) Waiting to run
build / clippy (push) Has been cancelled
build / test (push) Has been cancelled
build / fmt (push) Has been cancelled

Cross-reference gongfoo runner names against the runners table to
look up their host. Shows the short hostname in a new column for
managed runners, dash for external runners.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 12:34:09 +03:00
parent f8d4a9a7ea
commit 59a36e61b7
4 changed files with 39 additions and 9 deletions

View File

@@ -614,16 +614,36 @@ pub async fn handle_gitea_runners(State(state): State<Arc<DashboardState>>) -> i
}
};
// Build a runner_name → hostname lookup for gongfoo-managed runners.
let host_map: std::collections::HashMap<String, String> =
sqlx::query_as::<_, (String, String)>(
r#"
SELECT r.runner_name, h.hostname
FROM runners r
JOIN hosts h ON h.id = r.host_id
WHERE r.state IN ('pending','spawning','started','registered','running')
"#,
)
.fetch_all(&state.pool)
.await
.unwrap_or_default()
.into_iter()
.collect();
let result: Vec<DashboardGiteaRunner> = runners
.into_iter()
.map(|r| DashboardGiteaRunner {
gitea_id: r.id,
managed: r.name.starts_with("gf-"),
labels: r.labels.into_iter().map(|l| l.name).collect(),
name: r.name,
status: r.status,
busy: r.busy,
ephemeral: r.ephemeral,
.map(|r| {
let host = host_map.get(&r.name).cloned();
DashboardGiteaRunner {
gitea_id: r.id,
managed: r.name.starts_with("gf-"),
labels: r.labels.into_iter().map(|l| l.name).collect(),
name: r.name,
status: r.status,
busy: r.busy,
ephemeral: r.ephemeral,
host,
}
})
.collect();

View File

@@ -94,6 +94,7 @@ pub struct DashboardGiteaRunner {
pub ephemeral: bool,
pub labels: Vec<String>,
pub managed: bool,
pub host: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]

View File

@@ -61,6 +61,7 @@ export function GiteaRunnersView() {
<tr>
<th>name</th>
<th>type</th>
<th>host</th>
<th>status</th>
<th>labels</th>
<th>busy</th>
@@ -80,6 +81,13 @@ export function GiteaRunnersView() {
<span style={{ color: "#f59e0b" }}>external</span>
)}
</td>
<td>
{r.host ? (
<span>{r.host.split(".")[0]}</span>
) : (
<span style={{ color: "#4b5563" }}></span>
)}
</td>
<td>
<span
style={{
@@ -107,7 +115,7 @@ export function GiteaRunnersView() {
))}
{filtered.length === 0 && (
<tr>
<td colSpan={5} style={{ textAlign: "center", color: "#6b7280" }}>
<td colSpan={6} style={{ textAlign: "center", color: "#6b7280" }}>
no runners
</td>
</tr>

View File

@@ -80,6 +80,7 @@ export interface DashboardGiteaRunner {
ephemeral: boolean;
labels: string[];
managed: boolean;
host: string | null;
}
export interface DashboardScalingEntry {