mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
update DomainList with RecursiveListGroup
This commit is contained in:
parent
dd35c097c8
commit
8fb7cc8469
2 changed files with 53 additions and 30 deletions
|
@ -160,7 +160,11 @@
|
||||||
"push_force": "Overwrite existing records",
|
"push_force": "Overwrite existing records",
|
||||||
"push_force_confirm": "Are you sure you want to force push all suggested dns records? Be aware that it may overwrite manually or important default records set by you or your registrar.",
|
"push_force_confirm": "Are you sure you want to force push all suggested dns records? Be aware that it may overwrite manually or important default records set by you or your registrar.",
|
||||||
"push_force_warning": "It looks like some DNS records that YunoHost would have set are already in the registrar configuration. You can use the overwrite option if you know what you are doing."
|
"push_force_warning": "It looks like some DNS records that YunoHost would have set are already in the registrar configuration. You can use the overwrite option if you know what you are doing."
|
||||||
}
|
},
|
||||||
|
"types": {
|
||||||
|
"main_domain": "Main domain"
|
||||||
|
},
|
||||||
|
"toggle_subdomains": "Toggle subdomains"
|
||||||
},
|
},
|
||||||
"domain_add": "Add domain",
|
"domain_add": "Add domain",
|
||||||
"domain_add_dns_doc": "… and I have <a href='//yunohost.org/dns_config' target='_blank'>set my DNS correctly</a>.",
|
"domain_add_dns_doc": "… and I have <a href='//yunohost.org/dns_config' target='_blank'>set my DNS correctly</a>.",
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
id="domain-list"
|
id="domain-list"
|
||||||
:search.sync="search"
|
:search.sync="search"
|
||||||
:items="domains"
|
:items="domains"
|
||||||
:filtered-items="filteredDomains"
|
|
||||||
items-name="domains"
|
items-name="domains"
|
||||||
:queries="queries"
|
:queries="queries"
|
||||||
|
:filtered-items="hasFilteredItems"
|
||||||
|
@queries-response="onQueriesResponse"
|
||||||
>
|
>
|
||||||
<template #top-bar-buttons>
|
<template #top-bar-buttons>
|
||||||
<b-button variant="success" :to="{ name: 'domain-add' }">
|
<b-button variant="success" :to="{ name: 'domain-add' }">
|
||||||
|
@ -14,57 +15,75 @@
|
||||||
</b-button>
|
</b-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<b-list-group>
|
<recursive-list-group :tree="tree" :toggle-text="$t('domain.toggle_subdomains')" class="mb-5">
|
||||||
<b-list-group-item
|
<template #default="{ data, parent }">
|
||||||
v-for="domain in filteredDomains" :key="domain"
|
<div class="w-100 d-flex justify-content-between align-items-center">
|
||||||
:to="{ name: 'domain-info', params: { name: domain }}"
|
<h5 class="mr-3">
|
||||||
class="d-flex justify-content-between align-items-center pr-0"
|
<b-link :to="data.to" class="text-body text-decoration-none">
|
||||||
>
|
<span class="font-weight-bold">{{ data.name.replace(parent ? parent.data.name : null, '') }}</span>
|
||||||
<div>
|
<span v-if="parent" class="text-secondary font-weight-light">{{ parent.data.name }}</span>
|
||||||
<h5 class="font-weight-bold">
|
</b-link>
|
||||||
{{ domain }}
|
|
||||||
<small v-if="domain === mainDomain">
|
<small
|
||||||
<span class="sr-only">{{ $t('words.default') }}</span>
|
v-if="data.name === mainDomain"
|
||||||
<icon iname="star" :title="$t('words.default')" />
|
:title="$t('domain.types.main_domain')" class="ml-1"
|
||||||
|
v-b-tooltip.hover
|
||||||
|
>
|
||||||
|
<icon iname="star" />
|
||||||
</small>
|
</small>
|
||||||
</h5>
|
</h5>
|
||||||
<p class="font-italic m-0">
|
|
||||||
https://{{ domain }}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<icon iname="chevron-right" class="lg fs-sm ml-auto" />
|
</template>
|
||||||
</b-list-group-item>
|
</recursive-list-group>
|
||||||
</b-list-group>
|
|
||||||
</view-search>
|
</view-search>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
|
import RecursiveListGroup from '@/components/RecursiveListGroup'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DomainList',
|
name: 'DomainList',
|
||||||
|
|
||||||
|
components: {
|
||||||
|
RecursiveListGroup
|
||||||
|
},
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
queries: [
|
queries: [
|
||||||
['GET', { uri: 'domains/main', storeKey: 'main_domain' }],
|
['GET', { uri: 'domains/main', storeKey: 'main_domain' }],
|
||||||
['GET', { uri: 'domains' }]
|
['GET', { uri: 'domains', storeKey: 'domains' }]
|
||||||
],
|
],
|
||||||
search: ''
|
search: '',
|
||||||
|
domainsTree: undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['domains', 'mainDomain']),
|
...mapGetters(['domains', 'mainDomain']),
|
||||||
|
|
||||||
filteredDomains () {
|
tree () {
|
||||||
if (!this.domains || !this.mainDomain) return
|
if (!this.domainsTree) return
|
||||||
const search = this.search.toLowerCase()
|
if (this.search) {
|
||||||
const mainDomain = this.mainDomain
|
const search = this.search.toLowerCase()
|
||||||
const domains = this.domains
|
return this.domainsTree.filter(node => node.data.name.includes(search))
|
||||||
.filter(name => name.toLowerCase().includes(search))
|
}
|
||||||
.sort(prevDomain => prevDomain === mainDomain ? -1 : 1)
|
return this.domainsTree
|
||||||
return domains.length ? domains : null
|
},
|
||||||
|
|
||||||
|
hasFilteredItems () {
|
||||||
|
if (!this.tree) return
|
||||||
|
return this.tree.children || null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
onQueriesResponse () {
|
||||||
|
// Add the tree to `data` to make it reactive
|
||||||
|
this.domainsTree = this.$store.getters.domainsTree
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue