Skip to content

Move generate key option to citation key preference tab#12436

Merged
Siedlerchr merged 4 commits into
JabRef:mainfrom
priyanshu16095:moveCitationKeyOption
Feb 6, 2025
Merged

Move generate key option to citation key preference tab#12436
Siedlerchr merged 4 commits into
JabRef:mainfrom
priyanshu16095:moveCitationKeyOption

Conversation

@priyanshu16095

@priyanshu16095 priyanshu16095 commented Jan 31, 2025

Copy link
Copy Markdown
Contributor

Fixes #10849

This PR moves the "Generate new keys on import" option from the WebSearch tab to the CitationKey Preferences tab.

Mandatory checks

  • I own the copyright of the code submitted and I licence it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

Screenshot (28)

@priyanshu16095

Copy link
Copy Markdown
Contributor Author
Recording.2025-01-31.mp4

It's working fine.
Please review.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

Comment thread CHANGELOG.md Outdated
Comment thread src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java Outdated
@subhramit subhramit requested a review from calixtus January 31, 2025 13:07
@Siedlerchr

Copy link
Copy Markdown
Member

Good thing, this also refers to this user's post https://discourse.jabref.org/t/jabref-v5-15-is-not-using-the-merged-entry-random-changes-to-bibfile/5403/3?u=siedlerchr

@subhramit

subhramit commented Jan 31, 2025

Copy link
Copy Markdown
Member

@priyanshu16095 you can keep my requested changes on hold. @calixtus may have some opinions on whether we want to shift or keep the preference in the ImporterPreferences.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@calixtus

calixtus commented Feb 1, 2025

Copy link
Copy Markdown
Member

Yes, my concern was that putting that pref option into keyGeneratorPreferences, this would breach the level of abstraction or hierarchy, because the pref option about if to use the keygenerator on import is different of how it is configured. Yet in the UI there is no place where this option would go otherwise. So my suggestion would be to leave the pref option codewise in the importerPreferences and put the ui option into the key generator tab.

@priyanshu16095

Copy link
Copy Markdown
Contributor Author

Done! I have moved the option in the UI while keeping the preference in Importer Preferences.

@subhramit subhramit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Quick comments. Also, @priyanshu16095, please no force-pushes!

@priyanshu16095

Copy link
Copy Markdown
Contributor Author

Got it! I’ll avoid force-pushing.

public CitationKeyPatternTabViewModel(CitationKeyPatternPreferences keyPatternPreferences, ImporterPreferences importerPreferences) {
this.keyPatternPreferences = keyPatternPreferences;

// Defines key generation preference during import.

@subhramit subhramit Feb 2, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A javadoc comment at field level is preferable - javadoc is often used in relaying ambiguities/abnormalities/edge cases to the developer. Remove this, and put the lines:

  • The preference for whether to use the keygenerator on import is different from how it is configured.
  • For the UI, there is no better place to put the option than the Citation key generator tab, but shifting the preference to CitationKeypreferences would break the abstraction or hierarchy.
  • Hence, we keep the preference in ImporterPrefernces, but in the UI, we initialize it here.

above line 40 (where the field is declared).
Take a look at how @link is used to link classes in javadoc.

@priyanshu16095 priyanshu16095 Feb 2, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I was not aware of this.

@subhramit subhramit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I pushed a minor commit (b3d42f1) correcting the class name in the javadoc - IntelliJ will give you a hint whether the class is linked correctly or not by highlighting it in red.
I also shifted the keyPatternPreferences declaration above in order, as those are the primary preference options exposed via this view. The edge case comes after that.

Rest lgtm from my side code-wise. Await a second review.

@priyanshu16095

Copy link
Copy Markdown
Contributor Author

Thank you, @subhramit , for your help at every step.

@subhramit

Copy link
Copy Markdown
Member

@Siedlerchr @calixtus one of you can take a second look, i think we are near completion here

@Siedlerchr Siedlerchr added this pull request to the merge queue Feb 6, 2025
@calixtus

calixtus commented Feb 6, 2025

Copy link
Copy Markdown
Member

Thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants