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): create and delete observations #4658

Merged
merged 20 commits into from
Jul 16, 2024

Conversation

haakonflatval-cognite
Copy link
Contributor

Type of change

Feat

Jira ticket 📘

https://cognitedata.atlassian.net/browse/BND3D-4179
https://cognitedata.atlassian.net/browse/BND3D-4180

(Note that the above tasks should also have more involved UI for observation handling, which is not addressed by this PR

Description 📝

Buttons to create and delete observations, and committing the changes to the cloud.

How has this been tested? 🔍

In storybook and Search/Fusion

Test instructions ℹ️

  • Go to storybook
  • Connect to 3d-test
  • Use { modelId: 3544114490298106, revisionId: 6405404576933316 } (you can change directly from id -1, -1in getAddModelOptionsFromUrl.ts)
  • Activate observations by clicking the "paper plane-button" to the right in the Architecture story.
  • Click "fit to view" to see the observations if they're not found.
  • Click on the plus-button in the bottom-left toolbar
  • Click somewhere on the model to create an observation
  • Perhaps create a few more
  • Click blue "save" button to save to cloud
  • See that "save" disappears if nothing has been changed
  • Refresh to see that observations persist
  • Click created observations and the delete-button/ delete-key to mark for deletion
  • Click "save" to see that it disappears
  • Refresh to see that it persists

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

@nilscognite nilscognite left a comment

Choose a reason for hiding this comment

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

I had some comments

Copy link
Contributor

@nilscognite nilscognite left a comment

Choose a reason for hiding this comment

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

See 2 new comments

Copy link
Contributor

@nilscognite nilscognite left a comment

Choose a reason for hiding this comment

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

Better now, but still a way to go. I hope you understand 'why' I'm stressing these things. The point is to follow the pattern, then everyone will understand your code and we will spend less time in bug fixing and additional features.

Also, I strongly want to remove the _fdmSdk in the ObservationsCache, since this can be used as a parameter instead for save and delete. You have access to renderTarget almost everywhere in the code, so double buffering of this pointer make more complexity.

@haakonflatval-cognite
Copy link
Contributor Author

haakonflatval-cognite commented Jul 15, 2024

Also, I strongly want to remove the _fdmSdk in the ObservationsCache, since this can be used as a parameter instead for save and delete

I can do this, but the FdmSDK is still used in the constructor to load the initial set of observations, which means it must still be sent to the ObservationsCache on creation.

(Edit: I made the change now)

Copy link
Contributor

@nilscognite nilscognite left a comment

Choose a reason for hiding this comment

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

This is very close to "perfect" now. I had some comment. Not all of them is important,

Copy link
Contributor

@nilscognite nilscognite left a comment

Choose a reason for hiding this comment

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

Looks good now

@haakonflatval-cognite haakonflatval-cognite enabled auto-merge (squash) July 16, 2024 08:43
@haakonflatval-cognite haakonflatval-cognite merged commit 4e5e9c4 into master Jul 16, 2024
14 checks passed
@haakonflatval-cognite haakonflatval-cognite deleted the hflatval/observation-creation branch July 16, 2024 10:50
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