feat(domains): enhance domain management with activation states and sync options
This commit is contained in:
@@ -93,6 +93,12 @@ export class CloudlyViewDns extends DeesElement {
|
||||
{ name: 'Create DNS Entry', action: async (modalArg: any) => {
|
||||
const form = modalArg.shadowRoot.querySelector('dees-form') as any;
|
||||
const formData = await form.gatherData();
|
||||
// Guard: only allow on activated domains
|
||||
const domain = (this.data.domains || []).find((d: any) => d.id === formData.domainId);
|
||||
if (!domain || (domain.data as any).activationState !== 'activated') {
|
||||
plugins.deesCatalog.DeesToast.createAndShow({ message: 'Selected domain is not activated. Activate it first.', type: 'error' });
|
||||
return;
|
||||
}
|
||||
await appstate.dataState.dispatchAction(appstate.createDnsEntryAction, { dnsEntryData: { type: formData.type, domainId: formData.domainId, zone: '', name: formData.name || '@', value: formData.value, ttl: parseInt(formData.ttl) || 3600, priority: formData.priority ? parseInt(formData.priority) : undefined, weight: formData.weight ? parseInt(formData.weight) : undefined, port: formData.port ? parseInt(formData.port) : undefined, active: formData.active, description: formData.description || undefined, }, });
|
||||
await modalArg.destroy();
|
||||
} },
|
||||
@@ -123,6 +129,13 @@ export class CloudlyViewDns extends DeesElement {
|
||||
{ name: 'Update DNS Entry', action: async (modalArg: any) => {
|
||||
const form = modalArg.shadowRoot.querySelector('dees-form') as any;
|
||||
const formData = await form.gatherData();
|
||||
if (formData.domainId) {
|
||||
const domain = (this.data.domains || []).find((d: any) => d.id === formData.domainId);
|
||||
if (!domain || (domain.data as any).activationState !== 'activated') {
|
||||
plugins.deesCatalog.DeesToast.createAndShow({ message: 'Selected domain is not activated. Activate it first.', type: 'error' });
|
||||
return;
|
||||
}
|
||||
}
|
||||
await appstate.dataState.dispatchAction(appstate.updateDnsEntryAction, { dnsEntryId: dnsEntry.id, dnsEntryData: { ...dnsEntry.data, type: formData.type, domainId: formData.domainId, zone: '', name: formData.name || '@', value: formData.value, ttl: parseInt(formData.ttl) || 3600, priority: formData.priority ? parseInt(formData.priority) : undefined, weight: formData.weight ? parseInt(formData.weight) : undefined, port: formData.port ? parseInt(formData.port) : undefined, active: formData.active, description: formData.description || undefined, }, });
|
||||
await modalArg.destroy();
|
||||
} },
|
||||
@@ -140,4 +153,3 @@ export class CloudlyViewDns extends DeesElement {
|
||||
}
|
||||
|
||||
declare global { interface HTMLElementTagNameMap { 'cloudly-view-dns': CloudlyViewDns; } }
|
||||
|
||||
|
Reference in New Issue
Block a user