chore: auto-commit (23 archivos)
- CMakeLists.txt - app.md - appicon.ico - main.cpp - perf_tests.cpp - perf_tests.h - qa_panel.cpp - qa_panel.h - qa_state.cpp - qa_state.h - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
// tab_renderers — 1 columna por cada CellRenderer.
|
||||
// Sirve como referencia visual de TODOS los renderers en una misma tabla.
|
||||
#include "tabs.h"
|
||||
#include "qa_state.h"
|
||||
#include "data_table/data_table.h"
|
||||
#include <imgui.h>
|
||||
|
||||
namespace tables_qa::tabs {
|
||||
|
||||
namespace {
|
||||
qa::TabState g_st;
|
||||
|
||||
void seed() {
|
||||
g_st.back = {
|
||||
"1","ok", "0.75","350", "ok", "Run", "ok,ok,error", "go", "1500",
|
||||
"2","error", "0.30","1800","error", "Stop", "ok,error,ok", "py", "4200",
|
||||
"3","running","0.55","750", "pending","Cancel","ok,ok,ok,ok", "cpp","950",
|
||||
"4","pending","0.10","2500","ok", "Retry", "error,error,ok", "go", "5500",
|
||||
};
|
||||
qa::rebuild_ptrs(g_st);
|
||||
}
|
||||
} // anon
|
||||
|
||||
void render_renderers() {
|
||||
if (g_st.back.empty()) seed();
|
||||
const auto& t = qa::toggles();
|
||||
|
||||
data_table::TableInput tbl;
|
||||
tbl.name = "renderers";
|
||||
tbl.headers = {"id", "badge", "progress", "duration_ms", "icon",
|
||||
"button", "dots", "categorical", "color_scale"};
|
||||
tbl.types = {
|
||||
data_table::ColumnType::Int,
|
||||
data_table::ColumnType::String,
|
||||
data_table::ColumnType::Float,
|
||||
data_table::ColumnType::Float,
|
||||
data_table::ColumnType::String,
|
||||
data_table::ColumnType::String,
|
||||
data_table::ColumnType::String,
|
||||
data_table::ColumnType::String,
|
||||
data_table::ColumnType::Float,
|
||||
};
|
||||
tbl.cells = g_st.ptrs.data();
|
||||
tbl.rows = 4;
|
||||
tbl.cols = 9;
|
||||
|
||||
tbl.column_specs.resize(tbl.cols);
|
||||
for (int i = 0; i < tbl.cols; i++) tbl.column_specs[i].id = tbl.headers[i];
|
||||
|
||||
if (t.enable_badges) {
|
||||
auto& cs = tbl.column_specs[1];
|
||||
cs.renderer = data_table::CellRenderer::Badge;
|
||||
cs.badges = {
|
||||
{"ok", "#22c55e", ""},
|
||||
{"error", "#ef4444", "ERR"},
|
||||
{"running", "#f59e0b", ""},
|
||||
{"pending", "#a3a3a3", ""},
|
||||
};
|
||||
}
|
||||
{
|
||||
auto& cs = tbl.column_specs[2];
|
||||
cs.renderer = data_table::CellRenderer::Progress;
|
||||
cs.progress_scale_100 = false;
|
||||
cs.progress_color_hex = "#3b82f6";
|
||||
}
|
||||
if (t.enable_duration) {
|
||||
auto& cs = tbl.column_specs[3];
|
||||
cs.renderer = data_table::CellRenderer::Duration;
|
||||
cs.duration_warn_ms = 1000.0f;
|
||||
cs.duration_error_ms = 5000.0f;
|
||||
}
|
||||
if (t.enable_icon) {
|
||||
auto& cs = tbl.column_specs[4];
|
||||
cs.renderer = data_table::CellRenderer::Icon;
|
||||
cs.icon_map = {
|
||||
{"ok", "TI_CHECK", "#22c55e"},
|
||||
{"error", "TI_X", "#ef4444"},
|
||||
{"pending", "TI_CIRCLE", "#a3a3a3"},
|
||||
};
|
||||
}
|
||||
if (t.enable_buttons) {
|
||||
auto& cs = tbl.column_specs[5];
|
||||
cs.renderer = data_table::CellRenderer::Button;
|
||||
cs.button_action = "demo_action";
|
||||
cs.button_color_hex = "#3b82f6";
|
||||
}
|
||||
if (t.enable_dots) {
|
||||
auto& cs = tbl.column_specs[6];
|
||||
cs.renderer = data_table::CellRenderer::Dots;
|
||||
cs.badges = {
|
||||
{"ok", "#22c55e", ""},
|
||||
{"error", "#ef4444", ""},
|
||||
};
|
||||
cs.dots_separator = ',';
|
||||
cs.dots_show_count = false;
|
||||
}
|
||||
if (t.enable_categorical) {
|
||||
auto& cs = tbl.column_specs[7];
|
||||
cs.renderer = data_table::CellRenderer::CategoricalChip;
|
||||
cs.chips = {
|
||||
{"go", "#3b82f6"},
|
||||
{"py", "#22c55e"},
|
||||
{"cpp", "#a855f7"},
|
||||
};
|
||||
}
|
||||
if (t.enable_color_scale) {
|
||||
auto& cs = tbl.column_specs[8];
|
||||
cs.renderer = data_table::CellRenderer::ColorScale;
|
||||
cs.range_min = 0.0;
|
||||
cs.range_max = 6000.0;
|
||||
cs.range_alpha = 0.30f;
|
||||
}
|
||||
if (t.enable_tooltip) {
|
||||
tbl.column_specs[3].tooltip = "auto";
|
||||
tbl.column_specs[3].tooltip_on_hover = true;
|
||||
}
|
||||
|
||||
ImGui::BeginChild("##renderers_host", ImVec2(-1, -1));
|
||||
g_st.last_events.clear();
|
||||
data_table::render("##renderers_tbl", {tbl}, g_st.dt,
|
||||
&g_st.last_events, t.show_chrome);
|
||||
ImGui::EndChild();
|
||||
qa::consume_events(g_st.last_events);
|
||||
}
|
||||
|
||||
} // namespace tables_qa::tabs
|
||||
Reference in New Issue
Block a user