Skip to content

Conversation

aaronzi
Copy link
Member

@aaronzi aaronzi commented Aug 29, 2025

Description of Changes

This PR adds the option to insert (import) Submodels and SubmodelElements from JSON.

image image

@aaronzi aaronzi requested a review from Copilot August 29, 2025 21:26
Copy link
Contributor

@Copilot Copilot AI left a 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;
Copy link
Preview

Copilot AI Aug 29, 2025

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.

Comment on lines 100 to 101
if (instanceOrError.error !== null) {
console.error('Error parsing Submodel: ', instanceOrError.error);
Copy link
Preview

Copilot AI Aug 29, 2025

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.

Suggested change
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.

Comment on lines 121 to 124
if (instanceOrError.error !== null) {
console.error('Error parsing SubmodelElement: ', instanceOrError.error);
return;
}
Copy link
Preview

Copilot AI Aug 29, 2025

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.

Comment on lines +170 to +173
if (instanceOrError.error !== null) {
console.error('Error parsing AAS: ', instanceOrError.error);
return;
}
Copy link
Preview

Copilot AI Aug 29, 2025

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.

@aaronzi aaronzi merged commit 50dce28 into eclipse-basyx:main Aug 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant