feat: Added DPP visualization and EcoPass KIT#391
Conversation
🧪 Test Summary🎉 Status: SUCCESS📊 Backend Tests
Run Details
|
- Introduced a new passport type for generic digital product passports. - Created base components for passport visualization including GeneralInfoCard, ManufacturingCard, SustainabilityCard, and MaterialsCard. - Implemented MaterialCompositionRenderer for displaying material composition data. - Added mock data for testing purposes. - Registered the new passport type in the central registry. - Enhanced icon mapping for category-specific icons in metric cards. - Updated schema parser to include category information. - Adjusted navigation links in ShareDialog and AddSerializedPartDialog to include fragment identifiers for better user experience.
…ing functionality
- Added a function to extract and format passport types from semantic IDs. - Introduced a dialog view mode toggle between card and table views. - Implemented sticky search bar and improved carousel controls with visual gradients. - Enhanced card and table layouts for better readability and user interaction. - Added QR code display and improved information sections for each passport. - Updated button styles and hover effects for better user experience. - Refactored code for better maintainability and readability.
…d adjust z-index for improved UI
…/consumer-dpp/dtr-submodel-query-fix-optimization
…-submodel-query-fix-optimization fix: purge submodel negotiation edr from cache
72d2378 to
b7d4487
Compare
CDiezRodriguez
left a comment
There was a problem hiding this comment.
Excellent work. I’ve tested it successfully in both my local environment and our cloud environment.
…and updating install commands
…ility with HTTP adapter
…entication support
…nal-api-compatible-submodel-service feat: Allow use of external api compatible submodel service
| {{- if .Values.backend.configuration.provider.submodel_dispatcher.http.auth.enabled }} | ||
| - name: SUBMODEL_SERVICE_TOKEN | ||
| valueFrom: | ||
| secretKeyRef: |
Check notice
Code scanning / KICS
Secrets As Environment Variables Note
| self._semantic_id_cache[sha256_hash] = semantic_id | ||
| self.logger.debug(f"Cached semantic_id mapping: {sha256_hash[:16]}... -> {semantic_id}") | ||
|
|
||
| def __del__(self): |
Check notice
Code scanning / CodeQL
Overly complex `__del__` method Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 2 months ago
In general, we should avoid putting resource-release logic directly into __del__. Instead, define an explicit cleanup method like close() that callers can invoke deterministically (or use via a context manager), and have __del__ delegate to that method. This keeps __del__ simple while preserving existing behavior.
For this specific file (ichub-backend/managers/enablement_services/adapters/http_submodel_adapter.py), we can:
- Extract the logic from
__del__into a newclose(self) -> Nonemethod onHttpSubmodelAdapter. - Simplify
__del__so that it just callsself.close()inside a smalltry/except(keeping the existing safety against exceptions during garbage collection). - Keep logging behavior identical, so existing observability is unchanged.
Concretely, around lines 516–523:
- Replace the current body of
__del__with:- A
close()method that:- Checks
hasattr(self, "client"). - Calls
self.client.close(). - Logs success.
- Catches and logs any exceptions.
- Checks
- A simplified
__del__that just callsself.close()inside atry/exceptand logs a warning on error.
- A
No new imports are needed; we reuse the existing logger and httpx client attribute.
| @@ -513,11 +513,27 @@ | ||
| self._semantic_id_cache[sha256_hash] = semantic_id | ||
| self.logger.debug(f"Cached semantic_id mapping: {sha256_hash[:16]}... -> {semantic_id}") | ||
|
|
||
| def __del__(self): | ||
| """Cleanup HTTP client on adapter destruction.""" | ||
| def close(self) -> None: | ||
| """ | ||
| Explicitly close the underlying HTTP client. | ||
|
|
||
| This method should be called when the adapter is no longer needed | ||
| to ensure that all HTTP resources are released in a timely manner. | ||
| """ | ||
| try: | ||
| if hasattr(self, 'client'): | ||
| if hasattr(self, "client"): | ||
| self.client.close() | ||
| self.logger.debug("HTTP client closed") | ||
| except Exception as e: | ||
| # Log and suppress any errors during explicit close to avoid | ||
| # impacting callers that are attempting to clean up. | ||
| self.logger.warning(f"Error closing HTTP client: {e}") | ||
|
|
||
| def __del__(self): | ||
| """Cleanup HTTP client on adapter destruction.""" | ||
| try: | ||
| # Delegate cleanup to the explicit close() method. | ||
| self.close() | ||
| except Exception as e: | ||
| # Suppress any exceptions raised during garbage collection. | ||
| self.logger.warning(f"Error in __del__ while closing HTTP client: {e}") |
| def _execute_submodel_operation( | ||
| self, | ||
| operation: OperationType, | ||
| submodel_id: UUID, | ||
| semantic_id: str, | ||
| payload: Dict[str, Any] | None = None | ||
| ) -> Dict[str, Any] | None: |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 2 months ago
In general, to fix “explicit returns mixed with implicit returns”, ensure that every control-flow path in the function ends with an explicit return statement, even when the function is intended to return None. For _execute_submodel_operation, the intent (per docstring and annotation) is that read operations return a Dict[str, Any] and write/delete operations return None. The most conservative fix, without changing any behavior, is to add a final return None at the end of the function body so that any path that currently falls off the end now explicitly returns None.
Since we must not assume or modify the unseen internal logic (lines 263–306), we will only add a single line at the end of _execute_submodel_operation, immediately before the next method definition (upload_twin_aspect_document). This ensures that: (1) existing explicit return statements (e.g., for read operations) still work unchanged; (2) any path without an explicit return now returns None, which matches the documented contract for write/delete operations; and (3) CodeQL’s complaint about mixed explicit/implicit returns is eliminated. No new imports or helper methods are required.
| @@ -304,6 +304,9 @@ | ||
| self.logger.info("Submodel deleted successfully.") | ||
| return None | ||
|
|
||
| # End of operation handling | ||
| return None | ||
|
|
||
| def upload_twin_aspect_document( | ||
| self, | ||
| submodel_id: UUID, |
WHAT
WHY
Currently, most of the feature configuration was hardocoded and not fitting to the overall architecture from the side bar.
FURTHER NOTES
List other areas of code that have changed but are not necessarily linked to the main feature. This could be method signature changes, package declarations, bugs that were encountered and were fixed inline, etc.
Closes # <-- insert Issue number if one exists