Skip to content

Fix/4041 Nav bug & dependency documentation#4043

Merged
jonpspri merged 3 commits intomainfrom
fix/4041-dependency-documentation
Apr 11, 2026
Merged

Fix/4041 Nav bug & dependency documentation#4043
jonpspri merged 3 commits intomainfrom
fix/4041-dependency-documentation

Conversation

@a-effort
Copy link
Copy Markdown
Collaborator

@a-effort a-effort commented Apr 3, 2026

🔗 Related Issue

Closes #4041


📝 Summary

The Admin UI has been non-functional on a clean checkout since #3137 introduced the Vite build system. That PR removed the hand-written admin.js and replaced it with ES modules bundled by Vite, but never committed the compiled output. With no bundle-*.js present, the server logs a startup error, serves a broken script tag, and the entire window.Admin namespace is missing, leaving every tab navigation call as an uncaught ReferenceError and rendering every URL as the overview panel.

This PR commits the initial Vite bundle and manifest so the admin UI works on a clean checkout, and updates the setup documentation (README.md, docs/docs/development/building.md, AGENTS.md) to make the required npm install && npm run vite:build step explicit for contributors working from source.


🏷️ Type of Change

  • Bug fix
  • Documentation

🧪 Verification

Check Command Status
Lint suite make lint N/A — no Python changes
Unit tests make test N/A — no Python changes
Coverage ≥ 80% make coverage N/A — no Python changes

✅ Checklist

  • Code formatted (make black isort pre-commit)
  • Tests added/updated for changes
  • Documentation updated (if applicable)
  • No secrets or credentials committed

📓 Notes (optional)

Fixes #4041 Admin UI tab navigation broken on clean checkout.

What broke

PR #3137 replaced mcpgateway/static/admin.js with a Vite-bundled build under mcpgateway/admin_ui/, but the compiled output was never built or committed. On a clean checkout mcpgateway/static/bundle-*.js does not exist, so:

  1. get_bundle_js_filename() in admin.py returns "" and logs an error.
  2. The HTML renders <script src="/static/"> — a 404.
  3. window.Admin is never initialised; all onclick="Admin.showTab(...)" calls throw ReferenceError.
  4. Because #overview-panel is the only panel without a hidden class in the server-rendered HTML, every tab URL shows the overview panel regardless of the hash.

What this PR does

Commit Change
15617da Documents the required npm install && npm run vite:build step in README.md, docs/docs/development/building.md, and AGENTS.md
d3c29e6 Commits the compiled bundle (bundle-CB59m_Zy.js) and Vite manifest so the UI works on a clean checkout without a manual build step

Follow-up consideration

make install-dev does not run npm install && npm run vite:build. A future chore could add an optional build-ui Makefile target (guarded by a command -v npm check) and wire it into the dev setup flow so a clean checkout is always runnable with a single make install-dev.

@a-effort a-effort added bug Something isn't working frontend Frontend development (HTML, CSS, JavaScript) ui User Interface regression High priority regression labels Apr 3, 2026
@a-effort a-effort marked this pull request as ready for review April 3, 2026 22:11
@a-effort a-effort requested a review from crivetimihai as a code owner April 3, 2026 22:11
@a-effort
Copy link
Copy Markdown
Collaborator Author

a-effort commented Apr 3, 2026

bug this fixes:

bug.mp4

@crivetimihai crivetimihai force-pushed the fix/4041-dependency-documentation branch from 929b829 to 0a36f11 Compare April 5, 2026 12:43
@crivetimihai
Copy link
Copy Markdown
Member

