-
Notifications
You must be signed in to change notification settings - Fork 18
Input validation for property value #548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input validation for property value #548
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR. This is a very useful addition to the BaSyx UI. I added one remark to the PropertyForm component.
aas-web-ui/src/components/EditorComponents/SubmodelElements/PropertyForm.vue
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds client-side validation for the Property value input field and replaces navigation-based SME refresh with an explicit fetch-and-dispatch approach across all SubmodelElement forms to ensure updated elements are displayed.
- Introduces
validateAndCorrectInput
inPropertyForm.vue
with regex-based checks for all XSD data types. - Replaces
router.push
calls withfetchAndDispatchSme
in all SubmodelElement form components. - Updates
TextInput
andBooleanInput
components to support error messages and string-boolean handling.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
src/components/EditorComponents/SubmodelElements/RangeForm.vue | Replaced router pushes with fetchAndDispatchSme . |
src/components/EditorComponents/SubmodelElements/PropertyForm.vue | Added input validation, error messaging, and SME refresh fix. |
src/components/EditorComponents/SubmodelElements/MLPForm.vue | Replaced router pushes with fetchAndDispatchSme . |
src/components/EditorComponents/SubmodelElements/ListForm.vue | Replaced router pushes with fetchAndDispatchSme . |
src/components/EditorComponents/SubmodelElements/FileForm.vue | Replaced router pushes with fetchAndDispatchSme . |
src/components/EditorComponents/SubmodelElements/CollectionForm.vue | Replaced router pushes with fetchAndDispatchSme . |
src/components/EditorComponents/SubmodelElements/BlobForm.vue | Replaced router pushes with fetchAndDispatchSme . |
src/components/EditorComponents/InputTypes/TextInput.vue | Added errorMessages prop and bound it to the field. |
src/components/EditorComponents/InputTypes/BooleanInput.vue | Expanded modelValue to `boolean |
Comments suppressed due to low confidence (1)
aas-web-ui/src/components/EditorComponents/SubmodelElements/PropertyForm.vue:227
- [nitpick] The new validation logic covers many data types but lacks automated tests; add unit tests for each branch (e.g., Integer, Decimal, DateTime) to ensure correctness.
function validateAndCorrectInput(): boolean {
Description of Changes
This PR adds validation for property value input field.
Note: Unfortunately, I haven't found an adequate js library for checking a string regarding xs data types.
This PR fixes also a bug, where updated props of SMEs will not be shown in the SubmodelElementView after clicking the save button (router.push of an unchanged path does not cause a new fetching and dipatching of the selected SME, explicit fetch and dispatch needed).
This PR also fixes the components.d.ts regarding the deleted components of PR #612.
Related Issue
Closes #446