feat(dashboard): show host for gongfoo runners in gitea view
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:
@@ -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();
|
||||
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -80,6 +80,7 @@ export interface DashboardGiteaRunner {
|
||||
ephemeral: boolean;
|
||||
labels: string[];
|
||||
managed: boolean;
|
||||
host: string | null;
|
||||
}
|
||||
|
||||
export interface DashboardScalingEntry {
|
||||
|
||||
Reference in New Issue
Block a user