Thanks for the contribution @a-effort — the core diagnosis is spot-on (missing Vite bundle after #3137), and the docs additions are valuable.

I've reworked the branch during review. Here's what changed and why:

Compiled bundle removed from git

The project convention is that build artifacts aren't committed — mcpgateway/static/vendor/ is already gitignored and built during container/dev setup. The Vite bundle is the same kind of thing: generated output from source that's already in the repo (mcpgateway/admin_ui/). Committing it would add ~500KB of minified JS to git history that goes stale on every admin UI change.

Instead:

  • make build-ui target added (guarded by command -v npm check), uses npm ci for reproducible installs
  • Wired into install-dev so make install-dev produces a working admin UI automatically
  • .gitignore updated to exclude bundle-*.js and .vite/ alongside the existing vendor/ entry

Lockfile churn dropped

The original npm install mutated package-lock.json (243 lines of dependency resolution changes). Switched to npm ci which installs from the lockfile without modifying it, so the diff is clean.

Commits squashed

Collapsed the 7 iterative commits (docs → bundle → lint fix → secrets fix → ...) into 2 logical commits:

  1. build(ui): add build-ui Makefile target and gitignore Vite output
  2. docs: document Admin UI build step for contributors

Your ESLint ignore, .secrets.baseline exclusion, and all documentation additions are preserved. Authorship is kept as yours on both commits.

marekdano
marekdano previously approved these changes Apr 9, 2026
Copy link
Copy Markdown
Collaborator

@marekdano marekdano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

  • Implementation is correct and follows best practices for treating build artifacts.
  • No bundle files are committed (verified)
  • .gitignore properly excludes build artifacts
  • make build-ui target added with npm guard
  • Integrated into make install-dev for automatic builds
  • Documentation updated in README.md, AGENTS.md, and building.md

LGTM 🚀

@jonpspri jonpspri self-assigned this Apr 11, 2026
@jonpspri jonpspri force-pushed the fix/4041-dependency-documentation branch from 0a36f11 to 8ae2727 Compare April 11, 2026 14:18
The Vite bundle (mcpgateway/static/bundle-*.js) is a build artifact
generated from mcpgateway/admin_ui/ source. Treat it the same as
static/vendor/ — built locally, not committed.

- Add `make build-ui` target (uses `npm ci` for reproducible installs)
  guarded by `command -v npm` check
- Wire build-ui into install-dev so a fresh checkout is runnable
- Gitignore bundle-*.js and .vite/ alongside existing vendor/ entry
- Exclude bundle paths from ESLint (minified, not authored code)
- Exclude bundle paths from detect-secrets (false-positive prevention)

Closes #4041

Signed-off-by: Anna Effort <anna.effort@datastax.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Add the required `make build-ui` (or `npm ci && npm run vite:build`)
step to README.md, AGENTS.md, and docs/docs/development/building.md
so contributors know to build the Admin UI bundle after cloning.

Signed-off-by: Anna Effort <anna.effort@datastax.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@jonpspri jonpspri force-pushed the fix/4041-dependency-documentation branch from 8ae2727 to 66f04bc Compare April 11, 2026 14:25
Make `make build-ui` exit non-zero with an actionable message when npm is
absent (with a SKIP_UI_BUILD=1 escape hatch for headless deployments), so
`make install-dev` surfaces missing prerequisites at install time instead of
leaving /admin to fail at runtime with "No bundle-*.js found".

Provision Node via the official devcontainers feature so Codespaces /
devcontainer setup still completes end-to-end under the new fail-fast
behavior, and document the prerequisite + bypass in the building guide.

Signed-off-by: Jonathan Springer <jps@s390x.com>
@jonpspri jonpspri force-pushed the fix/4041-dependency-documentation branch from 66f04bc to f594150 Compare April 11, 2026 14:33
@jonpspri jonpspri merged commit 8351567 into main Apr 11, 2026
17 checks passed
@jonpspri jonpspri deleted the fix/4041-dependency-documentation branch April 11, 2026 17:20
claudia-gray pushed a commit that referenced this pull request Apr 13, 2026
* build(ui): add build-ui Makefile target and gitignore Vite output

The Vite bundle (mcpgateway/static/bundle-*.js) is a build artifact
generated from mcpgateway/admin_ui/ source. Treat it the same as
static/vendor/ — built locally, not committed.

- Add `make build-ui` target (uses `npm ci` for reproducible installs)
  guarded by `command -v npm` check
- Wire build-ui into install-dev so a fresh checkout is runnable
- Gitignore bundle-*.js and .vite/ alongside existing vendor/ entry
- Exclude bundle paths from ESLint (minified, not authored code)
- Exclude bundle paths from detect-secrets (false-positive prevention)

Closes #4041

Signed-off-by: Anna Effort <anna.effort@datastax.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* docs: document Admin UI build step for contributors

Add the required `make build-ui` (or `npm ci && npm run vite:build`)
step to README.md, AGENTS.md, and docs/docs/development/building.md
so contributors know to build the Admin UI bundle after cloning.

Signed-off-by: Anna Effort <anna.effort@datastax.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* build(ui): fail fast when Admin UI build prerequisites are missing

Make `make build-ui` exit non-zero with an actionable message when npm is
absent (with a SKIP_UI_BUILD=1 escape hatch for headless deployments), so
`make install-dev` surfaces missing prerequisites at install time instead of
leaving /admin to fail at runtime with "No bundle-*.js found".

Provision Node via the official devcontainers feature so Codespaces /
devcontainer setup still completes end-to-end under the new fail-fast
behavior, and document the prerequisite + bypass in the building guide.

Signed-off-by: Jonathan Springer <jps@s390x.com>

---------

Signed-off-by: Anna Effort <anna.effort@datastax.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Jonathan Springer <jps@s390x.com>
Co-authored-by: Jonathan Springer <jps@s390x.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend Frontend development (HTML, CSS, JavaScript) regression High priority regression ui User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Add dependency documentation to fix broken nav

4 participants