feat: cliente HTTP REST + main panel demo (issue 0095 step 3)
- http_client.{h,cpp}: TCP plain (copia de registry_dashboard, sin SSL).
- data_http.{h,cpp}: API DAG (list/get/runs/trigger) + parser nlohmann/json.
- vendor/nlohmann/json.hpp: vendored.
- main.cpp: panel "Fetch /api/dags" demo, lista DAGs con schedule.
- CMakeLists.txt: anade http_client.cpp + data_http.cpp.
Build verificado. WS y tabs (data_table::render) en commits siguientes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,17 @@
|
||||
#include "core/panel_menu.h"
|
||||
#include "core/icons_tabler.h"
|
||||
#include "core/logger.h"
|
||||
// #include "viz/data_table.h" // uncomment to enable data_table::render() panel
|
||||
#include "data_http.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Config global del backend HTTP. Persistido por imgui.ini via Mantine-no-go.
|
||||
static std::string g_api_url = "http://127.0.0.1:8090";
|
||||
|
||||
// Cache en memoria del primer fetch. Tabs proximos updates via WS.
|
||||
static std::vector<dag_ui::DagInfo> g_dags;
|
||||
static std::string g_last_error;
|
||||
|
||||
// Toggles de paneles (visibles desde el menu View del menubar canonico)
|
||||
static bool g_show_main = true;
|
||||
@@ -13,7 +23,25 @@ static void draw_main() {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
ImGui::TextUnformatted("Hello from dag_engine_ui");
|
||||
ImGui::Text("API: %s", g_api_url.c_str());
|
||||
if (ImGui::Button("Fetch /api/dags")) {
|
||||
g_dags.clear();
|
||||
g_last_error.clear();
|
||||
if (!dag_ui::list_dags_http(g_api_url, g_dags)) {
|
||||
g_last_error = "list_dags_http failed (see stderr)";
|
||||
}
|
||||
}
|
||||
if (!g_last_error.empty()) {
|
||||
ImGui::TextColored(ImVec4(1, 0.4f, 0.4f, 1), "%s", g_last_error.c_str());
|
||||
}
|
||||
ImGui::Separator();
|
||||
ImGui::Text("DAGs: %zu", g_dags.size());
|
||||
for (auto& d : g_dags) {
|
||||
ImGui::BulletText("%s (%s) schedule=%s",
|
||||
d.name.c_str(),
|
||||
d.valid ? "valid" : "invalid",
|
||||
d.schedule.empty() ? "none" : d.schedule[0].c_str());
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user