From 706ed470c43a8d6183dbd4e3be34a1c657399469 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Fri, 31 Dec 2021 17:33:57 +0100 Subject: [PATCH] fix: hide webcam panel in config & dashboard if no webcam exists Signed-off-by: Stefan Dej --- src/components/mixins/dashboard.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/mixins/dashboard.ts b/src/components/mixins/dashboard.ts index e5468bfa..86a90f44 100644 --- a/src/components/mixins/dashboard.ts +++ b/src/components/mixins/dashboard.ts @@ -15,6 +15,11 @@ export default class DashboardMixin extends BaseMixin { return this.$store.getters['gui/macros/getAllMacrogroups'] ?? [] } + + get webcams() { + return this.$store.getters['gui/webcams/getWebcams'] ?? [] + } + get missingPanelsMobile() { const panels = [ ...this.$store.state.gui.dashboard.mobileLayout, @@ -55,6 +60,7 @@ export default class DashboardMixin extends BaseMixin { let allPanels = [...allDashboardPanels] const missingPanels: any[] = [] + // remove macros panel and add macrogroups panels if macroMode === expert if (this.macroMode === 'expert') { this.macrogroups.forEach((group: GuiMacrosStateMacrogroup) => { allPanels.push('macrogroup_'+group.id) @@ -63,6 +69,11 @@ export default class DashboardMixin extends BaseMixin { allPanels = allPanels.filter((name) => name !== 'macros') } + // remove webcam panel, if no webcam exists + if (this.webcams.length === 0) { + allPanels = allPanels.filter((name) => name !== 'webcam') + } + allPanels.forEach((panelname) => { if (!panels.find((panel) => panel.name === panelname)) missingPanels.push({