feat: Add plugin navigation support via .theme/navi.json#1802
feat: Add plugin navigation support via .theme/navi.json#1802bassco wants to merge 2 commits intofluidd-core:developfrom
Conversation
Add support for loading external navigation items from .theme/navi.json, enabling plugins like KlipperFleet to add sidebar navigation. - Add plugins Vuex module for managing external nav points - Add AppNavItemExternal component for external nav links - Integrate with AppNavDrawer to display plugin navigation items - Add unit tests for the plugins store module - Add i18n keys for external navigation tooltip Signed-off-by: changeme <changeme@users.noreply.github.com>
TestingUnit TestsAll 91 tests pass including new tests for the plugins module covering:
E2E Test PlanVerified via Playwright automation that the full navigation flow works:
Screenshots: |
|
Addressing the build errors. |
Type-check fixThe Root cause: The new test file at Fix: Exclude Changes:
|
|
Ooh, looks like I overlooked #1786 that has similar functionality and it also adding additional links. Looks more promising that what I have come up with. Will pull it down and play with it to see if the |
Exclude store test files from vitest tsconfig type-checking scope. Store tests that import modules pulling in Vue augmentations and ambient namespaces cause 2012 type errors in vue-tsc --build mode due to the vitest project's restricted type environment. Tests still run normally via vitest. Also add missing trailing commas in RootModulesType. Signed-off-by: Andrew Basson <andrew.basson@gmail.com>
Update: KlipperFleet installer approach if #1786 landsAfter reviewing #1786, the Install# Read existing links, append KlipperFleet, write back
existing=$(curl -s "http://localhost:7125/server/database/item?namespace=fluidd&key=uiSettings.navigation.customLinks" \
| jq -r '.result.value // []')
updated=$(echo "$existing" | jq '. + [{
"id": "klipperfleet",
"title": "KlipperFleet",
"url": "/klipperfleet.html",
"icon": "mdi-ferry",
"position": 86
}] | unique_by(.id)')
curl -s -X POST "http://localhost:7125/server/database/item" \
-H "Content-Type: application/json" \
-d "{\"namespace\": \"fluidd\", \"key\": \"uiSettings.navigation.customLinks\", \"value\": $updated}"Uninstall# Remove KlipperFleet entry, preserve other links
existing=$(curl -s "http://localhost:7125/server/database/item?namespace=fluidd&key=uiSettings.navigation.customLinks" \
| jq -r '.result.value // []')
updated=$(echo "$existing" | jq '[.[] | select(.id != "klipperfleet")]')
curl -s -X POST "http://localhost:7125/server/database/item" \
-H "Content-Type: application/json" \
-d "{\"namespace\": \"fluidd\", \"key\": \"uiSettings.navigation.customLinks\", \"value\": $updated}"What this means
|
Add Fluidd navigation integration alongside the existing Mainsail navi.json approach. Uses Moonraker's database API to inject a KlipperFleet CustomNavLink entry (requires fluidd-core/fluidd#1786). - setup_fluidd_navi.py: install/remove nav link via Moonraker DB API - setup_moonraker.py: add/remove persistent_files for any update_manager section, used to preserve klipperfleet.html across Fluidd updates - install.sh: deploy redirect shim to Fluidd web root + register as persistent_files in [update_manager fluidd] - uninstall.sh: reverse all of the above Reference: fluidd-core/fluidd#1802 (comment) Signed-off-by: Andrew Basson <andrew.basson@gmail.com>



Summary
Adds support for external navigation items in the sidebar through a
.theme/navi.jsonconfiguration file. This allows plugins like KlipperFleet to add navigation links to Fluidd without modifying Fluidd's core code.Motivation
Users running multiple web interfaces (e.g., Fluidd, Mainsail, KlipperFleet) want seamless navigation between them. This feature provides a standardized way for external applications to register navigation items in Fluidd's sidebar.
Implementation
The implementation follows the same format used by Mainsail's
.theme/navi.json:[ { "title": "KlipperFleet", "href": "/klipperfleet.html", "target": "_self", "icon": "mdi-flash", "position": 201 } ]Files Changed
types.ts- TypeScript interfacesstate.ts- Default stategetters.ts- Computed nav pointsactions.ts- Fetch navi.json from Moonrakermutations.ts- State mutationsindex.ts- Module exportHow It Works
config/.theme/navi.jsonfrom MoonrakerpositionvalueConfiguration
Place a
navi.jsonfile in your config directory at.theme/navi.json:[ { "title": "KlipperFleet", "href": "/klipperfleet.html", "target": "_self", "icon": "mdi-flash", "position": 201 } ]Related