[UI Nav] Ensure that entities and execute tabs are always on top.

This commit is contained in:
Fabio Manganiello 2023-10-14 14:37:38 +02:00
parent 6d53a3f80f
commit 3cfd72b649
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -93,10 +93,17 @@ export default {
computed: { computed: {
panelNames() { panelNames() {
const prepend = (names, name) => {
const idx = panelNames.indexOf(name)
if (idx >= 0)
names = [name].concat((names.slice(0, idx).concat(names.slice(idx+1))))
return names
}
let panelNames = Object.keys(this.panels) let panelNames = Object.keys(this.panels)
const homeIdx = panelNames.indexOf('entities') panelNames = prepend(panelNames, 'execute')
if (homeIdx >= 0) panelNames = prepend(panelNames, 'entities')
return ['entities'].concat((panelNames.slice(0, homeIdx).concat(panelNames.slice(homeIdx+1))).sort())
return panelNames.sort() return panelNames.sort()
}, },