feat(manifest): visibleIf.appInstalled nav filter#203
Closed
rubenvdlinde wants to merge 1 commit into
Closed
Conversation
…s nc-vue #3) Menu items can now declare a visibleIf.appInstalled condition that hides cross-app links when the target Nextcloud app is not installed/enabled. Uses OC.appswebroots (primary) then the capabilities API (fallback), with a per-page-load cache so nav filtering is synchronous and cheap. Changes: - src/utils/appInstalled.js — new utility with cache + test-reset hook - src/utils/index.js — export isAppInstalled from package barrel - src/schemas/app-manifest.schema.json — visibleIf on menuItem + menuItemLeaf - src/utils/validateManifest.js — validateMenuItemVisibleIf helper - src/components/CnAppNav/CnAppNav.vue — passesVisibleIf method + filter - src/components/CnAppNav/CnAppNav.md — visibleIf.appInstalled doc + example - tests/utils/appInstalled.spec.js — 11 unit tests for the utility - tests/components/CnAppNav.spec.js — 9 nav filter integration tests - tests/schemas/app-manifest.schema.spec.js — 10 validator tests
Contributor
Author
|
Superseded — visibleIf.appInstalled (isAppInstalled utility, CnAppNav.passesVisibleIf() with appInstalled check, schema visibleIfCondition $def with appInstalled property) landed on beta via PR #212's consolidation. The appInstalled predicate is fully present on beta alongside context-path predicates. This branch is no longer needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
visibleIf.appInstalledto the manifest nav item schema — a menu entry withvisibleIf: { appInstalled: "mydash" }only renders when the named Nextcloud app is installed and enabled.src/utils/appInstalled.jsutility checksOC.appswebrootsfirst (per-user, most reliable), falls back to the capabilities API, and caches results per page-load so nav filtering is synchronous.CnAppNav.passesVisibleIf()applies the filter to both top-level items and nested children; items withoutvisibleIfare always visible (backwards-compatible).validateManifestrejects unknownvisibleIfkeys (mirrorsadditionalProperties: falsein the schema) to protect against typos likeappIsInstalled.Closes scholiq deps nc-vue #3 (as referenced in issue #200 §3).
Test plan
tests/utils/appInstalled.spec.js— 11 unit tests covering OC.appswebroots primary path, capabilities fallback, error path, and cachetests/components/CnAppNav.spec.js— 9 integration tests covering hide/show, children, and edge-cases (visibleIf: {}passthrough)tests/schemas/app-manifest.schema.spec.js— 10 validator tests covering valid usage, unknown keys, non-string/empty-string errorsCnAiChatPanelandCnMapWidget(both from the merged AI companion PR, unrelated to this change)🤖 Generated with Claude Code