-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix(react-components): list 360-core-dm-connected assets #4967
Merged
haakonflatval-cognite
merged 41 commits into
master
from
hflatval/list-360-coredm-assets
Mar 5, 2025
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
40fc7ed
fix(react-components): list 360-core-dm-connected assets
haakonflatval-cognite b3f274a
feat: enable search filtering for 360
haakonflatval-cognite 047ac4c
Merge branch 'master' into hflatval/list-360-coredm-assets
pramod-cog d46f64e
chore: lint fix in viewer
haakonflatval-cognite ffa7eac
chore: correct AnnotationAssetRef type
haakonflatval-cognite 6b67834
chore: ignore lint error
haakonflatval-cognite 4b4818d
chore: try to fix build error by upgrading target ES version in tsconfig
haakonflatval-cognite 89bd1e4
Revert "chore: try to fix build error by upgrading target ES version …
haakonflatval-cognite 4f48857
Merge branch 'master' into hflatval/list-360-coredm-assets
haakonflatval-cognite ace8001
test(react-components): Add tests for listMappedFdmNodes
haakonflatval-cognite 831478f
chore: remove unnecessary results, improve typing
haakonflatval-cognite 002ed54
chore: tests WIP
haakonflatval-cognite f38c6be
chore: minor changes to filterNodesByMappedTo3d
haakonflatval-cognite d4a96a7
chore: rename annotations-folder and utilities
haakonflatval-cognite 5cd2736
chore: spurious cleanup, lint and add missing files
haakonflatval-cognite f98db9c
chore: lint fix again
haakonflatval-cognite fe2d7d6
chore: lint fix YET AGAIN (not sure why CI get more errors than me)
haakonflatval-cognite 1672d18
test: a few tests for CoreDm3dDataProvider
haakonflatval-cognite 43046bf
chore: move fixtures
haakonflatval-cognite 7d493c5
chore: lint fix
haakonflatval-cognite 0f10579
chore: remove outdated file
haakonflatval-cognite 08e222b
chore: remove a bunch of cyclic dependencies
haakonflatval-cognite 0ab2543
chore: LINT FIXSNTEOHUSNEOTHUSNTOEHUSNTH
haakonflatval-cognite 7ce3cc9
chore: don't initialize mock
haakonflatval-cognite 9ffe9fa
Merge branch 'master' into hflatval/list-360-coredm-assets
pramod-cog 7352db7
chore: import right function...
haakonflatval-cognite 1f09a24
Update react-components/src/data-providers/core-dm-provider/listMappe…
haakonflatval-cognite e0e42c2
Update react-components/src/utilities/image360Annotations/getImage360…
haakonflatval-cognite b6be26e
chore: increase type safety
haakonflatval-cognite 9dc0d25
chore: lint fix
haakonflatval-cognite fc3b1de
chore: avoid as unknown
haakonflatval-cognite bcd8263
chore: rewrite image360 queries to make life easier for Typescript
haakonflatval-cognite 21acff7
chore: add missing export
haakonflatval-cognite 05cff4c
chore: correct tests etc.
haakonflatval-cognite 0c020b1
chore: lint fix
haakonflatval-cognite 844421d
fix: persist unhoisted properties in return value from search
haakonflatval-cognite 658840e
fix: correct table name in FDM query
haakonflatval-cognite 0f148d7
chore: lint fix
haakonflatval-cognite 36c9cc8
fix: fix typing in hoist function
haakonflatval-cognite 2604205
Merge branch 'master' into hflatval/list-360-coredm-assets
christjt 42e5af0
Merge branch 'master' into hflatval/list-360-coredm-assets
haakonflatval-cognite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
react-components/src/data-providers/core-dm-provider/CoreDm3dDataProvider.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/*! | ||
* Copyright 2025 Cognite AS | ||
*/ | ||
import { describe, expect, it, beforeEach } from 'vitest'; | ||
import { CoreDm3dFdm3dDataProvider } from './CoreDm3dDataProvider'; | ||
import { Mock, It, type IMock } from 'moq.ts'; | ||
import { type FdmSDK } from '../FdmSDK'; | ||
import { restrictToDmsId } from '../../utilities/restrictToDmsId'; | ||
import { type AddImage360CollectionDatamodelsOptions } from '../../components'; | ||
import { | ||
modelInstanceFixture0, | ||
revisionInstanceFixture0 | ||
} from '../../../tests/tests-utilities/fixtures/dm/model3dData'; | ||
|
||
const image360CollectionId: AddImage360CollectionDatamodelsOptions = { | ||
externalId: 'image360Collection0', | ||
space: 'space0', | ||
source: 'cdm' | ||
}; | ||
|
||
const modelId0 = 1234; | ||
const revisionId0 = 5678; | ||
|
||
describe(CoreDm3dFdm3dDataProvider.name, () => { | ||
let fdmSdkMock: IMock<FdmSDK>; | ||
|
||
beforeEach(() => { | ||
fdmSdkMock = createFdmSdkMock(); | ||
}); | ||
|
||
it('should fetch model ref for classic input model options', async () => { | ||
const coreDmProvider = new CoreDm3dFdm3dDataProvider(fdmSdkMock.object()); | ||
|
||
const result = await coreDmProvider.getDMSModels(modelId0); | ||
|
||
expect(result).toEqual([restrictToDmsId(modelInstanceFixture0)]); | ||
}); | ||
|
||
it('should fetch revision ref for classic input model options', async () => { | ||
const coreDmProvider = new CoreDm3dFdm3dDataProvider(fdmSdkMock.object()); | ||
|
||
const result = await coreDmProvider.getRevisionRefs([ | ||
{ modelId: modelId0, revisionId: revisionId0 } | ||
]); | ||
|
||
expect(result).toEqual([restrictToDmsId(revisionInstanceFixture0)]); | ||
}); | ||
|
||
it('should return the input ID when input is CoreDM image360 options', async () => { | ||
const coreDmProvider = new CoreDm3dFdm3dDataProvider(fdmSdkMock.object()); | ||
|
||
const result = await coreDmProvider.getRevisionRefs([image360CollectionId]); | ||
|
||
expect(result).toEqual([restrictToDmsId(image360CollectionId)]); | ||
}); | ||
}); | ||
|
||
function createFdmSdkMock(): IMock<FdmSDK> { | ||
return new Mock<FdmSDK>() | ||
.setup( | ||
async (p) => | ||
await p.queryNodesAndEdges( | ||
It.Is( | ||
(query) => | ||
(query as any).with?.models?.nodes?.filter?.and?.[0]?.equals?.value === | ||
`cog_3d_model_${modelId0}` | ||
) | ||
) | ||
) | ||
.returns(Promise.resolve({ items: { models: [modelInstanceFixture0] } })) | ||
.setup( | ||
async (p) => | ||
await p.queryNodesAndEdges( | ||
It.Is( | ||
(query) => | ||
(query as any).parameters?.revisionExternalId === `cog_3d_revision_${revisionId0}` | ||
) | ||
) | ||
) | ||
.returns(Promise.resolve({ items: { revision: [revisionInstanceFixture0] } })); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm terribly sorry for this abomination. The types of this function is inherently broken, but fixing them must be undertaken as a separate task, as it's way out of scope for this PR. I have tracked this in this JIRA issue: https://cognitedata.atlassian.net/browse/BND3D-5469