feat: 5 puntitos de status en DAG List (R1..R5 columnas Badge)
- data_http: parsea last_runs[] del /api/dags y guarda d.last_runs_status (max 5, mas reciente primero). - tabs.cpp DAG List: 5 columnas R1..R5 con CellRenderer::Badge + BadgeRule por status (success=verde, failed=rojo, running=amarillo, pending/cancelled=gris, "-"=tenue). - main.cpp: g_refresh_pending. WS auto-trigger refresh /api/dags cuando ve un run con status terminal -> last_runs se actualiza sin pulsar nada. - main + tabs: extern "C" dag_list_request_refresh() para el boton Refresh manual. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,12 @@ static bool g_show_run_detail = true;
|
||||
|
||||
// Auto-fetch DAG list una vez al arrancar.
|
||||
static bool g_initial_fetched = false;
|
||||
// Flag set by tabs::draw_dag_list cuando el usuario pulsa Refresh, o cuando
|
||||
// WS notifica que un run termino (status != running) — re-fetch /api/dags
|
||||
// para actualizar last_runs.
|
||||
static bool g_refresh_pending = false;
|
||||
|
||||
extern "C" void dag_list_request_refresh() { g_refresh_pending = true; }
|
||||
|
||||
// Upsert por id en g_live_runs.
|
||||
static void upsert_live_run(const dag_ui::DagRunRow& r) {
|
||||
@@ -69,6 +75,12 @@ static void parse_ws_payload(const std::string& payload) {
|
||||
r.finished_at = rj.value("finished_at", "");
|
||||
r.error = rj.value("error", "");
|
||||
upsert_live_run(r);
|
||||
// Cuando un run termina, refresca DAG List para que last_runs
|
||||
// refleje la nueva ejecucion en R1..R5.
|
||||
if (r.status == "success" || r.status == "failed" ||
|
||||
r.status == "cancelled") {
|
||||
g_refresh_pending = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,9 +134,10 @@ static void draw_live() {
|
||||
}
|
||||
|
||||
static void render() {
|
||||
// Auto-fetch DAGs on first frame.
|
||||
if (!g_initial_fetched) {
|
||||
// Auto-fetch DAGs on first frame or on explicit refresh.
|
||||
if (!g_initial_fetched || g_refresh_pending) {
|
||||
g_initial_fetched = true;
|
||||
g_refresh_pending = false;
|
||||
dag_ui::list_dags_http(g_api_url, g_dags);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user