feat: adding tree view and allowing pinning hovercards#2418
Open
max-marped wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In the metadata cell icon you bind
[class.pinned]="isHoverCardPinned"without arguments, which will always be truthy (function reference) instead of reflecting the current cell’s state; this should likely beisHoverCardPinned(row, column)as in the other usages. - The stronger box shadow for pinned cards is only applied via
.metadata-hover-card.pinned-card, so non-scientific hover cards don’t get the more prominent shadow mentioned in the description; consider applying the pinned styling to all hover cards or clarifying the intended scope. - The scientific metadata hover card markup is duplicated between the metadata column and the standard hover icon path; consider extracting this into a shared component or structural template to keep the logic and layout in one place.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the metadata cell icon you bind `[class.pinned]="isHoverCardPinned"` without arguments, which will always be truthy (function reference) instead of reflecting the current cell’s state; this should likely be `isHoverCardPinned(row, column)` as in the other usages.
- The stronger box shadow for pinned cards is only applied via `.metadata-hover-card.pinned-card`, so non-scientific hover cards don’t get the more prominent shadow mentioned in the description; consider applying the pinned styling to all hover cards or clarifying the intended scope.
- The scientific metadata hover card markup is duplicated between the metadata column and the standard hover icon path; consider extracting this into a shared component or structural template to keep the logic and layout in one place.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
f9a1c9a to
0c4deca
Compare
Author
|
The first point of the sourcery comment has been addressed in the updated commit. |
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
@HostListener('document:click') onDocumentClick()handler currently closes any pinned hover card on every document click, including the same click that pins it, becausestopPropagationdoes not prevent the document-level listener from firing; consider accepting the event (@HostListener('document:click', ['$event'])) and only closing when the click target is outside the overlay/trigger, or rely solely on the CDK backdrop for closing. - For
getScientificMetadata, usinglodashGetfor a single dotted-path access can be replaced with a small local helper or Angular-safe optional chaining to avoid pulling in lodash-es for this narrow use case and reduce bundle size impact.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `@HostListener('document:click') onDocumentClick()` handler currently closes any pinned hover card on every document click, including the same click that pins it, because `stopPropagation` does not prevent the document-level listener from firing; consider accepting the event (`@HostListener('document:click', ['$event'])`) and only closing when the click target is outside the overlay/trigger, or rely solely on the CDK backdrop for closing.
- For `getScientificMetadata`, using `lodashGet` for a single dotted-path access can be replaced with a small local helper or Angular-safe optional chaining to avoid pulling in lodash-es for this narrow use case and reduce bundle size impact.
## Individual Comments
### Comment 1
<location path="src/app/shared/modules/dynamic-material-table/table/dynamic-mat-table.component.ts" line_range="489-494" />
<code_context>
+ return lodashGet(row, name);
+ }
+
+ hasScientificMetadata(row: Record<string, unknown>, column?: TableField<T>) {
+ const metadata = this.getScientificMetadata(row, column);
+ return (
+ !!metadata &&
+ typeof metadata === "object" &&
+ Object.keys(metadata).length > 0
+ );
+ }
</code_context>
<issue_to_address>
**issue (bug_risk):** Primitive scientificMetadata values are treated as empty and never displayed.
Because `hasScientificMetadata` only returns true for non-empty objects, any primitive value (e.g. `scientificMetadata.temperature` as a string/number/boolean) will be treated as empty and show the `emptyScientificMetadata` template, even though data exists.
If you only want the tree UI for object-like values, you could:
- Keep the tree behind an `isObjectLike(metadata)` check, and
- Render the primitive directly when `metadata` is not an object, instead of using `emptyScientificMetadata`.
This would avoid misleading "No content" messages when primitives are present.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Adding escape handling
3c67e5a to
7e15913
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This adds the tree view for scientific metadata to the hover card. It also allows the user to pin the card for closer inspection.
Motivation
Using the tree view for the hover card allows for better structuring of the information. It also makes it recognisable from other parts of the application.
Having the ability to pin the card is useful for when the card contains a lot of information.
Changes:
Tests included
Documentation
official documentation info
If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included
Backend version
Summary by Sourcery
Improve dynamic material table hover-card UX, especially for pinning and scientific metadata display.
New Features:
Enhancements:
Tests:
Summary by Sourcery
Add pinning support and scientific metadata tree view to hover cards in the dynamic material table.
New Features:
Enhancements:
Build:
Tests: