fix: hide webcam panel in config & dashboard if no webcam exists

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-12-31 17:33:57 +01:00
1 parent a6c927508f
commit 706ed470c4
1 file changed
+11
+11
View File
@@ -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({