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

Follow-up #12035 and #12068: Show an informative progress indicator when dragging and dropping PDF files to JabRef #12072

Merged
merged 6 commits into from
Oct 27, 2024

Conversation

BaronMac08
Copy link
Contributor

@BaronMac08 BaronMac08 commented Oct 24, 2024

Closes #8738
A follow-up to #12035 and #12068
Builds upon: the branch fix-melting-630 merged at #12001

Modifications:

  • Dragging and dropping several PDF files into JabRef will be one large import rather than one small import for every file

Additions:

  • Added informative messages about the ongoing progress of the big import by building upon the BackgroundTask progress indicator
  • Added shortenFileName(fileName, maxLength) in StringUtil to shorten and prominently display the files being imported
  • Added one new unit test for validating StringUtil.shortenFileName()

UI Screenshots after modifications and additions:
Screenshot 2024-10-24 at 20 09 55
Screenshot 2024-10-24 at 20 11 11
Screenshot 2024-10-24 at 20 22 29
Screenshot 2024-10-24 at 20 22 37

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 applicable)
  • 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.

@BaronMac08
Copy link
Contributor Author

Completed manually adding changes from https://github.com/JabRef/jabref/pull/12035/files. Awaiting peer-review from @mag-sun before marking pull request as ready for review.

CHANGELOG.md Outdated Show resolved Hide resolved
src/main/java/org/jabref/model/strings/StringUtil.java Outdated Show resolved Hide resolved
src/test/java/org/jabref/model/strings/StringUtilTest.java Outdated Show resolved Hide resolved
@BaronMac08 BaronMac08 marked this pull request as ready for review October 25, 2024 10:23
@BaronMac08
Copy link
Contributor Author

Peer review from @mag-sun completed, the PR is now ready for review.

@BaronMac08
Copy link
Contributor Author

Hi @koppor, I have opened this PR as you requested in #12068. For the two failing unit tests:

  1. StringUtil should have less than or equal to 774 lines of code
  2. doNotUseLogicInModel was triggered due to the usage of FileUtil within StringUtil

Please let me know if there are any changes you would like me to make, thank you in advance for the feedback.

@koppor
Copy link
Member

koppor commented Oct 25, 2024

@BaronMac08 #12068 was closed. Maybe you mean #12072 -- please let pull requests open after changing something. Otherwise, it is really hard to follow.

@koppor
Copy link
Member

koppor commented Oct 25, 2024

2. doNotUseLogicInModel was triggered due to the usage of FileUtil within StringUtil

I think, not. import org.jabref.logic.util.io.FileUtil; is in logic, too. -- Please recheck.

@koppor
Copy link
Member

koppor commented Oct 25, 2024

  1. StringUtil should have less than or equal to 774 lines of code

Move the code to FileUtil. I think, the cohesion is better there.

@BaronMac08
Copy link
Contributor Author

I have moved the shortenFileName() method to FileUtil, as @koppor suggested. All checks have passed.

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

Small comments on the functionality of the ellipses. Maybe, you can fix it?

Comment on lines 497 to 499
"... , longfilename.extremelylongextension , 5",
"... , longfilename.extremelylongextension , 10",
"... , longfilename.extremelylongextension , 20",
Copy link
Member

Choose a reason for hiding this comment

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

This is not good behavior.

Expected:

Suggested change
"... , longfilename.extremelylongextension , 5",
"... , longfilename.extremelylongextension , 10",
"... , longfilename.extremelylongextension , 20",
"lo.. , longfilename.extremelylongextension , 5",
"longfil... , longfilename.extremelylongextension , 10",
"longfilename.extr.... , longfilename.extremelylongextension , 20",

Reason: There are plenty !! of characters available at 10 and 20. They should be used. Not just 3

"'' , thisisatestfile.pdf , -5",
"'' , thisisatestfile.pdf , 0",
"... , thisisatestfile.pdf , 3",
"... , thisisatestfile.pdf , 5",
Copy link
Member

Choose a reason for hiding this comment

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

Please! Use all 5 characters: th....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely, I will modify the functionality to make use of the available characters.

@koppor
Copy link
Member

koppor commented Oct 26, 2024

Additional comment:

The number of files is displayed multiple times:

image

Please change progress information before the pipe sign to Importing files into 12072.bib |

And if you are on it, can you also change it for the indexing string?

image

@koppor
Copy link
Member

koppor commented Oct 26, 2024

Drop of files does not work. ALL files are attached to ALL entries. Even on pressing Cancel.

image

Please try out your things. Having 500 PDFs available is not too hard. I used all from my Downloads folder to test. - If not, you can try out the PDFs available at https://github.com/koppor/tugboat-mirror/tree/main/tugboat_issues.

@koppor koppor added the status: changes required Pull requests that are not yet complete label Oct 26, 2024
…dated progress messages for Importing, Indexing files.
@BaronMac08
Copy link
Contributor Author

Drop of files does not work. ALL files are attached to ALL entries. Even on pressing Cancel.

image

Please try out your things. Having 500 PDFs available is not too hard. I used all from my Downloads folder to test. - If not, you can try out the PDFs available at https://github.com/koppor/tugboat-mirror/tree/main/tugboat_issues.

Thank you for pointing out the issue. I believe the issue is caused by the grouping of all files' entries and then sending it to the indexManager as one big EntriesAddedEvent. Therefore, I perform the exact same test of dragging and dropping the PDF files provided at https://github.com/koppor/tugboat-mirror/tree/main/tugboat_issues into JabRef/main and branch fix-8738 with the following results:

  1. On JabRef/main:
    Screenshot 2024-10-27 at 10 13 20
    Screenshot 2024-10-27 at 10 15 45

  2. On fix-8738:
    Screenshot 2024-10-27 at 10 03 25
    Screenshot 2024-10-27 at 10 02 45

The difference between main and fix-8738 for the entry "... To Don Knuth..." in the linked files section:

  1. On main: tb139complete.pdf and tb138complete.pdf are at the beginning of the list
  2. On fix-8738: tb138complete.pdf and tb139completed.pdf are at the end of the list

Additionally, on both main and fix-8738, the file "The Communications of the TEX Users Group.pdf" has the same linked file.

I am wondering what would be the correct behaviour for this dataset of PDF files so that the issue on branch fix-8738 could be identified and resolved. Thank you in advance for the clarification @koppor.

@koppor
Copy link
Member

koppor commented Oct 26, 2024

I am wondering what would be the correct behaviour for this dataset of PDF files so that the issue on branch fix-8738 could be identified and resolved.

Thank you for investigating. I needed to raise a new issue at #12098.

@koppor koppor added this pull request to the merge queue Oct 26, 2024
@koppor
Copy link
Member

koppor commented Oct 26, 2024

Thank you for the quick follow-up in the filename methods. This is good to go now!

@BaronMac08
Copy link
Contributor Author

Thank you for your guidance and advice!

Merged via the queue into JabRef:main with commit 61d342a Oct 27, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: changes required Pull requests that are not yet complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show a progress indicator when dragging and dropping PDF files to JabRef
4 participants