feat: use computed for namespace title
This commit is contained in:
parent
a6db1e7391
commit
12a3c238b8
1 changed files with 10 additions and 4 deletions
|
@ -54,14 +54,14 @@
|
||||||
<span
|
<span
|
||||||
@click="toggleLists(n.id)"
|
@click="toggleLists(n.id)"
|
||||||
class="menu-label"
|
class="menu-label"
|
||||||
v-tooltip="getNamespaceTitle(n) + ' (' + n.lists.filter(l => !l.isArchived).length + ')'">
|
v-tooltip="namespaceTitles[nk]">
|
||||||
<span class="name">
|
<span class="name">
|
||||||
<span
|
<span
|
||||||
:style="{ backgroundColor: n.hexColor }"
|
:style="{ backgroundColor: n.hexColor }"
|
||||||
class="color-bubble"
|
class="color-bubble"
|
||||||
v-if="n.hexColor !== ''">
|
v-if="n.hexColor !== ''">
|
||||||
</span>
|
</span>
|
||||||
{{ getNamespaceTitle(n) }} ({{ n.lists.filter(l => !l.isArchived).length }})
|
{{ namespaceTitles[nk] }}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<a
|
<a
|
||||||
|
@ -191,7 +191,13 @@ export default {
|
||||||
loading: state => state[LOADING] && state[LOADING_MODULE] === 'namespaces',
|
loading: state => state[LOADING] && state[LOADING_MODULE] === 'namespaces',
|
||||||
}),
|
}),
|
||||||
activeLists() {
|
activeLists() {
|
||||||
return this.namespaces.map(({lists}) => lists.filter(item => !item.isArchived))
|
return this.namespaces.map(({lists}) => lists?.filter(item => !item.isArchived))
|
||||||
|
},
|
||||||
|
namespaceTitles() {
|
||||||
|
return this.namespaces.map((namespace, index) => {
|
||||||
|
const title = this.getNamespaceTitle(namespace)
|
||||||
|
return `${title} (${this.activeLists[index]?.length ?? 0})`
|
||||||
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
|
@ -229,7 +235,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggleLists(namespaceId) {
|
toggleLists(namespaceId) {
|
||||||
this.listsVisible[namespaceId] = !this.listsVisible[namespaceId] ?? false
|
this.listsVisible[namespaceId] = !this.listsVisible[namespaceId]
|
||||||
},
|
},
|
||||||
updateActiveLists(namespace, activeLists) {
|
updateActiveLists(namespace, activeLists) {
|
||||||
// this is a bit hacky: since we do have to filter out the archived items from the list
|
// this is a bit hacky: since we do have to filter out the archived items from the list
|
||||||
|
|
Loading…
Reference in a new issue