mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
fix: misc component issues
This commit is contained in:
parent
c730de8b32
commit
4b33e67514
5 changed files with 18 additions and 21 deletions
|
@ -142,7 +142,7 @@ export default {
|
||||||
if (key === copypastaCode[copypastastep++]) {
|
if (key === copypastaCode[copypastastep++]) {
|
||||||
if (copypastastep === copypastaCode.length) {
|
if (copypastastep === copypastaCode.length) {
|
||||||
document
|
document
|
||||||
.getElementsByClassName('unselectable')
|
.querySelectorAll('.unselectable')
|
||||||
.forEach((element) => element.classList.remove('unselectable'))
|
.forEach((element) => element.classList.remove('unselectable'))
|
||||||
copypastastep = 0
|
copypastastep = 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ export default {
|
||||||
// Allow to start searching after dropdown opening
|
// Allow to start searching after dropdown opening
|
||||||
if (
|
if (
|
||||||
!['Tab', 'Space'].includes(e.code) &&
|
!['Tab', 'Space'].includes(e.code) &&
|
||||||
e.target === this.$refs.dropdown.$el.lastElementChild
|
e.target === this.$refs.dropdown.$el.firstElementChild
|
||||||
) {
|
) {
|
||||||
this.$refs['search-input'].focus()
|
this.$refs['search-input'].focus()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import { isEmptyValue } from '@/helpers/commons'
|
import { isEmptyValue } from '@/helpers/commons'
|
||||||
import { stratify } from '@/helpers/data/tree'
|
import { stratify } from '@/helpers/data/tree'
|
||||||
|
import { reactive } from 'vue'
|
||||||
|
|
||||||
export function getParentDomain(domain, domains, highest = false) {
|
export function getParentDomain(domain, domains, highest = false) {
|
||||||
const method = highest ? 'lastIndexOf' : 'indexOf'
|
const method = highest ? 'lastIndexOf' : 'indexOf'
|
||||||
|
@ -277,14 +278,16 @@ export default {
|
||||||
// action when state.domain change)
|
// action when state.domain change)
|
||||||
const domains = getters.orderedDomains
|
const domains = getters.orderedDomains
|
||||||
if (!domains) return
|
if (!domains) return
|
||||||
const dataset = domains.map((name) => ({
|
const dataset = reactive(
|
||||||
// data to build a hierarchy
|
domains.map((name) => ({
|
||||||
name,
|
// data to build a hierarchy
|
||||||
parent: getParentDomain(name, domains),
|
name,
|
||||||
// utility data that will be used by `RecursiveListGroup` component
|
parent: getParentDomain(name, domains),
|
||||||
to: { name: 'domain-info', params: { name } },
|
// utility data that will be used by `RecursiveListGroup` component
|
||||||
opened: true,
|
to: { name: 'domain-info', params: { name } },
|
||||||
}))
|
opened: true,
|
||||||
|
})),
|
||||||
|
)
|
||||||
return stratify(dataset)
|
return stratify(dataset)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,10 @@
|
||||||
class="category-card"
|
class="category-card"
|
||||||
>
|
>
|
||||||
<BCardTitle>
|
<BCardTitle>
|
||||||
<BLink @click="updateQuery('category', cat.value)" class="card-link">
|
<BLink
|
||||||
|
@click.prevent="updateQuery('category', cat.value)"
|
||||||
|
class="card-link"
|
||||||
|
>
|
||||||
<YIcon :iname="cat.icon" /> {{ cat.text }}
|
<YIcon :iname="cat.icon" /> {{ cat.text }}
|
||||||
</BLink>
|
</BLink>
|
||||||
</BCardTitle>
|
</BCardTitle>
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
items-name="domains"
|
items-name="domains"
|
||||||
:queries="queries"
|
:queries="queries"
|
||||||
:filtered-items="hasFilteredItems"
|
:filtered-items="hasFilteredItems"
|
||||||
@queries-response="onQueriesResponse"
|
|
||||||
>
|
>
|
||||||
<template #top-bar-buttons>
|
<template #top-bar-buttons>
|
||||||
<BButton variant="success" :to="{ name: 'domain-add' }">
|
<BButton variant="success" :to="{ name: 'domain-add' }">
|
||||||
|
@ -63,12 +62,11 @@ export default {
|
||||||
return {
|
return {
|
||||||
queries: [['GET', { uri: 'domains', storeKey: 'domains' }]],
|
queries: [['GET', { uri: 'domains', storeKey: 'domains' }]],
|
||||||
search: '',
|
search: '',
|
||||||
domainsTree: undefined,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['domains', 'mainDomain']),
|
...mapGetters(['domains', 'mainDomain', 'domainsTree']),
|
||||||
|
|
||||||
tree() {
|
tree() {
|
||||||
if (!this.domainsTree) return
|
if (!this.domainsTree) return
|
||||||
|
@ -86,12 +84,5 @@ export default {
|
||||||
return this.tree.children || null
|
return this.tree.children || null
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
|
||||||
onQueriesResponse() {
|
|
||||||
// Add the tree to `data` to make it reactive
|
|
||||||
this.domainsTree = this.$store.getters.domainsTree
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue