fix: hide unknown panels in interface settings > dashboard page (#763)
This commit is contained in:
1 parent
e91bfbdcf5
commit
632088c7b5
6 files changed
+35
-9
No files matched your search
@@ -3,6 +3,8 @@ import BaseMixin from '@/components/mixins/base'
|
||||
import { allDashboardPanels } from '@/store/variables'
|
||||
import { capitalize } from '@/plugins/helpers'
|
||||
import { GuiMacrosStateMacrogroup } from '@/store/gui/macros/types'
|
||||
import kebabCase from 'lodash.kebabcase'
|
||||
import Vue from 'vue'
|
||||
|
||||
@Component
|
||||
export default class DashboardMixin extends BaseMixin {
|
||||
@@ -52,9 +54,8 @@ export default class DashboardMixin extends BaseMixin {
|
||||
return this.checkMissingPanels(panels)
|
||||
}
|
||||
|
||||
checkMissingPanels(panels: any[]) {
|
||||
get allPossiblePanels() {
|
||||
let allPanels = [...allDashboardPanels]
|
||||
const missingPanels: any[] = []
|
||||
|
||||
// remove macros panel and add macrogroups panels if macroMode === expert
|
||||
if (this.macroMode === 'expert') {
|
||||
@@ -70,7 +71,13 @@ export default class DashboardMixin extends BaseMixin {
|
||||
allPanels = allPanels.filter((name) => name !== 'webcam')
|
||||
}
|
||||
|
||||
allPanels.forEach((panelname) => {
|
||||
return allPanels
|
||||
}
|
||||
|
||||
checkMissingPanels(panels: any[]) {
|
||||
const missingPanels: any[] = []
|
||||
|
||||
this.allPossiblePanels.forEach((panelname) => {
|
||||
if (!panels.find((panel) => panel.name === panelname))
|
||||
missingPanels.push({
|
||||
name: panelname,
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<component :is="'settings-dashboard-tab-' + viewport"></component>
|
||||
<component :is="currentTab"></component>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
@@ -76,5 +76,9 @@ export default class SettingsDashboardTab extends Mixins(BaseMixin) {
|
||||
else if (this.isWidescreen) this.currentViewport = 'widescreen'
|
||||
else this.currentViewport = 'desktop'
|
||||
}
|
||||
|
||||
get currentTab() {
|
||||
return 'settings-dashboard-tab-' + this.currentViewport
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -118,7 +118,6 @@ import { Mixins } from 'vue-property-decorator'
|
||||
import draggable from 'vuedraggable'
|
||||
import { capitalize, convertPanelnameToIcon } from '@/plugins/helpers'
|
||||
import DashboardMixin from '@/components/mixins/dashboard'
|
||||
|
||||
import { mdiInformation, mdiCheckboxMarked, mdiCheckboxBlankOutline, mdiLock, mdiArrowUpDown } from '@mdi/js'
|
||||
|
||||
@Component({
|
||||
@@ -143,6 +142,7 @@ export default class SettingsDashboardTabDesktop extends Mixins(DashboardMixin)
|
||||
get desktopLayout1() {
|
||||
let panels = this.$store.getters['gui/getPanels']('desktopLayout1')
|
||||
panels = panels.concat(this.missingPanelsDesktop)
|
||||
panels = panels.filter((element: any) => this.allPossiblePanels.includes(element.name))
|
||||
|
||||
return panels
|
||||
}
|
||||
@@ -154,7 +154,10 @@ export default class SettingsDashboardTabDesktop extends Mixins(DashboardMixin)
|
||||
}
|
||||
|
||||
get desktopLayout2() {
|
||||
return this.$store.getters['gui/getPanels']('desktopLayout2')
|
||||
let panels = this.$store.getters['gui/getPanels']('desktopLayout2')
|
||||
panels = panels.filter((element: any) => this.allPossiblePanels.includes(element.name))
|
||||
|
||||
return panels
|
||||
}
|
||||
|
||||
set desktopLayout2(newVal) {
|
||||
|
||||
@@ -100,6 +100,7 @@ export default class SettingsDashboardTabMobile extends Mixins(DashboardMixin) {
|
||||
get mobileLayout() {
|
||||
let panels = this.$store.getters['gui/getPanels']('mobileLayout')
|
||||
panels = panels.concat(this.missingPanelsMobile)
|
||||
panels = panels.filter((element: any) => this.allPossiblePanels.includes(element.name))
|
||||
|
||||
return panels
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ export default class SettingsDashboardTabTablet extends Mixins(DashboardMixin) {
|
||||
get tabletLayout1() {
|
||||
let panels = this.$store.getters['gui/getPanels']('tabletLayout1')
|
||||
panels = panels.concat(this.missingPanelsTablet)
|
||||
panels = panels.filter((element: any) => this.allPossiblePanels.includes(element.name))
|
||||
|
||||
return panels
|
||||
}
|
||||
@@ -151,7 +152,10 @@ export default class SettingsDashboardTabTablet extends Mixins(DashboardMixin) {
|
||||
}
|
||||
|
||||
get tabletLayout2() {
|
||||
return this.$store.getters['gui/getPanels']('tabletLayout2')
|
||||
let panels = this.$store.getters['gui/getPanels']('tabletLayout2')
|
||||
panels = panels.filter((element: any) => this.allPossiblePanels.includes(element.name))
|
||||
|
||||
return panels
|
||||
}
|
||||
|
||||
set tabletLayout2(newVal) {
|
||||
|
||||
@@ -180,6 +180,7 @@ export default class SettingsDashboardTabWidescreen extends Mixins(DashboardMixi
|
||||
get widescreenLayout1() {
|
||||
let panels = this.$store.getters['gui/getPanels']('widescreenLayout1')
|
||||
panels = panels.concat(this.missingPanelsWidescreen)
|
||||
panels = panels.filter((element: any) => this.allPossiblePanels.includes(element.name))
|
||||
|
||||
return panels
|
||||
}
|
||||
@@ -191,7 +192,10 @@ export default class SettingsDashboardTabWidescreen extends Mixins(DashboardMixi
|
||||
}
|
||||
|
||||
get widescreenLayout2() {
|
||||
return this.$store.getters['gui/getPanels']('widescreenLayout2')
|
||||
let panels = this.$store.getters['gui/getPanels']('widescreenLayout2')
|
||||
panels = panels.filter((element: any) => this.allPossiblePanels.includes(element.name))
|
||||
|
||||
return panels
|
||||
}
|
||||
|
||||
set widescreenLayout2(newVal) {
|
||||
@@ -201,7 +205,10 @@ export default class SettingsDashboardTabWidescreen extends Mixins(DashboardMixi
|
||||
}
|
||||
|
||||
get widescreenLayout3() {
|
||||
return this.$store.getters['gui/getPanels']('widescreenLayout3')
|
||||
let panels = this.$store.getters['gui/getPanels']('widescreenLayout3')
|
||||
panels = panels.filter((element: any) => this.allPossiblePanels.includes(element.name))
|
||||
|
||||
return panels
|
||||
}
|
||||
|
||||
set widescreenLayout3(newVal) {
|
||||
|
||||
Reference in new issue
Block a user