Skip to content

feat: Export Data UI (browser download) + UI static MIME fix#180

Merged
jung-thomas merged 13 commits into
mainfrom
export-ui
Jul 13, 2026
Merged

feat: Export Data UI (browser download) + UI static MIME fix#180
jung-thomas merged 13 commits into
mainfrom
export-ui

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Summary

Adds an Export Data UI to the hana-cli web app (hana-cli ui), mirroring the existing hana-cli export CLI command and delivering the result as a browser download. Also fixes a blank-page/MIME bug in the UI static route, and folds in two pre-existing local changes (a schema-propagation fix and VSCode extension packaging).

Export UI (main feature)

  • New Export view in the sidebar — the "Import / Convert" group is relabeled "Import / Export / Convert" and gains an Export entry beside Import and Mass Convert.
  • GET /hana/export route streams the query result back as a file attachment (CSV / Excel / JSON), following the existing /excel route pattern.
  • Shared serializers — the CSV/Excel/JSON serializers in bin/export.js are refactored into pure buffer-returning functions used by both the CLI and the new route (one source of truth).
  • hana-cli exportUI launcher — opens the browser directly on the Export screen (mirrors importUI).
  • Options exposed: table, schema, format, columns, limit, and CSV delimiter / include-headers / null-value.

Security

where and orderby were intentionally not implemented (an automated security review flagged raw SQL fragments; they were removed rather than hardened). Identifier inputs (schema, table, each columns entry) are validated with the project's sqlInjection.isAcceptableParameter() guard before any DB connection, and limit is integer-validated (rejects < 1). A final whole-branch review fuzzed the guard (~25 payloads) and found no residual injection surface.

Also included

  • fix(ui): blank page / MIME error — the SPA catch-all served index.html (as text/html) for missing /ui/* assets after a rebuild, so browsers rejected the HTML as a JS module. The fallback now 404s for paths with a file extension, and index.html is served no-cache so new asset hashes are always picked up. Regression tests added.
  • fix(connections): propagate HANA_CLI_SCHEMA — in the MCP/VSCode direct-connection path the container schema wasn't propagated, leaving CURRENT_SCHEMA empty so schema-filtered commands (tables, views, …) returned no rows. Now set on connect (and cleared on connection switch). Regression tests added.
  • chore(vscode): packaging — adds a package:vscode npm script, bumps the extension to 0.1.1 and sap-hdb-promisfied to 2.202607.1.

Testing

  • All 70 tests covering the changed code pass: export serializers (9), export route incl. success paths via esmock (9), static route (11), connections (39), alias-conflict guardrails (2).
  • Vue app type-checks (vue-tsc) and builds cleanly.
  • ⚠️ Not run: the live end-to-end download against a real HANA database (no live connection in this environment). The route is covered by mocked-DB tests, but the real download flow has not been manually exercised.
  • Note: the full npm test run shows 25 pre-existing failures in environmental E2E/UI tests (server-launch-with-browser, wdio browser global, live-DB systemInfo assertions). This branch modifies none of those test files; they fail independently of these changes.

Design & plan docs

  • Spec: docs/superpowers/specs/2026-07-13-export-ui-design.md
  • Plan: docs/superpowers/plans/2026-07-13-export-ui.md

The SPA catch-all served index.html (text/html) for any unmatched /ui/*
path, including missing hashed assets after a rebuild. Browsers then
rejected the HTML as a JS module (MIME error) and rendered a blank page.

- SPA fallback now falls through to 404 for paths with a file extension
- index.html served with Cache-Control: no-cache so new asset hashes are
  always picked up

Adds regression tests covering both behaviors.
…ds return rows

In the MCP/VSCode direct-connection path, the container/default schema was
not propagated, so CURRENT_SCHEMA stayed the empty HDI runtime user schema
and schema-filtered commands (tables, views, ...) returned no rows.

- utils/connections.js: set hana.schema from HANA_CLI_SCHEMA when present
- vscode-extension lifecycle: set HANA_CLI_SCHEMA from the connection, and
  clear any stale value when the new connection has no schema
- add regression tests covering set/unset/propagate cases
@jung-thomas
jung-thomas merged commit 8dfe503 into main Jul 13, 2026
19 of 20 checks passed
@jung-thomas
jung-thomas deleted the export-ui branch July 13, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant