Skip to content
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

feat(react-components): add support for Hybrid CAD asset mappings for hybrid projects #4975

Open
wants to merge 42 commits into
base: master
Choose a base branch
from

Conversation

danpriori
Copy link
Contributor

@danpriori danpriori commented Feb 2, 2025

Type of change

Feat

Jira ticket 📘

BND3D-4989

https://cognitedata.atlassian.net/browse/

Description 📝

Adds the support for Hybrid CAD asset mappings in hybrid projects using the classic endpoints of the list and filter of the assetMappings3D API, which are connected to DMS instances of the CDM Asset (CogniteAssets).

Because it uses a hybrid connection method (using the classic endpoints but mapped with the CDM Asset instance and in a currently limited way), it was necessary to create a separate line for retrieving, filtering and processing this mapping that is not raw via FDM or via Classic Assets. However, abstracting this logic from the user, where the user views the Cognite Asset mappings in a similar way as if it were a Core DM Only project in the 3D Browser side panel.

With this feature, it is possible to:

  • Visualize the list of Cognite Asset asset mappings,
  • Click on each mapping
  • View the asset in the Preview panel
  • View the highlight of the 3D nodes involved in the mapping in the 3D viewer.

Note 1: This PR should be seen together with the PR on Fusion:

Note 2: the support only works with Cognite JS SDK v10 latest

Test instructions ℹ️

  1. Go to the lervik-industries cog-demo (or any hybrid project that has hybrid contextualization).
  2. Choose the Fornebu scene and the Cognite Asset category (the last one in the list). Some mappings will appear
  3. Click on one of them
  4. Observe

You will see the 3d nodes involved being focused and highlighted, in addition to the preview panel appearing with the Cognite Asset data.

hybrid-cad-mappings.webm

Checklist ☑️

  • I am proud of this feature.
  • I have performed a self-review of my own code.
  • I have added PR type (Feat, Bug, Chore, Test, Docs, Style, Refactor) to the PR title.
  • I have manually tested this for different scenarios (different models, formats, devices, browsers).
  • I have commented my code in hard-to-understand areas.
  • I have made corresponding changes to the public documentation.
  • I have added unit and visuals tests to prove that my feature works to the best of my ability.
  • I have refactored the code for readability to the best of my ability.
  • I have checked that my changes do not introduce regressions in the public documentation.
  • I have outlined any known defects / lacking capabilities in the contents of this PR.
  • I have listed any remaining work that should follow this PR in the description or jira/miro/etc.
  • I have added TSDoc to any public facing changes.
  • I have added "developer documentation" in any package README.md that is related / applicable to this PR.
  • I have noted down and am currently tracking any technical debt introduced in this PR.
  • I have thoroughly thought about the architecture of this implementation.
  • I have asked peers to test this feature.

Copy link
Contributor

@pramod-cog pramod-cog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have reviewed half way as it contain big changes, will look into the rest and have to test tomorrow.

…odelCache.ts

Co-authored-by: pramod-cog <pramod.s@cognite.com>
…-for-core-dm-mappings-along-with-classic' into danpriori/BND3D-4989-add-support-for-core-dm-mappings-along-with-classic
…-for-core-dm-mappings-along-with-classic' into danpriori/BND3D-4989-add-support-for-core-dm-mappings-along-with-classic
… global const and fix the click 3d node of hybrid mappings
Copy link

codecov bot commented Feb 24, 2025

Codecov Report

Attention: Patch coverage is 10.68648% with 1262 lines in your changes missing coverage. Please review.

Project coverage is 18.36%. Comparing base (dfe17bb) to head (adaa3ae).
Report is 667 commits behind head on master.

Files with missing lines Patch % Lines
...onents/CacheProvider/AssetMappingAndNode3DCache.ts 5.64% 234 Missing ⚠️
...rc/query/useSearchMappedEquipmentAssetMappings.tsx 0.00% 146 Missing ⚠️
...src/utilities/fetchMappedEquipmentAssetMappings.ts 0.00% 90 Missing and 1 partial ⚠️
...veal3DResources/hooks/useCalculateMappedStyling.ts 9.57% 85 Missing ⚠️
...t-components/stories/utilities/SearchComponent.tsx 0.00% 72 Missing ⚠️
...ponents/CacheProvider/AssetMappingPerModelCache.ts 7.24% 64 Missing ⚠️
...al3DResources/hooks/useCalculateInstanceStyling.ts 14.70% 58 Missing ⚠️
...components/src/hooks/cad/useHybridAssetMappings.ts 16.66% 55 Missing ⚠️
...ooks/utils/calculateAssetMappingCadModelStyling.ts 10.00% 27 Missing ⚠️
...ts/Reveal3DResources/hooks/useJoinStylingGroups.ts 18.75% 26 Missing ⚠️
... and 53 more
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4975       +/-   ##
===========================================
- Coverage   71.10%   18.36%   -52.74%     
===========================================
  Files         378      703      +325     
  Lines       38591    37322     -1269     
  Branches     2774      615     -2159     
===========================================
- Hits        27442     6856    -20586     
- Misses      11039    30198    +19159     
- Partials      110      268      +158     
Files with missing lines Coverage Δ
...re/concrete/annotations/helpers/AnnotationUtils.ts 9.39% <ø> (ø)
...ointsOfInterest/ads/PointsOfInterestAdsProvider.ts 15.82% <ø> (ø)
...t-components/src/components/CacheProvider/index.ts 0.00% <ø> (ø)
...t-components/src/components/CacheProvider/types.ts 0.00% <ø> (ø)
...mponents/src/components/Reveal3DResources/index.ts 0.00% <ø> (ø)
...mponents/src/components/Reveal3DResources/types.ts 0.00% <ø> (ø)
...components/src/hooks/cad/ModelWithAssetMappings.ts 0.00% <ø> (ø)
react-components/src/hooks/cad/index.ts 100.00% <ø> (ø)
...nents/src/hooks/cad/useAssetMappingForTreeIndex.ts 13.95% <ø> (ø)
...eact-components/src/hooks/cad/useNodesForAssets.ts 12.90% <ø> (ø)
... and 69 more

... and 1002 files with indirect coverage changes

…9-add-support-for-core-dm-mappings-along-with-classic
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.

2 participants