Skip to content

Conversation

OkCool5
Copy link
Contributor

@OkCool5 OkCool5 commented May 23, 2025

Pull Request: JSON-Template-Automated-AAS-Creation

Description of Changes

This pull request introduces the TemplateAASPlugin to the BaSyx Editor Plugin, enabling dynamic JSON template loading and template-based Asset Administration Shell (AAS) creation within the BaSyx-UI. Key changes include:

  • Added TemplateAASPlugin in UserPlugins/TemplateAASPlugin/ with:
    • Dynamic Template Loading: Uses Vite’s import.meta.glob to load JSON templates (carbon-footprint-template.json, contact-information-template.json, technical-data-template.json) from templates/.
    • UI Components: Implemented TemplateBasedAASCreator.vue with a stepper-based dialog for AAS creation, supporting multi-language inputs (ID Short, Display Name, Description).
    • Services: Added TemplateStorageService.ts, TemplateValidatorService.ts, and TemplateBasedAASCreator.ts for template management, schema validation, and AAS creation via BaSyx backend API.
    • Validation: Validates templates against template-schemas.json and handles user input errors.
    • Integration: Updates AASList for the template-dialog initialization.

Related Issue

Resolves #TINF23F-123

BaSyx Configuration for Testing

To test the changes, configure the BaSyx backend as follows:

  • BaSyx Backend: Ensure the BaSyx server is running with REST API enabled (POST /aas and GET /aas/:id/endpoint endpoints).
  • Environment:
    • Node.js v18.x, npm v9.x, Vite v5.x.
    • Install dependencies via npm install in the project root.
    • Build the plugin with npm run build to generate basyx_editor_plugin.js.
  • Configuration:
    • Place the plugin in the BaSyx-UI’s plugin directory.
    • Ensure the templates/ directory contains carbon-footprint-template.json, contact-information-template.json, technical-data-template.json, and template-schemas.json.

AAS Files Used for Testing

  • Files:
    • carbon-footprint-template.json: Tests AAS creation with environmental submodel data.
    • contact-information-template.json: Tests AAS creation with contact-related submodel data.
    • technical-data-template.json: Tests AAS creation with technical specifications.
    • product-quality-testing-template.json: Tests AAS creation with quality testing specifications.
  • Relevance: These files validate dynamic template loading, schema compliance, and backend API integration for AAS creation.
    • Available in UserPlugins/TemplateAASPlugin/templates/.

Additional Information

  • Challenges:
    Fixed template validation issues by adding missing fields (e.g., aasVersion, version) to JSON files.
    TemplateBasedAASCreator.ts.
  • Alternative Solutions:
    • Considered static template imports but chose import.meta.glob for scalability and hot-reloading support.
    • Evaluated JSON Schema Validator vs. custom validation; chose schema-based for maintainability.
  • Future Improvements:
    • Add caching for loaded templates to improve performance.
    • Enhance schema validation for advanced AAS constraints.

Testing Confirmation: The changes have been thoroughly tested to ensure templates load correctly, the UI dialog functions as expected, and AAS creation succeeds with valid inputs.

This pull request introduces the `TemplateAASPlugin` for the BaSyx-UI, enabling dynamic JSON template loading and template-based Asset Administration Shell (AAS) creation. Key features include:

- **Dynamic Template Loading**: Uses Vite’s `import.meta.glob` to load JSON templates (`carbon-footprint-template.json`, `contact-information-template.json`, `technical-data-template.json`) from `templates/`, validated against `template-schemas.json`.
- **Stepper-Based UI**: Implements `TemplateBasedAASCreator.vue` with Basic Information and Review steps for user-friendly AAS creation, supporting multi-language inputs.
- **Services**: Adds `TemplateStorageService.ts`, `TemplateValidatorService.ts`, and `TemplateBasedAASCreator.ts` for template management, validation, and AAS creation via BaSyx backend API.
- **Integration**: Updates `AASList` for the template-dialog initialization.

All changes except the AASList implementation are located in ./UserPlugins/TemplateAASPlugin.
Templates are located under ./UserPlugins/TemplateAASPlugin/Templates.
Fixes validation issues in templates and improves modularity for future extensibility.

Signed-off-by: Daniel Serban <inf23081@lehre.dhbw-stuttgart.de>
@OkCool5
Copy link
Contributor Author

OkCool5 commented May 23, 2025

@mrentsch65

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