Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove some validations for domain sets #430

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ function runFieldValidators(
return validators.every((validator) => validator.valid)
}

function validateRecordsRequired() {
let totalChars = 0

function validateRecords() {
for (const record of records.value) {
if (!record) {
return { valid: false, errMessage: 'error.empty_domains' }
Expand All @@ -137,14 +135,6 @@ function validateRecordsRequired() {
if (!valid) {
return { valid: false, errMessage: 'error.invalid_domains' }
}
totalChars += record.length
}

if (totalChars >= 960) {
return {
valid: false,
errMessage: 'error.domains_total_chars_exceeded'
}
}
return { valid: true }
}
Expand Down Expand Up @@ -174,7 +164,7 @@ function validate() {
nameRef
],
// records
[[validateRecordsRequired()], 'ipaddr', recordRef]
[[validateRecords()], 'domain', recordRef]
]

// reset firstErrorRef for focus management
Expand Down Expand Up @@ -281,10 +271,10 @@ async function saveDomainSet() {
/>
<!-- records invalid message -->
<p
v-if="errorBag.getFirstI18nKeyFor('ipaddr')"
v-if="errorBag.getFirstI18nKeyFor('domain')"
:class="'mt-2 text-sm text-rose-700 dark:text-rose-400'"
>
{{ t(errorBag.getFirstI18nKeyFor('ipaddr')) }}
{{ t(errorBag.getFirstI18nKeyFor('domain')) }}
</p>
<!-- save domain set error notification -->
<NeInlineNotification
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
"invalid_ipaddr": "One or more records are invalid",
"empty_domains": "One or more domains are empty",
"invalid_domains": "One or more domains are invalid",
"domains_total_chars_exceeded": "Total characters of all domains must not exceed 960. Please remove some domains or create a new domain set.",
"total_chars_exceeded": "There are too many domains. Please remove some and include them in a new domain set.",
"cannot_delete_host_set": "Cannot delete host set",
"cannot_delete_domain_set": "Cannot delete domain set",
"cannot_retrieve_host_sets": "Cannot retrieve host sets",
Expand Down