feat(table): vista tabla por tipo de entidad (issue 0004)

- entity_ops: entity_list_rows (bulk pull id/name/type_ref/status/updated_at).
- AppState::TableRow + cache + filtros (search substring + show_all toggle).
- views_table: tabs por type_ref (alfabetico) o tabla unica con todos los
  tipos. ImGui::BeginTable con sort + clipper para >10k filas. Click en
  Selectable selecciona el nodo en el viewport (clear + add via
  graph_viewport_*).
- views_table_refresh_indices: degree + node_idx por user_data hash.
- main.cpp: panel "Table" en g_panels; cache build tras load_input y
  reload_after_mutation.
This commit is contained in:
2026-05-01 01:05:03 +02:00
parent 078947a2b8
commit 84afa4ce70
6 changed files with 339 additions and 1 deletions
+32
View File
@@ -137,6 +137,26 @@ struct AppState {
std::vector<std::string> insp_tag_suggestions;
std::vector<std::string> insp_type_options;
// ---- Table view (issue 0004) -------------------------------------------
// Vista tabular dockeable. Tabs por type_ref del grafo activo + opcional
// "All". Click selecciona el nodo en el viewport (mismo flujo que el
// Selectable del Inspector).
struct TableRow {
std::string id;
std::string name;
std::string type_ref;
std::string status;
std::string updated_at;
int neighbors = 0;
int node_idx = -1;
};
bool panel_table = false;
std::vector<TableRow> table_rows; // snapshot, refrescado tras load/reload
bool table_cache_dirty = true;
char table_search_buf[96] = {};
bool table_show_all = false;
int table_active_tab = 0;
// ---- Type Editor (issue 0007) ------------------------------------------
// Draft del editor de tipos. Se inicializa con una copia de parsed_types
// tras cargar el grafo. Save reescribe `types.yaml` y dispara
@@ -223,6 +243,18 @@ EntityRecord views_inspector_build_record(const AppState& app);
// al cambiar de proyecto.
void views_inspector_clear_draft(AppState& app);
// ---- Table view (issue 0004) --------------------------------------------
// Renderiza el panel "Table". Lee de app.table_rows; el caller ya ha hecho el
// build/refresh tras cargar el grafo. Click en fila selecciona el nodo en el
// viewport (mismo flujo que el Selectable del Inspector). Filtro por
// substring sobre name/id en la cabecera.
void views_table(AppState& app);
// Recompute neighbors[] y node_idx[] de las filas existentes a partir del
// grafo cargado. Llamar tras cargar el grafo o tras una mutacion.
void views_table_refresh_indices(AppState& app);
// ---- Type Editor (issue 0007) -------------------------------------------
// Renderiza el panel "Types" — tabs Entities/Relations, lista a la izquierda