@@ -55,17 +72,22 @@ import { ref, onMounted } from 'vue'
import overlay from '@preline/overlay'
import axios from 'axios'
import { domainApi } from '../api/domain.ts'
+import events from '../events.ts'
const props = defineProps(['domain', 'recipients'])
const domain = ref(props.domain)
const recipients = ref(props.recipients)
+const selectedRecipient = ref(props.domain.recipient ?? '')
+const fromName = ref(props.domain.from_name ?? '')
const error = ref('')
-import events from '../events.ts'
const updateDomain = async () => {
const payload = {
id: domain.value.id,
- recipient: domain.value.recipient
+ recipient: selectedRecipient.value,
+ from_name: fromName.value,
+ enabled: domain.value.enabled,
+ catch_all: domain.value.catch_all,
}
try {
@@ -84,6 +106,8 @@ const updateDomain = async () => {
}
const close = () => {
+ selectedRecipient.value = props.domain.recipient ?? ''
+ fromName.value = props.domain.from_name ?? ''
error.value = ''
const modal = document.querySelector('#modal-edit-domain' + domain.value.id) as any
overlay.close(modal)
@@ -99,7 +123,5 @@ const addEvents = () => {
onMounted(() => {
overlay.autoInit()
addEvents()
- // Prepend an empty option to allow unsetting default recipient
- recipients.value.unshift('')
})
\ No newline at end of file
diff --git a/app/src/components/DomainRow.vue b/app/src/components/DomainRow.vue
index a3989293..99e83988 100644
--- a/app/src/components/DomainRow.vue
+++ b/app/src/components/DomainRow.vue
@@ -6,6 +6,9 @@
{{ domain.name }}
+
+ {{ domain.recipient }}
+
Verified
@@ -15,13 +18,22 @@
+
+
+
+
+
@@ -31,6 +43,10 @@
class="hs-dropdown-menu hs-dropdown-open:opacity-100 hidden"
v-bind:aria-labelledby="'hs-dropdown-domain-edit-' + domain.id"
>
+
+
+ Edit
+
Verify DNS
@@ -56,10 +72,25 @@
{{ domain.name }}
-
+
@@ -105,18 +141,27 @@ import { ref, onMounted } from 'vue'
import dropdown from '@preline/dropdown'
import { domainApi } from '../api/domain.ts'
import DomainDelete from './DomainDelete.vue'
+import DomainEdit from './DomainEdit.vue'
import DomainVerify from './DomainVerify.vue'
-const props = defineProps(['domain'])
+const props = defineProps(['domain', 'recipients'])
const domain = ref(props.domain)
+const recipients = ref(props.recipients)
-const updateDomain = async () => {
+const updateActive = async () => {
domain.value.enabled = !domain.value.enabled
try {
await domainApi.update(domain.value.id, domain.value)
} catch {}
}
+const updateCatchAll = async () => {
+ domain.value.catch_all = !domain.value.catch_all
+ try {
+ await domainApi.update(domain.value.id, domain.value)
+ } catch {}
+}
+
const dnsRecordsVerified = () => {
return domain.value.owner_verified_at && domain.value.mx_verified_at && domain.value.send_verified_at
}
diff --git a/app/src/components/Domains.vue b/app/src/components/Domains.vue
index 2f3bb109..c731b475 100644
--- a/app/src/components/Domains.vue
+++ b/app/src/components/Domains.vue
@@ -20,13 +20,15 @@
Created
Domain
+ Recipient
Verification
Active
+ Catch-All
Actions
-
+
Error: {{ error }}
@@ -39,6 +41,7 @@
import { onMounted, ref } from 'vue'
import axios from 'axios'
import { domainApi } from '../api/domain.ts'
+import { recipientApi } from '../api/recipient.ts'
import DomainCreate from './DomainCreate.vue'
import DomainRow from './DomainRow.vue'
import events from '../events.ts'
@@ -54,6 +57,7 @@ const domain = {
}
const list = ref([] as typeof domain[])
+const recipients = ref([] as string[])
const error = ref('')
const loaded = ref(false)
const rowKey = ref(0)
@@ -77,7 +81,17 @@ const renderRow = () => {
rowKey.value++
}
-onMounted(() => {
+const getRecipients = async () => {
+ try {
+ const res = await recipientApi.getList()
+ recipients.value = res.data
+ .filter((item: { is_active: boolean }) => item.is_active)
+ .map((item: { email: string }) => item.email)
+ } catch {}
+}
+
+onMounted(async () => {
+ await getRecipients()
getList()
events.on('domain.create', getList)
events.on('domain.reload', getList)