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

Feature/results model #1307

Merged
merged 32 commits into from
Nov 24, 2023
Merged

Feature/results model #1307

merged 32 commits into from
Nov 24, 2023

Conversation

lukavdplas
Copy link
Contributor

@lukavdplas lukavdplas commented Nov 2, 2023

Frontend refactoring:

  • Adds a PageResults model to represent search results.
  • PageResults extends a Results model that is intended to be used in some other contexts in the future (e.g. aggregation requests)
  • Cleans up the SearchResultsComponent
  • Extracted a DocumentPopupComponent from the search results component

Content changes:

  • The results page is now better at showing a loading spinner when its should
  • Fixed an issue where clicking the scan button just opened the document without jumping to the scan tab
  • Removed the logic where the first page shows more documents than subsequent pages. It's not really an issue to restore it, it just seemed a bit unnecessary to me.

close #1162

@lukavdplas lukavdplas added code quality code & performance improvements that do not affect user functionality frontend changes to the angular frontend labels Nov 2, 2023
@lukavdplas lukavdplas force-pushed the feature/results-model branch from 728f4f8 to e958ebd Compare November 21, 2023 13:03
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.

Amazing job. Agree on the outfactors.
Made some requests for clarifying documentation and unsubscribes.

frontend/src/app/document-view/document-view.component.ts Outdated Show resolved Hide resolved
Comment on lines +44 to +48
private focusPosition(position: number) {
const index = _.clamp(position - 1, 0, this.documents.length - 1);
this.focus(this.documents[index]);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This method could use a (short) docstring

import { Results } from './results';
import { DocumentPage } from './document-page';

export const RESULTS_PER_PAGE = 20;
Copy link
Contributor

Choose a reason for hiding this comment

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

How often do we expect to change this value? Could it be variable for different flavours of I-Analyzer? If so, this may belong in environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, good one. I think the more conventional way of handling it is to put a control for this next to pagination, so let users decide. But if I was going to work on expanding the results page right now, I would prioritise #1011, #1012, #729, or #996 - a size control seems low-priority to me. It may bring more clutter than value.

As for adding it to environment settings: that is technically trivial, but then I don't think have a reason to change this between our existing environments. Perhaps we could think more long-term about what we envision for different I-analyzer instances.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Stray thought on this: size=20 is a bit trivial, since that is the elasticsearch default. Perhaps if we did not specify this, it could also be configured in the elasticsearch settings? Which would also make it environment-configurable.

frontend/src/app/models/page-results.ts Outdated Show resolved Hide resolved
return {};
}

setParameters(newValues: Partial<Parameters>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same applies for the methods, take assignOnQueryUpdate as a good example

frontend/src/app/models/results.ts Show resolved Hide resolved
frontend/src/app/models/results.ts Outdated Show resolved Hide resolved
frontend/src/app/search/search-results.component.ts Outdated Show resolved Hide resolved
Base automatically changed from feature/save-search-history-from-backend to develop November 24, 2023 10:31
@lukavdplas lukavdplas merged commit 33a4953 into develop Nov 24, 2023
1 check passed
@lukavdplas lukavdplas deleted the feature/results-model branch November 24, 2023 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality code & performance improvements that do not affect user functionality frontend changes to the angular frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SearchResults model
2 participants