Fix/4041 Nav bug & dependency documentation#4043
Conversation
|
bug this fixes: bug.mp4 |
929b829 to
0a36f11
Compare
|
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 gitThe project convention is that build artifacts aren't committed — Instead:
Lockfile churn droppedThe original Commits squashedCollapsed the 7 iterative commits (docs → bundle → lint fix → secrets fix → ...) into 2 logical commits:
Your ESLint ignore, |
marekdano
left a comment
There was a problem hiding this comment.
Summary
- Implementation is correct and follows best practices for treating build artifacts.
- No bundle files are committed (verified)
.gitignoreproperly excludes build artifactsmake build-uitarget added with npm guard- Integrated into
make install-devfor automatic builds - Documentation updated in README.md, AGENTS.md, and building.md
LGTM 🚀
0a36f11 to
8ae2727
Compare
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>
8ae2727 to
66f04bc
Compare
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>
66f04bc to
f594150
Compare
* 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>
🔗 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.jsand replaced it with ES modules bundled by Vite, but never committed the compiled output. With nobundle-*.jspresent, the server logs a startup error, serves a broken script tag, and the entirewindow.Adminnamespace is missing, leaving every tab navigation call as an uncaughtReferenceErrorand 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 requirednpm install && npm run vite:buildstep explicit for contributors working from source.🏷️ Type of Change
🧪 Verification
make lintmake testmake coverage✅ Checklist
make black isort pre-commit)📓 Notes (optional)
Fixes #4041 Admin UI tab navigation broken on clean checkout.
What broke
PR #3137 replaced
mcpgateway/static/admin.jswith a Vite-bundled build undermcpgateway/admin_ui/, but the compiled output was never built or committed. On a clean checkoutmcpgateway/static/bundle-*.jsdoes not exist, so:get_bundle_js_filename()inadmin.pyreturns""and logs an error.<script src="/static/">— a 404.window.Adminis never initialised; allonclick="Admin.showTab(...)"calls throwReferenceError.#overview-panelis the only panel without ahiddenclass in the server-rendered HTML, every tab URL shows the overview panel regardless of the hash.What this PR does
15617danpm install && npm run vite:buildstep inREADME.md,docs/docs/development/building.md, andAGENTS.mdd3c29e6bundle-CB59m_Zy.js) and Vite manifest so the UI works on a clean checkout without a manual build stepFollow-up consideration
make install-devdoes not runnpm install && npm run vite:build. A future chore could add an optionalbuild-uiMakefile target (guarded by acommand -v npmcheck) and wire it into the dev setup flow so a clean checkout is always runnable with a singlemake install-dev.