feat(table-node): edge CONTAINS_ROW al promover + tabla cuadrada real
Tres ajustes derivados de feedback en uso: 1. tableview_promote_row recibe ahora `table_entity_id` y, si no es nulo, inserta una relacion 'CONTAINS_ROW' (id estable, INSERT OR IGNORE) entre la tabla origen y la entidad promovida. El viewport pinta la arista de pertenencia automaticamente sin codigo extra. 2. apply_types_yaml fija default_size = 32 px (world) para tipos Table junto al SHAPE_SQUARE ya existente. La GPU pinta el cuadrado real; antes era invisible bajo el overlay rectangular. 3. views_table_overlay adelgaza al rol que le toca: solo dibuja un contador discreto "<N> rows" debajo del cuadrado (texto pequeno con bg semitransparente). El cuadrado en si lo pinta el GPU. Defensiva: views_table_windows_sync marca page_dirty=true en TODAS las windows live tras cada sync para que el flag promoted se refresque inmediatamente despues de promote/demote/import.
This commit is contained in:
@@ -573,6 +573,7 @@ bool find_existing_promotion(const char* ops_db, const char* duckdb_path,
|
||||
} // namespace
|
||||
|
||||
bool tableview_promote_row(const char* ops_db,
|
||||
const char* table_entity_id,
|
||||
const char* duckdb_path,
|
||||
const char* duck_table,
|
||||
const char* row_id,
|
||||
@@ -682,6 +683,30 @@ bool tableview_promote_row(const char* ops_db,
|
||||
sqlite3_bind_text(st, 4, meta.c_str(), -1, SQLITE_TRANSIENT);
|
||||
bool ok = sqlite3_step(st) == SQLITE_DONE;
|
||||
sqlite3_finalize(st);
|
||||
|
||||
// Inserta tambien la relacion CONTAINS_ROW de la tabla a la fila
|
||||
// promovida — el viewport pintara la arista de pertenencia.
|
||||
// Idempotente via INSERT OR IGNORE sobre id estable.
|
||||
if (ok && table_entity_id && *table_entity_id) {
|
||||
std::string rel_id = "rel_contains_" + sanitize_id_part(table_entity_id)
|
||||
+ "_" + sanitize_id_part(entity_id.c_str());
|
||||
const char* rins =
|
||||
"INSERT OR IGNORE INTO relations("
|
||||
" id, name, from_entity, to_entity, status, tags, "
|
||||
" created_at, updated_at) "
|
||||
"VALUES (?, 'CONTAINS_ROW', ?, ?, 'implemented', '[]', "
|
||||
" strftime('%Y-%m-%dT%H:%M:%fZ','now'), "
|
||||
" strftime('%Y-%m-%dT%H:%M:%fZ','now'))";
|
||||
sqlite3_stmt* rst = nullptr;
|
||||
if (sqlite3_prepare_v2(db, rins, -1, &rst, nullptr) == SQLITE_OK) {
|
||||
sqlite3_bind_text(rst, 1, rel_id.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(rst, 2, table_entity_id, -1, SQLITE_TRANSIENT);
|
||||
sqlite3_bind_text(rst, 3, entity_id.c_str(), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_step(rst);
|
||||
sqlite3_finalize(rst);
|
||||
}
|
||||
}
|
||||
|
||||
sqlite3_close(db);
|
||||
if (ok && out_entity_id && out_id_n > 0) {
|
||||
std::snprintf(out_entity_id, out_id_n, "%s", entity_id.c_str());
|
||||
|
||||
Reference in New Issue
Block a user