chore: auto-commit (8 archivos)

- CMakeLists.txt
- app.md
- data_http.cpp
- data_http.h
- main.cpp
- tabs.cpp
- tabs.h
- appicon.ico

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-16 16:33:23 +02:00
parent aec22ba594
commit 4abc3f97ec
8 changed files with 586 additions and 28 deletions
+35 -1
View File
@@ -4,10 +4,13 @@
#include "core/icons_tabler.h"
#include "core/logger.h"
#include "data_http.h"
#include "http_client.h"
#include "ws_client.h"
#include "tabs.h"
#include "vendor/nlohmann/json.hpp"
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
@@ -48,6 +51,9 @@ static bool g_show_dag_list = true;
static bool g_show_dag_detail = true;
static bool g_show_run_detail = true;
static bool g_show_timeline = true;
static bool g_show_all_runs = true;
static bool g_show_health = true;
static bool g_show_function_panel = true;
// Auto-fetch DAG list una vez al arrancar.
static bool g_initial_fetched = false;
@@ -171,11 +177,36 @@ static void render() {
if (g_show_dag_detail) dag_ui_tabs::draw_dag_detail(g_api_url);
if (g_show_run_detail) dag_ui_tabs::draw_run_detail(g_api_url);
if (g_show_timeline) dag_ui_tabs::draw_timeline(g_api_url, g_runs_all);
if (g_show_all_runs) dag_ui_tabs::draw_all_runs(g_api_url, g_runs_all);
if (g_show_health) dag_ui_tabs::draw_health(g_api_url, g_runs_all);
if (g_show_main) draw_main();
if (g_show_live) draw_live();
if (g_show_function_panel) dag_ui_tabs::draw_function_panel(g_api_url, &g_show_function_panel);
}
int main(int /*argc*/, char** /*argv*/) {
// Self-test: blocking HTTP GET to the dag_engine backend, no GUI.
// Returns 0 if reachable (any 2xx), 1 otherwise.
static int run_self_test() {
HttpClient client(g_ws_host, g_ws_port);
// Probe /api/dags as a sucedaneo de /health (no dedicated /health helper).
HttpResponse resp = client.get("/api/dags");
if (resp.ok()) {
std::printf("self-test ok: dag_engine reachable at %s\n", g_api_url.c_str());
return 0;
}
std::printf("self-test fail: dag_engine unreachable at %s (status=%d)\n",
g_api_url.c_str(), resp.status);
return 1;
}
int main(int argc, char** argv) {
// CLI flag --self-test: probe backend and exit without opening GUI.
for (int i = 1; i < argc; i++) {
if (argv[i] && std::strcmp(argv[i], "--self-test") == 0) {
return run_self_test();
}
}
// Conecta WS al backend dag_engine. Reconnect con backoff lo gestiona WsClient.
g_ws.start(g_ws_host, g_ws_port, g_ws_path);
@@ -184,6 +215,9 @@ int main(int /*argc*/, char** /*argv*/) {
{ "DAG Detail", nullptr, &g_show_dag_detail },
{ "Run Detail", nullptr, &g_show_run_detail },
{ "Timeline", nullptr, &g_show_timeline },
{ "All Runs", nullptr, &g_show_all_runs },
{ "Health", nullptr, &g_show_health },
{ "Function", nullptr, &g_show_function_panel },
{ "Live (WS)", nullptr, &g_show_live },
{ "Main (diag)", nullptr, &g_show_main },
};