DAST site validation - Set correct validation-toggle state when editing a profile
Problem to solve
When a user has previously enabled site validation and then comes back to edit the profile, we want to set the validation-toggle, loading states and messages on the edit form accordingly.
Currently it would be toggled off, unless the site has been validated successfully.
Possible solution
Leverage the profile's state, which we retrieve from the dastSiteValidation
query, to set the toggle.
This are the possible states:
const states = {
PENDING_VALIDATION: "PENDING_VALIDATION",
INPROGRESS_VALIDATION: "INPROGRESS_VALIDATION",
PASSED_VALIDATION: "PASSED_VALIDATION",
FAILED_VALIDATION: "FAILED_VALIDATION",
};
When the validation is in-progress (state === "INPROGRESS_VALIDATION"
) the toggle should be set to disabled
and a message that indicates that a validation is in-progress should be show:
When the validation has failed (state === "FAILDED_VALIDATION"
) the toggle should be set to off, a message should be shown and a retry
button displayed, that when clicked resets the error message and toggles the validate site
status on: