Can prefill some tabs with the required property

This commit is contained in:
nemunaire 2024-01-17 17:45:24 +01:00
parent 94f625cd54
commit 8052370e6b
2 changed files with 6 additions and 4 deletions

View File

@ -35,9 +35,9 @@ import (
)
type EMail struct {
MX []svcs.MX `json:"mx,omitempty" happydomain:"label=EMail Servers"`
MX []svcs.MX `json:"mx,omitempty" happydomain:"label=EMail Servers,required"`
SPF *svcs.SPF `json:"spf,omitempty" happydomain:"label=Sender Policy Framework"`
DKIM map[string]*svcs.DKIM `json:"dkim,omitempty" happydomain:"label=Domain Keys"`
DKIM map[string]*svcs.DKIM `json:"dkim,omitempty" happydomain:"label=Domain Keys,required"`
DMARC *svcs.DMARC `json:"dmarc,omitempty" happydomain:"label=DMARC"`
MTA_STS *svcs.MTA_STS `json:"mta_sts,omitempty" happydomain:"label=Strict Transport Security"`
TLS_RPT *svcs.TLS_RPT `json:"tls_rpt,omitempty" happydomain:"label=TLS Reporting"`

View File

@ -55,9 +55,11 @@
});
// Initialize unexistant objects and arrays, except standard types.
$: if (innerSpecs && !(specs && specs.tabs)) {
$: if (innerSpecs) {
for (const spec of innerSpecs) {
fillUndefinedValues(value, spec);
if (!(specs && specs.tabs) || spec.required) {
fillUndefinedValues(value, spec);
}
}
}