Hide Merge Metadata Dialog if there is nothing to merge#13309
Conversation
|
I have no idea of why this changelog test is failing. |
calixtus
left a comment
There was a problem hiding this comment.
Im not so sure about the fix. This seems to be a bit hacky to me.
The dialog now choses by itself when to show. There might be a scenario when the dialog should display anyway, that we don't think of now.
I believe the fix should happen where the dialog is called, not in the dialog itself.
you put your note in the wrong section, an old release. put your note into the section [unreleased] |
How to navigate: Have a look at the structure of the changelog and what each heading means. Then try to infer what the test says - "only unreleased touched". You have added your entry under the 5.0-alpha version heading, when you had to put it under the unreleased section. |
Yeah, but improves workflow while working with JabRef
Then we can disable.
This is impossible - is it? @Nathaandev can you check Because columns are filled dynamically. |
|
I got a lot of failing tests this time, but I don't know why. |
Try to run JabRef. It probably does not compile. |
It does compile, it works normally. |
Apparently, CI checks are failing because half of the internet is down right now. |
Ah ok, so I have to wait and later I make another commit or there is another way to make the tests again? |
In the guide to set up a local workspace, there is a hint on how to run a unit test locally. Checkstyle will already warn you via intelliJ, for openrewrite you can follow the developer faqs if you wish to run locally. |
Thanks! |
I've explored the possibility, but it appears to be impossible. But perhaps I just wasn't good enough so i'm not 100% sure it is impossible. If the current fix still seems a bit hacky for you, I can definitely look into an alternative. |
|
@calixtus if the current fix isn't quite right, i'm happy to discuss other approaches. |
| "Could not extract Metadata from: %0", | ||
| String.join(", ", viewModel.failedSuppliersProperty()))); | ||
| // Closes the dialog if the there is only one active column. | ||
| active_columns = viewModel.entriesProperty().get().size() - viewModel.failedSuppliersProperty().get().size(); |
There was a problem hiding this comment.
No snake case in JabRef.
Would it be ok if I rename the variable to "activecolumns"?
There was a problem hiding this comment.
Would it be ok if I rename the variable to "activecolumns"?
read about snake casing and camel casing. In languages like python, we generally follow snake_casing. In Java, the default convention is camelCasing. So that would make it activeColumns
There was a problem hiding this comment.
Would it be ok if I rename the variable to "activecolumns"?
read about snake casing and camel casing. In languages like python, we generally follow snake_casing. In Java, the default convention is camelCasing. So that would make it activeColumns
I understand. whenever I was making my projects, I did not care about camelCasing or snake_casing, I would just give them any name. But it's good to learn that it's important. But what about the constants, is this rule applicable to them as well?
There was a problem hiding this comment.
But what about the constants, is this rule applicable to them as well?
No. Constants generally have capital letters, and once we fix case, camel case cannot separate words anymore. So, then, we need underscores, for example, private static final int DEFAULT_RETURN_VALUE = 40.
We use Checkstyle with some custom rules to enforce these. Checkstyle's default configuration is based on Google's style guide, so a lot of these practices are inherited from them.
Logically, code style does not matter, but when it's a large codebase with multiple people working on it and changing code written by others, and adding many lines of their own, it becomes important to have readability and maintainability as a concern, and having a uniform style throughout helps.
There was a problem hiding this comment.
But what about the constants, is this rule applicable to them as well?
No. Constants generally have capital letters, and once we fix case, camel case cannot separate words anymore. So, then, we need underscores, for example,
private static final int DEFAULT_RETURN_VALUE = 40. We use Checkstyle with some custom rules to enforce these. Checkstyle's default configuration is based on Google's style guide, so a lot of these practices are inherited from them. Logically, code style does not matter, but when it's a large codebase with multiple people working on it and changing code written by others, and adding many lines of their own, it becomes important to have readability and maintainability as a concern, and having a uniform style throughout helps.
Thank you for the patience and for explaining to me. You guy are helping me a lot.
Co-authored-by: Subhramit Basu <subhramit.bb@live.in>
Done! And I have commited your suggestion as well. |
When the decision to close is made, check if the merged entry is the same (equals should work) as the remaining one. It could be that a user begins to change something. However, here, it are only 2 seconds or so; thus, this is maybe cosmetics only. |
|
Let's see what users will report. On the first load, I had a long respoonse time from Grobid - and could have typed something in the dialog. The subsequent runs were very fast. Thus, I don't see a risk of loosing data if the dialog is closed. Thus, I approve. Thank you for spending time with us @Nathaandev |
|
I inlined a variable at Since the code could cause questions while reading, I added some requirements text. I think, our team agrees to have "Requirements" first and not just issues linked in the code? @subhramit |
| String.join(", ", viewModel.failedSuppliersProperty()))); | ||
| int activeColumns = viewModel.entriesProperty().get().size() - viewModel.failedSuppliersProperty().get().size(); | ||
| if (activeColumns < ACTIVE_COLUMNS_MINIMUM) { | ||
| // [impl->req~ux.auto-close.merge-entries~1] |
There was a problem hiding this comment.
Comment does not provide meaningful information about the code's purpose or reasoning. Implementation details should be documented in requirements, not in code comments.
|
I added to the merge queue to keep things going. We can fix the text as a follow up. |
|
Hello, @koppor @subhramit, Thanks for the help on this issue. I wanted to ask you if it is ok if I make a Linkedin post about JabRef and this issue, I am looking for my first job as a Junior back-end developer and I would appreciate sharing my learning progress on LinkedIn. Thanks. |
Sure! Go ahead! Please use |
|
@Nathaandev Sure, you can also tag @JabRef on linkedin, our page |
Closes #13262
In this PR, I improved the behavior of the library creation dialog when importing PDF files. Specifically, when a PDF containing only a single column is dragged into a newly created library, the dialog now automatically closes. This fixes the issue where the dialog would remain open unnecessarily, improving the user experience during PDF import.
Steps to test
Create a new library in the application.
Drag'n'drop
jablib\build\resources\test\pdfs\minimal.pdfinto itObserve that the dialog closes automatically after the PDF is added.
Screenshots
Dialog appears after dragging

jablib\build\resources\test\pdfs\minimal.pdfinto the new libraryDialog closes itself because there is only one column.

Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)