Lean build: gate Displays links by staged route
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