Fixes Vague Error Messages In Setting Asset Model Default Values
Description
Fixes an issue when setting default values for custom fields on a model would error, but not show the field that errored or keep the custom fields shown.
Fixes #SC-25921
Type of change
Please delete options that are not relevant.
- [x] Bug fix (non-breaking change which fixes an issue)
Test Configuration:
- PHP version: 8.2
- MySQL version 8.1
PR Summary
-
Introduction of a new
validatorErrorsproperty A newvalidatorErrorsproperty has been added to theAssetModelsController. This property is used to store any errors that might occur during the validation process. -
Improved error handling in the
updatemethod Theupdatemethod within theAssetModelsControllerhas been updated. Instead of displaying a hardcoded error message when an issue arises, it now uses thevalidatorErrorsproperty. -
Validation error management in
assignCustomFieldsDefaultValuesmethod There is now a method for storing errors during theassignCustomFieldsDefaultValuesprocess. Any errors found during this process are held in thevalidatorErrorsproperty. -
Refinement of the
mountmethod in the Livewire component Themountmethod in the Livewire component now checks for errors stored in the session. Depending on the findings, it adjusts theadd_default_valuesproperty accordingly. -
Upgraded Blade template for the Custom Field Set The blade template handling Custom Field Set now uses
db_column_name()to handle errors. This replaces the previous hardcoded system and allows for more dynamic error management. -
Simplified handling of error message display Error message display handling has been simplified and consolidated across
custom_fields_form.blade.phpandedit.blade.php. -
Code readability improvements Unnecessary blank lines have been removed and whitespace adjusted for better readability across the various modified Blade templates.
This should be ready to go now, @snipe
Doesn't seem like it'll let me re-run codacy again after switching base branch, so 🤷♂️