Lean build: gate Displays links by staged route, not plugin-enabled state
The Displays section is hardcoded in AppLayout (not plugin nav). TV Slideshow (/tv, slides) had no gate at all and Parts Kiosk (/parts-kiosk, printedparts) was gated on isPluginEnabled - which a registry copied from a full site reports true even when the plugin was never staged, so both showed on a lean site and dead-ended blank. Now each Displays link (Shopfloor, TV Slideshow, Parts Kiosk) is gated by whether its route is registered in this build (router.getRoutes), and the Displays header hides when none are present. Route existence is the true 'is it in this build' test.
This commit is contained in:
@@ -24,10 +24,10 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="nav-section">Displays</div>
|
<div v-if="showDisplays" class="nav-section">Displays</div>
|
||||||
<a :href="withBase('/shopfloor')" target="_blank" class="external-link">Shopfloor Dashboard</a>
|
<a v-if="hasRoute('/shopfloor')" :href="withBase('/shopfloor')" target="_blank" class="external-link">Shopfloor Dashboard</a>
|
||||||
<a :href="withBase('/tv')" target="_blank" class="external-link">TV Slideshow</a>
|
<a v-if="hasRoute('/tv')" :href="withBase('/tv')" target="_blank" class="external-link">TV Slideshow</a>
|
||||||
<a v-if="isPluginEnabled('printedparts')" :href="withBase('/parts-kiosk')"
|
<a v-if="hasRoute('/parts-kiosk')" :href="withBase('/parts-kiosk')"
|
||||||
target="_blank" class="external-link">Parts Kiosk</a>
|
target="_blank" class="external-link">Parts Kiosk</a>
|
||||||
|
|
||||||
<router-link v-if="authStore.isAdmin" to="/settings">Settings</router-link>
|
<router-link v-if="authStore.isAdmin" to="/settings">Settings</router-link>
|
||||||
@@ -111,11 +111,20 @@ import { currentTheme, toggleTheme } from '../stores/theme'
|
|||||||
import { dashboardApi, notificationsApi } from '../api'
|
import { dashboardApi, notificationsApi } from '../api'
|
||||||
import { getFacilityName, getSiteLogo, getServicenowUrls } from '../utils/siteSettings'
|
import { getFacilityName, getSiteLogo, getServicenowUrls } from '../utils/siteSettings'
|
||||||
import { withBase } from '../utils/basePath'
|
import { withBase } from '../utils/basePath'
|
||||||
import { isPluginEnabled } from '../composables/enabledPlugins'
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
|
// The Displays links are hardcoded (not plugin-driven nav), so gate each by
|
||||||
|
// whether its route was actually staged into THIS build. A lean site without
|
||||||
|
// slides / printedparts must not show a TV Slideshow / Parts Kiosk link that
|
||||||
|
// dead-ends on a blank page. Route existence is the true "is it in this build"
|
||||||
|
// test - more reliable than plugin-enabled state, which a copied registry can
|
||||||
|
// report for a plugin that was never staged.
|
||||||
|
const stagedRoutePaths = new Set(router.getRoutes().map(r => r.path))
|
||||||
|
const hasRoute = (path) => stagedRoutePaths.has(path)
|
||||||
|
const showDisplays = ['/shopfloor', '/tv', '/parts-kiosk'].some(hasRoute)
|
||||||
const routeViewKey = computed(() =>
|
const routeViewKey = computed(() =>
|
||||||
route.path.startsWith('/settings') ? '/settings' : route.path
|
route.path.startsWith('/settings') ? '/settings' : route.path
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user