40 lines
1.6 KiB
Markdown
40 lines
1.6 KiB
Markdown
# Analytics graphs
|
|
|
|
A small Rust web server that logs in through `AuthService.Login`, forwards SQL
|
|
queries to `AnalyticsService.ExecuteAnalyticsQuery`, and displays the streamed
|
|
result with HTMX, Alpine.js, and ECharts.
|
|
|
|
## Run
|
|
|
|
The web UI is a library started by the main server; it is no longer a standalone
|
|
binary. From the parent workspace, start the server normally:
|
|
|
|
```sh
|
|
cargo run -p server -- server
|
|
```
|
|
|
|
Open <http://127.0.0.1:3000/login> to log in, then use the analytics page at
|
|
<http://127.0.0.1:3000>. The access token is kept in an HTTP-only cookie. The default gRPC endpoint is
|
|
`http://[::1]:50051`. Both addresses can be changed:
|
|
|
|
```sh
|
|
ANALYTICS_GRPC_ENDPOINT=http://127.0.0.1:50051 \
|
|
LISTEN_ADDRESS=127.0.0.1:8080 \
|
|
cargo run -p server -- server
|
|
```
|
|
|
|
The first SQL result column is used for category labels. Bar and line charts use
|
|
all remaining columns as numeric series, pie uses the second column, and scatter
|
|
uses the first two columns. Table view displays every returned value.
|
|
|
|
The profile selector is populated automatically through
|
|
`TableDefinition.GetProfileTree`. Choosing a profile fetches its live public
|
|
analytics catalog. The sidebar shows tables, columns, types, and links and can
|
|
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, 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.
|