mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
fix: use different strategy for domains not available in DomainForm in PostInstall
This commit is contained in:
parent
bdb283a80c
commit
6888ccb571
4 changed files with 8 additions and 9 deletions
|
@ -134,8 +134,7 @@ export function useDomains(
|
||||||
const { mainDomain, domains: domains_, domainDetails } = useData()
|
const { mainDomain, domains: domains_, domainDetails } = useData()
|
||||||
|
|
||||||
const domains = computed(() => {
|
const domains = computed(() => {
|
||||||
if (!domains_.value && installed)
|
if (!domains_.value) throw new Error(getNoDataMessage('domains'))
|
||||||
throw new Error(getNoDataMessage('domains'))
|
|
||||||
return domains_.value
|
return domains_.value
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,7 @@ async function performPostInstall(force = false) {
|
||||||
<!-- DOMAIN SETUP STEP -->
|
<!-- DOMAIN SETUP STEP -->
|
||||||
<template v-else-if="step === 'domain'">
|
<template v-else-if="step === 'domain'">
|
||||||
<DomainForm
|
<DomainForm
|
||||||
|
:domains="[]"
|
||||||
:title="$t('postinstall_set_domain')"
|
:title="$t('postinstall_set_domain')"
|
||||||
:submit-text="$t('next')"
|
:submit-text="$t('next')"
|
||||||
:server-error="serverError"
|
:server-error="serverError"
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
import { computed, reactive, ref, watch } from 'vue'
|
import { computed, reactive, ref, watch } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import { useDomains } from '@/composables/data'
|
|
||||||
import { useForm } from '@/composables/form'
|
import { useForm } from '@/composables/form'
|
||||||
import { useInfos } from '@/composables/useInfos'
|
|
||||||
import {
|
import {
|
||||||
domain,
|
domain,
|
||||||
dynDomain,
|
dynDomain,
|
||||||
|
@ -21,6 +19,7 @@ defineOptions({
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
|
domains: string[]
|
||||||
title: string
|
title: string
|
||||||
submitText?: string
|
submitText?: string
|
||||||
serverError?: string
|
serverError?: string
|
||||||
|
@ -35,14 +34,11 @@ const emit = defineEmits<{
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const { installed } = useInfos()
|
|
||||||
|
|
||||||
const { domains } = useDomains(undefined, installed.value)
|
|
||||||
const dynDomains = ['nohost.me', 'noho.st', 'ynh.fr']
|
const dynDomains = ['nohost.me', 'noho.st', 'ynh.fr']
|
||||||
|
|
||||||
const dynDnsForbiden = computed(() => {
|
const dynDnsForbiden = computed(() => {
|
||||||
if (!domains.value) return false
|
if (!props.domains) return false
|
||||||
return domains.value.some((domain) => {
|
return props.domains.some((domain) => {
|
||||||
return dynDomains.some((dynDomain) => domain.includes(dynDomain))
|
return dynDomains.some((dynDomain) => domain.includes(dynDomain))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -4,12 +4,14 @@ import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import { APIBadRequestError, type APIError } from '@/api/errors'
|
import { APIBadRequestError, type APIError } from '@/api/errors'
|
||||||
|
import { useDomains } from '@/composables/data'
|
||||||
import { DomainForm } from '@/views/_partials'
|
import { DomainForm } from '@/views/_partials'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
await api.fetch({ uri: 'domains', cachePath: 'domains' })
|
await api.fetch({ uri: 'domains', cachePath: 'domains' })
|
||||||
|
|
||||||
|
const { domains } = useDomains()
|
||||||
const serverError = ref('')
|
const serverError = ref('')
|
||||||
|
|
||||||
function onSubmit(data: { domain: string; dyndns_recovery_password?: string }) {
|
function onSubmit(data: { domain: string; dyndns_recovery_password?: string }) {
|
||||||
|
@ -32,6 +34,7 @@ function onSubmit(data: { domain: string; dyndns_recovery_password?: string }) {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DomainForm
|
<DomainForm
|
||||||
|
:domains="domains"
|
||||||
:title="$t('domain_add')"
|
:title="$t('domain_add')"
|
||||||
:server-error="serverError"
|
:server-error="serverError"
|
||||||
:submit-text="$t('add')"
|
:submit-text="$t('add')"
|
||||||
|
|
Loading…
Add table
Reference in a new issue