64 lines
2.6 KiB
Markdown
64 lines
2.6 KiB
Markdown
# Web admin and analytics
|
|
|
|
An Axum SSR/HTMX web frontend for the existing komp_ac gRPC backend. It provides
|
|
the browser version of the client admin panel and the ECharts analytics view.
|
|
The browser never connects to gRPC directly: Axum authenticates with an
|
|
HTTP-only cookie, creates typed Tonic requests, and returns full HTML pages or
|
|
HTMX fragments.
|
|
|
|
The backend remains the authority; this crate does not add another HTTP API to it.
|
|
|
|
## 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. The admin panel is at
|
|
<http://127.0.0.1:3000/admin> and analytics remains 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
|
|
## Admin panel
|
|
|
|
The admin panel mirrors the client workflow with browser-oriented pages:
|
|
|
|
- profile, table, and physical-column browsing;
|
|
- table creation, including indexes, links, money settings, and row labels;
|
|
- Steel table-script creation;
|
|
- field validations, reusable global rules, validation sets, and set application;
|
|
- browser CSV import with live schema validation and chunked bulk insertion;
|
|
- CSV downloads for one or multiple tables;
|
|
- login, role checks, logout, and navigation to analytics.
|
|
|
|
CSV files use the same column-header convention as the client. Multi-table CSV
|
|
files include a table-name header row before the column-name row. Browser files
|
|
are read locally and submitted to Axum; the backend is accessed only through the
|
|
existing `TablesData` gRPC service.
|
|
|
|
## Analytics
|
|
|
|
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.
|