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/download tab #1635

Merged
merged 30 commits into from
Jul 22, 2024
Merged

Feature/download tab #1635

merged 30 commits into from
Jul 22, 2024

Conversation

lukavdplas
Copy link
Contributor

@lukavdplas lukavdplas commented Jul 19, 2024

This moves the download menu into a separate tab.

The download tab includes a form with all options for the download; it replaces both the "download" button on the top (with the attached dropdown menu) and the options dialogue window. (The options dialogue is still used in the download history, though.)

close #1310
close #1029
close #674
close #1118 (this suggested an alternative approach)

Screen capture:

Screencast.from.19-07-24.12.12.12.webm

Notes:

  • The download form includes the option to select "query in context". This works on the frontend side, but the functionality is broken on the backend ("query in context" field does not work #1633). I've hidden the option in the form for now.
  • I've included the test I used to isolate "query in context" field does not work #1633 and marked it xfail.
  • This changes the way tabs are encoded in the URL, with an explicit tab parameter. Old routes will continue to work.
  • Also added tags and context as forbidden field names. This isn't because of any changes in this PR, I just noticed they should have been added.

@lukavdplas lukavdplas added the frontend changes to the angular frontend label Jul 19, 2024
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.

As always: neat code, good tests.
The download component is a bit heavy, but the functionality all directly concerns downloading, so that's fine.

The new look for the download tab is a lot better.

Comment on lines +73 to +74
this.totalResults?.complete();
this.resultsConfig?.complete();
Copy link
Contributor

Choose a reason for hiding this comment

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

Careful closing of the observables here, I wouldn't have thought to do so if replacing them with a new stream.
Out of curiosity, did problems arise when not closed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is more "good practice", because we're creating observables in ngOnChanges, it's good to close them when new input comes in.

But this is triggered when the input receives a new queryModel. That's really an edge case. (See #1247 (comment) for more detail.)

frontend/src/app/download/download.component.ts Outdated Show resolved Hide resolved
frontend/src/app/download/download.component.ts Outdated Show resolved Hide resolved
import { QueryModel } from '../models';
import { mockCorpus } from '../../../mock-data/corpus';
import { commonTestBed } from '../../common-test-bed';
import { QueryModel } from '../../models';
Copy link
Contributor

Choose a reason for hiding this comment

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

The imports for models and services would benefit from path mapping in tsconfig.json

Comment on lines +31 to +35
if (state.tab === 'search-results') {
return { tab: null };
} else {
return state;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Familiarizing myself with the store stuff, which does look very neat.
I wonder if something like a 'default state' would be beneficial to add as an option in StoreSync? In this case if the tab is search-results.

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 point. Filters have something like that, but perhaps it could be generalised to more models.

@lukavdplas lukavdplas merged commit 1fd6116 into develop Jul 22, 2024
1 check passed
@lukavdplas lukavdplas deleted the feature/download-tab branch July 22, 2024 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend changes to the angular frontend
Projects
None yet
2 participants