diff --git a/dashboard/public/translation/cs.json b/dashboard/public/translation/cs.json index ce21805f3..5d1397e3f 100644 --- a/dashboard/public/translation/cs.json +++ b/dashboard/public/translation/cs.json @@ -970,7 +970,6 @@ "noRedirections": "Žádné přesměrované domény", "addRedirectionAction": "Přidat přesměrování", "saveAction": "Uložit", - "dnsoverwrite": "Některé DNS záznamy již existují. Potvrďte přepsání.", "aliases": "Aliasy", "addAliasAction": "Přidat alias", "noAliases": "Žádné aliasy pro domény" diff --git a/dashboard/public/translation/de.json b/dashboard/public/translation/de.json index fe64f7473..05dc23f3b 100644 --- a/dashboard/public/translation/de.json +++ b/dashboard/public/translation/de.json @@ -1414,8 +1414,7 @@ "addRedirectionAction": "Eine Weiterleitung hinzufügen", "noAliases": "Keine Aliasse", "addAliasAction": "Alias hinzufügen", - "aliases": "Aliasse", - "dnsoverwrite": "Einige DNS-Einträge existieren bereits. Mit dem Überschreiben einverstanden." + "aliases": "Aliasse" }, "updateDialog": { "subscriptionExpired": "Das Cloudron-Abonnement ist abgelaufen. Bitte ein Abonnement einrichten, um die Anwendung zu aktualisieren.", diff --git a/dashboard/public/translation/en.json b/dashboard/public/translation/en.json index 4745153e4..4e14f9f17 100644 --- a/dashboard/public/translation/en.json +++ b/dashboard/public/translation/en.json @@ -1230,7 +1230,7 @@ "aliases": "Aliases", "addAliasAction": "Add an alias", "noAliases": "No alias domains", - "dnsoverwrite": "Some DNS records already exist. Agree to overwrite." + "overwriteDns": "Overwrite existing DNS records of {domains}" }, "accessControl": { "userManagement": { diff --git a/dashboard/public/translation/es.json b/dashboard/public/translation/es.json index 19bde84f9..7e3ebe719 100644 --- a/dashboard/public/translation/es.json +++ b/dashboard/public/translation/es.json @@ -1036,8 +1036,7 @@ "noRedirections": "No se han configurado redirecciones de dominio", "redirections": "Redirecciones", "locationPlaceholder": "Dejar vacío para usar el dominio desnudo", - "location": "Ubicación", - "dnsoverwrite": "Ya existen algunos registros DNS. Acepta para sobrescribirlos." + "location": "Ubicación" }, "display": { "saveAction": "Guardar", diff --git a/dashboard/public/translation/id.json b/dashboard/public/translation/id.json index 40a200b7c..c75401dc2 100644 --- a/dashboard/public/translation/id.json +++ b/dashboard/public/translation/id.json @@ -1207,8 +1207,7 @@ "saveAction": "Simpan", "aliases": "Alias", "addAliasAction": "Tambahkan alias", - "noAliases": "Tidak ada domain alias", - "dnsoverwrite": "Beberapa catatan DNS sudah ada. Setuju untuk menimpa." + "noAliases": "Tidak ada domain alias" }, "accessControl": { "userManagement": { diff --git a/dashboard/public/translation/nl.json b/dashboard/public/translation/nl.json index a6f2cdd13..9b5055a0a 100644 --- a/dashboard/public/translation/nl.json +++ b/dashboard/public/translation/nl.json @@ -785,8 +785,7 @@ "noRedirections": "Geen domein-omleidingen", "noAliases": "Geen alias-domeinen", "addAliasAction": "Alias toevoegen", - "aliases": "Aliassen", - "dnsoverwrite": "Sommige DNS records bestaan al. Weet je zeker dat ze overschreven moeten worden?" + "aliases": "Aliassen" }, "accessControl": { "userManagement": { diff --git a/dashboard/public/translation/ru.json b/dashboard/public/translation/ru.json index 07514781e..7337b1b6b 100644 --- a/dashboard/public/translation/ru.json +++ b/dashboard/public/translation/ru.json @@ -419,8 +419,7 @@ "saveAction": "Сохранить", "aliases": "Псевдонимы", "addAliasAction": "Добавить псевдоним", - "noAliases": "Домены-псевдонимы отсутствуют", - "dnsoverwrite": "Некоторые DNS записи уже существуют. Подтвердите перезапись." + "noAliases": "Домены-псевдонимы отсутствуют" }, "accessControl": { "sftp": { diff --git a/dashboard/public/translation/vi.json b/dashboard/public/translation/vi.json index ea15f034c..b62cad918 100644 --- a/dashboard/public/translation/vi.json +++ b/dashboard/public/translation/vi.json @@ -1429,8 +1429,7 @@ "noRedirections": "Không có tên miền chuyển hướng", "redirections": "Chuyển hướng", "locationPlaceholder": "Để trống để dùng tên miền gốc", - "location": "Nơi cài đặt", - "dnsoverwrite": "Một vài bản ghi DNS đã có sẵn. Đồng ý ghi đè lên." + "location": "Nơi cài đặt" }, "display": { "saveAction": "Lưu", diff --git a/dashboard/src/components/AppInstallDialog.vue b/dashboard/src/components/AppInstallDialog.vue index 46bfc9524..9edd56d68 100644 --- a/dashboard/src/components/AppInstallDialog.vue +++ b/dashboard/src/components/AppInstallDialog.vue @@ -2,7 +2,7 @@ import { ref, computed, useTemplateRef, onMounted, inject, watch } from 'vue'; import { marked } from 'marked'; -import { Button, Dialog, SingleSelect, FormGroup, TextInput, InputGroup, Spinner } from '@cloudron/pankow'; +import { Button, Checkbox, Dialog, SingleSelect, FormGroup, TextInput, InputGroup, Spinner } from '@cloudron/pankow'; import { prettyDate, prettyBinarySize } from '@cloudron/pankow/utils'; import AccessControl from './AccessControl.vue'; import PortBindings from './PortBindings.vue'; @@ -42,6 +42,12 @@ const domains = ref([]); const form = ref(null); // assigned via "Function Ref" because it is inside v-if const isFormValid = ref(false); +function resetDnsOverwrite() { + needsOverwriteDns.value = []; + overwriteDns.value = false; + formError.value = {}; +} + async function checkValidity() { isFormValid.value = form.value ? form.value.checkValidity() : false; @@ -89,7 +95,8 @@ const tcpPorts = ref({}); const udpPorts = ref({}); const secondaryDomains = ref({}); const upstreamUri = ref(''); -const needsOverwriteDns = ref(false); +const overwriteDns = ref(false); +const needsOverwriteDns = ref([]); const users = ref([]); const groups = ref([]); @@ -98,7 +105,7 @@ function onDomainChange() { domainProvider.value = tmp ? tmp.provider : ''; } -async function onSubmit(overwriteDns) { +async function onSubmit() { if (!form.value.reportValidity()) return; formError.value = {}; @@ -111,6 +118,7 @@ async function onSubmit(overwriteDns) { for (const d in secondaryDomains.value) checkForDomains.push({ domain: secondaryDomains.value[d].domain, subdomain: secondaryDomains.value[d].value }); + const conflicting = []; for (const d of checkForDomains) { const [error, result] = await domainsModel.checkRecords(d.domain, d.subdomain); if (error) { @@ -119,12 +127,14 @@ async function onSubmit(overwriteDns) { return console.error(error); } - if (result.needsOverwrite && !overwriteDns) { - busy.value = false; - needsOverwriteDns.value = true; - formError.value.dnsExists = `DNS record for ${d.subdomain}.${d.domain} already exists`; - return; - } + if (result.needsOverwrite) conflicting.push((d.subdomain ? d.subdomain + '.' : '') + d.domain); + } + + if (conflicting.length > 0 && !overwriteDns.value) { + busy.value = false; + needsOverwriteDns.value = conflicting; + formError.value.generic = `DNS records of ${conflicting.join(', ')} already exist`; + return; } const config = { @@ -133,7 +143,7 @@ async function onSubmit(overwriteDns) { accessRestriction: accessRestrictionOption.value === ACL_OPTIONS.ANY ? null : (accessRestrictionOption.value === ACL_OPTIONS.NOSSO ? null : accessRestrictionAcl.value) }; - if (overwriteDns) config.overwriteDns = true; + if (overwriteDns.value) config.overwriteDns = true; if (manifest.value.optionalSso) config.sso = accessRestrictionOption.value !== ACL_OPTIONS.NOSSO; @@ -185,7 +195,7 @@ function onClose() { onMounted(async () => { let [error, result] = await usersModel.list(); if (error) return console.error(error); - result.forEach(u => { u.label = u.displayName || u.username || u.email }); + result.forEach(u => { u.label = u.displayName || u.username || u.email; }); users.value = result; [error, result] = await groupsModel.list(); @@ -225,7 +235,8 @@ defineExpose({ accessRestrictionAcl.value = { users: [], groups: [] }; domainProvider.value = ''; upstreamUri.value = ''; - needsOverwriteDns.value = ''; + overwriteDns.value = false; + needsOverwriteDns.value = []; domainList.forEach(d => { d.label = '.' + d.domain; @@ -296,18 +307,15 @@ defineExpose({
-
{{ formError.generic }}
-
{{ formError.dnsExists }}
- -
+
- - + +
{{ formError.location }}
@@ -317,8 +325,8 @@ defineExpose({ {{ port.description }} - - + +
@@ -330,9 +338,13 @@ defineExpose({ +
+ +
{{ formError.generic }}
+ +
- - +
diff --git a/dashboard/src/components/app/Location.vue b/dashboard/src/components/app/Location.vue index 47f5e65de..dd88fa3e1 100644 --- a/dashboard/src/components/app/Location.vue +++ b/dashboard/src/components/app/Location.vue @@ -18,7 +18,7 @@ const busy = ref(false); const errorMessage = ref(''); const errorObject = ref({}); const overwriteDns = ref(false); -const needsOverwriteDns = ref(false); +const needsOverwriteDns = ref([]); const domain = ref(''); const subdomain = ref(''); const secondaryDomains = ref({}); @@ -56,6 +56,12 @@ function onAddRedirect() { const form = useTemplateRef('form'); const isFormValid = ref(false); +function resetDnsOverwrite() { + needsOverwriteDns.value = []; + overwriteDns.value = false; + errorMessage.value = ''; +} + function checkValidity() { isFormValid.value = form.value ? form.value.checkValidity() : false; @@ -87,7 +93,7 @@ async function onSubmit() { busy.value = true; errorMessage.value = ''; errorObject.value = {}; - needsOverwriteDns.value = false; + needsOverwriteDns.value = []; const checkForDomains = [{ domain: domain.value, @@ -98,6 +104,7 @@ async function onSubmit() { for (const d of aliases.value) checkForDomains.push({ domain: d.domain, subdomain: d.subdomain }); for (const d of redirects.value) checkForDomains.push({ domain: d.domain, subdomain: d.subdomain }); + const conflicting = []; for (const d of checkForDomains) { const [error, result] = await domainsModel.checkRecords(d.domain, d.subdomain); if (error) { @@ -106,11 +113,14 @@ async function onSubmit() { return console.error(error); } - if (result.needsOverwrite && !overwriteDns.value) { - busy.value = false; - needsOverwriteDns.value = true; - return; - } + if (result.needsOverwrite) conflicting.push((d.subdomain ? d.subdomain + '.' : '') + d.domain); + } + + if (conflicting.length > 0 && !overwriteDns.value) { + busy.value = false; + needsOverwriteDns.value = conflicting; + errorMessage.value = `DNS records of ${conflicting.join(', ')} already exist`; + return; } // only use enabled ports @@ -207,8 +217,8 @@ onMounted(async () => {
- - + +
@@ -220,8 +230,8 @@ onMounted(async () => { {{ item.description }} - - + +
@@ -234,8 +244,8 @@ onMounted(async () => {
- - + +
@@ -253,8 +263,8 @@ onMounted(async () => {
- - + +
@@ -272,13 +282,11 @@ onMounted(async () => {
-
{{ errorMessage }}
-
+
{{ errorMessage }}
+ +
- -
- - +