fleet/frontend/components/forms/validators
jacobshandling 748b5bcd51
Full-stack: Make "Server url" validation conditions consistent across Fleet, update Web Address form validation and submission logic per Fleet best practices (frontend/docs/patterns.md) (#27455)
## For #27454 

Consider Fleet web URL to be valid if it:

- (Front end and back end): uses “https://” or “http://” scheme
 and
- (Front end) accepts only valid or "localhost" hosts (e.g., "a.b.cc" or
"localhost", but not "a.b")
- (Back end) accepts any host (e.g., "localhost", "a.b.cc", or even
"a.b")


### Setup flow UI URL validation:

![setup](https://github.com/user-attachments/assets/34a428d2-5731-46f2-b708-c88b790e3667)

### Org settings UI URL validation:

![org-settings](https://github.com/user-attachments/assets/147916c8-9c5b-4ae7-9e14-625c65b42d0a)

### Server URL validation:
<img width="1464" alt="invalid-url-server"
src="https://github.com/user-attachments/assets/83a112e1-6318-4b09-864d-fe66a223835d"
/>

### Invalid Fleet server URL in DB error:

![invalid-url-in-db](https://github.com/user-attachments/assets/aae591fb-6cc3-49bd-8556-22129be4c2c4)


- [x] Changes file added for user-visible changes in `changes/`,
- [x] Added/updated automated tests
- [ ] A detailed QA plan exists on the associated ticket (if it isn't
there, work with the product group's QA engineer to add it)
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-03-27 13:56:38 -07:00
..
valid_email Frontend: Improve URL and email validation (#18445) 2024-04-25 13:03:30 -04:00
valid_jwt_token License features (#1134) 2017-02-09 22:16:51 -05:00
valid_password Fleet UI: No role = no access, refactor jsx class components to typescript functional components (#12953) 2023-08-02 11:29:49 -04:00
valid_url Full-stack: Make "Server url" validation conditions consistent across Fleet, update Web Address form validation and submission logic per Fleet best practices (frontend/docs/patterns.md) (#27455) 2025-03-27 13:56:38 -07:00
validate_equality Fleet UI: No role = no access, refactor jsx class components to typescript functional components (#12953) 2023-08-02 11:29:49 -04:00
validate_numericality Create packs (#516) 2016-12-21 12:25:54 -05:00
validate_presence Fleet UI: 2FA (#24442) 2024-12-05 15:54:43 -05:00
validate_query add prettier and have it format all fleet application code (#625) 2021-04-12 14:32:25 +01:00
validate_yaml Updated API routes to use current format for frontend use (#5018) 2022-04-11 13:04:38 -07:00