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

Hotfix/field values #1708

Merged
merged 7 commits into from
Nov 19, 2024
Merged

Hotfix/field values #1708

merged 7 commits into from
Nov 19, 2024

Conversation

lukavdplas
Copy link
Contributor

@lukavdplas lukavdplas commented Nov 18, 2024

Fixes #1705, #1706, #1709

This also creates two separate components for displaying fields, instead of writing that logic in the document-view and document-preview components, because I was getting lost in the templates of those components.

I've been meaning to clean up these components a bit and straighten out some minor inconsistencies. For now, this at least fixes the missing values.

Copy link
Contributor

@JeltevanBoheemen JeltevanBoheemen left a comment

Choose a reason for hiding this comment

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

Nice. Good idea to declutter DocumentView. Some questions/comments.

Comment on lines +1 to +5
<ng-container *ngIf="field && document">
<ng-container *ngIf="document.highlight && document.highlight[field.name];
else unhighlightedRow">
<ng-container *ngFor="let highlight of document.highlight[field.name];
last as isLast">
Copy link
Contributor

Choose a reason for hiding this comment

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

Lots of ngIf and ngFor here. I wonder if an elvis operator could cut some lines?

Copy link
Contributor

Choose a reason for hiding this comment

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

E.g. something like *ngFor=let highlight of document?.highlight[field?.name]
Probably wishful thinking :)

else unhighlightedRow">
<ng-container *ngFor="let highlight of document.highlight[field.name];
last as isLast">
<div ngPreserveWhitespaces style="word-break:break-word"
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor DRY for the style. Could make it a class.

@@ -0,0 +1,16 @@
<ng-container *ngIf="field" [ngSwitch]="field.displayType">
<div *ngSwitchCase="'text'"
[innerHtml]="field | elasticsearchHighlight:document | paragraph">
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is unclear to me. What is displayed as innerHtml in which cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is displayed if the field has display type text. (So it's tokenised as text, but not a text_content field - usually a title or something.)

I think the elasticsearchHighlight pipe adds the <mark> tags for highlights, and paragraph adds <p> tags for paragraphs.

@lukavdplas
Copy link
Contributor Author

I agree with your comments here; this is the kind of stuff I'm talking about when I say I still want to clean up these components some more. I think I'll make an update for that soon; I'll try to address your suggestions there as well.

@lukavdplas lukavdplas merged commit 013a573 into master Nov 19, 2024
@lukavdplas lukavdplas deleted the hotfix/field-values branch November 19, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants