-
Notifications
You must be signed in to change notification settings - Fork 18
Adds JSON insert to editor #683
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
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.
Pull Request Overview
This PR adds functionality to insert (import) Submodels and SubmodelElements from JSON input through dialog components. Users can now create new Submodels or SubmodelElements by pasting JSON data into a textarea dialog.
- Adds JSON import dialog component with validation and parsing
- Updates Treeview component to include JSON import menu options
- Integrates JSON import functionality into SubmodelTree with proper event handling
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
aas-web-ui/src/components/UIComponents/Treeview.vue |
Adds menu items and event handling for JSON import functionality |
aas-web-ui/src/components/SubmodelTree.vue |
Integrates JSON import dialog and adds button for Submodel JSON import |
aas-web-ui/src/components/EditorComponents/JsonInsert.vue |
New component implementing JSON import dialog with validation and API calls |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -303,6 +324,7 @@ | |||
(event: 'openEditDialog', item: any): void; | |||
(event: 'showDeleteDialog', item: any): void; | |||
(event: 'openAddSubmodelElementDialog', item: any): void; | |||
(event: 'openJsonInsertDialog', type: 'Submodel' | 'SubmodelElement'): void; |
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.
The emit signature expects a type
parameter, but the actual emit calls pass an item
parameter instead. For example, line 165 calls $emit('openJsonInsertDialog', item)
but the signature expects type: 'Submodel' | 'SubmodelElement'
.
Copilot uses AI. Check for mistakes.
if (instanceOrError.error !== null) { | ||
console.error('Error parsing Submodel: ', instanceOrError.error); |
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.
The error is only logged to console but not shown to the user. Consider setting jsonInputErrors.value
to display a user-friendly error message when JSON parsing fails.
if (instanceOrError.error !== null) { | |
console.error('Error parsing Submodel: ', instanceOrError.error); | |
console.error('Error parsing Submodel: ', instanceOrError.error); | |
jsonInputErrors.value = [ | |
'Failed to parse Submodel: ' + (instanceOrError.error.message || instanceOrError.error.toString()) | |
]; |
Copilot uses AI. Check for mistakes.
if (instanceOrError.error !== null) { | ||
console.error('Error parsing SubmodelElement: ', instanceOrError.error); | ||
return; | ||
} |
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.
Similar to the Submodel parsing error, this error is only logged to console but not shown to the user. Consider setting jsonInputErrors.value
to display a user-friendly error message when JSON parsing fails.
Copilot uses AI. Check for mistakes.
if (instanceOrError.error !== null) { | ||
console.error('Error parsing AAS: ', instanceOrError.error); | ||
return; | ||
} |
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.
The AAS parsing error is only logged to console. Consider showing a user-friendly error message or handling this error more gracefully since it affects the core functionality.
Copilot uses AI. Check for mistakes.
Description of Changes
This PR adds the option to insert (import) Submodels and SubmodelElements from JSON.