archesproject / arches-her

5 stars 12 forks source link

Validation errors don't show in workflow UI #1232

Open SDScandrettKint opened 3 weeks ago

SDScandrettKint commented 3 weeks ago

Validation errors aren't shown or prevented in the workflows.

Example: If we create a designation URL in the Application Area workflow which isn't valid (because it isn't a HTTP/HTTPS URL) then the validation should prevent it from being saved and show a red banner at the top, as it would in the default resource data entry.

However, this error only occurs after the tiles are attempted to be saved, and if this is the case then the UI sort of breaks: image

and the error is only shown in the backend

2024-06-13 14:42:43,489 arches.app.views.tile ERROR    Unable to save. Please verify your input is valid [Tile id: ]                      [Exception message: TileValidationError: url error, {'url': 'test', 'url_label': 'test'}  - This is not a valid HTTP/HTTPS URL. Unable to save.]                      [Exception trace: Traceback (most recent call last):
  File "/home/samuel/arches_dev/arches_her/arches/arches/app/views/tile.py", line 144, in post
    tile.save(request=request, transaction_id=transaction_id)
  File "/home/samuel/arches_dev/arches_her/arches/arches/app/models/tile.py", line 456, in save
    self.validate([], request=request)
  File "/home/samuel/arches_dev/arches_her/arches/arches/app/models/tile.py", line 350, in validate
    raise TileValidationError(_("{0}".format(error_instance["message"])))
arches.app.models.tile.TileValidationError: "url error, {'url': 'test', 'url_label': 'test'}  - This is not a valid HTTP/HTTPS URL. Unable to save."
]
Internal Server Error: /tile

Validation only occurs on save which is problematic when adding multiple tiles to save all in bulk.