mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 03:58:39 +02:00
Change generic connection error message, test for 13 nameservers on pageload
This commit is contained in:
parent
3a1c64206f
commit
8b2ea986b1
5 changed files with 21 additions and 14 deletions
|
@ -315,7 +315,6 @@ function prepareDeleteButtons(formLabel) {
|
||||||
if (isNameserversForm && forms.length < 3) {
|
if (isNameserversForm && forms.length < 3) {
|
||||||
// Hide the delete buttons on the remaining nameservers
|
// Hide the delete buttons on the remaining nameservers
|
||||||
Array.from(form.querySelectorAll('.delete-record')).forEach((deleteButton) => {
|
Array.from(form.querySelectorAll('.delete-record')).forEach((deleteButton) => {
|
||||||
// deleteButton.classList.add("display-none");
|
|
||||||
deleteButton.setAttribute("disabled", "true");
|
deleteButton.setAttribute("disabled", "true");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -345,6 +344,11 @@ function prepareDeleteButtons(formLabel) {
|
||||||
formLabel = "DS Data record";
|
formLabel = "DS Data record";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// On load: Disable the add more button if we have 13 forms
|
||||||
|
if (isNameserversForm && document.querySelectorAll(".repeatable-form").length == 13) {
|
||||||
|
addButton.setAttribute("disabled", "true");
|
||||||
|
}
|
||||||
|
|
||||||
// Attach click event listener on the delete buttons of the existing forms
|
// Attach click event listener on the delete buttons of the existing forms
|
||||||
prepareDeleteButtons(formLabel);
|
prepareDeleteButtons(formLabel);
|
||||||
|
|
||||||
|
@ -361,7 +365,7 @@ function prepareDeleteButtons(formLabel) {
|
||||||
let formExampleRegex = RegExp(`ns(\\d){1}`, 'g');
|
let formExampleRegex = RegExp(`ns(\\d){1}`, 'g');
|
||||||
|
|
||||||
// Some Nameserver form checks since the delete can mess up the source object we're copying
|
// Some Nameserver form checks since the delete can mess up the source object we're copying
|
||||||
// in regards to required fileds and hidden delete buttons
|
// in regards to required fields and hidden delete buttons
|
||||||
if (isNameserversForm) {
|
if (isNameserversForm) {
|
||||||
|
|
||||||
// If the source element we're copying has required on an input,
|
// If the source element we're copying has required on an input,
|
||||||
|
@ -383,7 +387,6 @@ function prepareDeleteButtons(formLabel) {
|
||||||
// enable that button
|
// enable that button
|
||||||
let deleteButton= newForm.querySelector('.delete-record');
|
let deleteButton= newForm.querySelector('.delete-record');
|
||||||
if (deleteButton.hasAttribute("disabled")) {
|
if (deleteButton.hasAttribute("disabled")) {
|
||||||
// newForm.querySelector('.delete-record').classList.remove("display-none");
|
|
||||||
deleteButton.removeAttribute("disabled");
|
deleteButton.removeAttribute("disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -439,7 +442,6 @@ function prepareDeleteButtons(formLabel) {
|
||||||
|
|
||||||
// Disable the add more button if we have 13 forms
|
// Disable the add more button if we have 13 forms
|
||||||
if (isNameserversForm && formNum == 13) {
|
if (isNameserversForm && formNum == 13) {
|
||||||
// addButton.classList.add("display-none");
|
|
||||||
addButton.setAttribute("disabled", "true");
|
addButton.setAttribute("disabled", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,7 +449,6 @@ function prepareDeleteButtons(formLabel) {
|
||||||
// Enable the delete buttons on the nameservers
|
// Enable the delete buttons on the nameservers
|
||||||
forms.forEach((form, index) => {
|
forms.forEach((form, index) => {
|
||||||
Array.from(form.querySelectorAll('.delete-record')).forEach((deleteButton) => {
|
Array.from(form.querySelectorAll('.delete-record')).forEach((deleteButton) => {
|
||||||
// deleteButton.classList.remove("display-none");
|
|
||||||
deleteButton.removeAttribute("disabled");
|
deleteButton.removeAttribute("disabled");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,7 +42,7 @@ class DomainNameserverForm(forms.Form):
|
||||||
# add custom error messages
|
# add custom error messages
|
||||||
self.fields["server"].error_messages.update(
|
self.fields["server"].error_messages.update(
|
||||||
{
|
{
|
||||||
"required": "A minimum of 2 Name Servers are required.",
|
"required": "A minimum of 2 name servers are required.",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
type="submit"
|
type="submit"
|
||||||
class="usa-button usa-button--outline"
|
class="usa-button usa-button--outline"
|
||||||
name="btn-cancel-click"
|
name="btn-cancel-click"
|
||||||
aria-label="Reset the data in the Name Server form to the registry state (undo changes)"
|
aria-label="Reset the data in the name server form to the registry state (undo changes)"
|
||||||
>Cancel
|
>Cancel
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1466,7 +1466,7 @@ class TestDomainNameservers(TestDomainOverview):
|
||||||
# the required field. form requires a minimum of 2 name servers
|
# the required field. form requires a minimum of 2 name servers
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
result,
|
result,
|
||||||
"A minimum of 2 Name Servers are required.",
|
"A minimum of 2 name servers are required.",
|
||||||
count=2,
|
count=2,
|
||||||
status_code=200,
|
status_code=200,
|
||||||
)
|
)
|
||||||
|
@ -1639,7 +1639,7 @@ class TestDomainNameservers(TestDomainOverview):
|
||||||
# once around each required field.
|
# once around each required field.
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
result,
|
result,
|
||||||
"A minimum of 2 Name Servers are required.",
|
"A minimum of 2 name servers are required.",
|
||||||
count=4,
|
count=4,
|
||||||
status_code=200,
|
status_code=200,
|
||||||
)
|
)
|
||||||
|
@ -1810,7 +1810,11 @@ class TestDomainSecurityEmail(TestDomainOverview):
|
||||||
(
|
(
|
||||||
"RegistryError",
|
"RegistryError",
|
||||||
form_data_registry_error,
|
form_data_registry_error,
|
||||||
"Update failed. Cannot contact the registry.",
|
"""
|
||||||
|
We’re experiencing a system connection error. Please wait a few minutes
|
||||||
|
and try again. If you continue to receive this error after a few tries,
|
||||||
|
contact help@get.gov
|
||||||
|
""",
|
||||||
),
|
),
|
||||||
("ContactError", form_data_contact_error, "Value entered was wrong."),
|
("ContactError", form_data_contact_error, "Value entered was wrong."),
|
||||||
(
|
(
|
||||||
|
@ -1845,7 +1849,7 @@ class TestDomainSecurityEmail(TestDomainOverview):
|
||||||
self.assertEqual(len(messages), 1)
|
self.assertEqual(len(messages), 1)
|
||||||
message = messages[0]
|
message = messages[0]
|
||||||
self.assertEqual(message.tags, message_tag)
|
self.assertEqual(message.tags, message_tag)
|
||||||
self.assertEqual(message.message, expected_message)
|
self.assertEqual(message.message.strip(), expected_message.strip())
|
||||||
|
|
||||||
def test_domain_overview_blocked_for_ineligible_user(self):
|
def test_domain_overview_blocked_for_ineligible_user(self):
|
||||||
"""We could easily duplicate this test for all domain management
|
"""We could easily duplicate this test for all domain management
|
||||||
|
|
|
@ -39,9 +39,11 @@ class GenericError(Exception):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_error_mapping = {
|
_error_mapping = {
|
||||||
GenericErrorCodes.CANNOT_CONTACT_REGISTRY: (
|
GenericErrorCodes.CANNOT_CONTACT_REGISTRY: """
|
||||||
"Update failed. Cannot contact the registry."
|
We’re experiencing a system connection error. Please wait a few minutes
|
||||||
),
|
and try again. If you continue to receive this error after a few tries,
|
||||||
|
contact help@get.gov
|
||||||
|
""",
|
||||||
GenericErrorCodes.GENERIC_ERROR: ("Value entered was wrong."),
|
GenericErrorCodes.GENERIC_ERROR: ("Value entered was wrong."),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue