From 52d10640717057bffadb3de7da9104380af74a0f Mon Sep 17 00:00:00 2001 From: Priec Date: Thu, 16 Jul 2026 00:51:13 +0200 Subject: [PATCH] htmx datafusion graphs via echarts3 - no custom scripts, only alpinejs --- graphs/README.md | 7 ++++--- graphs/src/main.rs | 20 ++++++++++++-------- graphs/static/index.html | 33 ++++----------------------------- 3 files changed, 20 insertions(+), 40 deletions(-) diff --git a/graphs/README.md b/graphs/README.md index 9740e97..aa4a523 100644 --- a/graphs/README.md +++ b/graphs/README.md @@ -2,7 +2,7 @@ A small Rust web server that logs in through `AuthService.Login`, forwards SQL queries to `AnalyticsService.ExecuteAnalyticsQuery`, and displays the streamed -result with HTMX and ECharts. +result with HTMX, Alpine.js, and ECharts. ## Run @@ -33,5 +33,6 @@ create starter queries. Its **LLM schema context** section generates a complete text summary that can be copied into an LLM prompt to request a valid analytics SQL query. -HTMX and ECharts are loaded from jsDelivr, so the browser needs network access -when opening the page. +HTMX, Alpine.js, and ECharts are loaded from jsDelivr, so the browser needs +network access when opening the page. HTMX owns server communication and fragment +swaps; Alpine is limited to browser-local editor, clipboard, and chart behavior. diff --git a/graphs/src/main.rs b/graphs/src/main.rs index 1f61133..0ed76f2 100644 --- a/graphs/src/main.rs +++ b/graphs/src/main.rs @@ -404,11 +404,12 @@ fn render_result(result: &QueryOutput, chart_type: &str) -> Html { } _ => return error_fragment("Unknown chart type"), }; - let safe_option = option.to_string().replace('<', "\\u003c"); + let option = escape_html(&option.to_string()); Html(format!( - "

{metadata}

\ - " + "

{metadata}

\ +
" )) } @@ -429,9 +430,10 @@ fn render_catalog(catalog: &GetAnalyticsCatalogResponse) -> Html {
\ LLM schema context\

Copy this entire text and include it when asking an LLM to write a query.

\ - \ - \ - \ + \ + \ + Copied\
", catalog.tables.len(), escape_html(&llm_context), @@ -453,7 +455,8 @@ fn render_catalog_table(table: &AnalyticsTable) -> String { details.push_str(&format!(", rounding {}", column.rounding)); } format!( - "
  • {}
  • ", + "
  • {}
  • ", escape_html("e_identifier(&column.name)), escape_html(&column.name), escape_html(&details), @@ -489,7 +492,8 @@ fn render_catalog_table(table: &AnalyticsTable) -> String { format!( "
    \ {}{currency}\ - \ + \
      {columns}
    {links}\
    ", escape_html(&table.name), diff --git a/graphs/static/index.html b/graphs/static/index.html index d2593bc..f68c5ae 100644 --- a/graphs/static/index.html +++ b/graphs/static/index.html @@ -6,8 +6,10 @@ Analytics graphs + -
    +

    Analytics graphs

    Login
    @@ -95,7 +97,7 @@
    - +
    Running… @@ -106,32 +108,5 @@
    -