Added warning label that allows user to jump to already existing entry#13390
Conversation
|
Oh binaries for different platforms are re-checked with every commit ? I'll try to make fewer commits. |
|
Hey @jayvardhanghildiyal , thank you for your PR and interest in JabRef. |
|
O sorry, i just noticed, that message "you must provide" was not your change, that was already before.... but anyways, maybe you still want to take a look into it on the fly? |
@calixtus I've looked into it and would like to explain what I think is happening. I'll post some code below mostly for my reference and understanding . Do correct me if I've missed the point of the request ! My Understanding of the validation logicSo this validator below helps control the visibility of FXML components. Validators like this can affect labels in the FXML file and the button in the new entry dialog window. Requested ChangeI have to:
|
|
I think I've done it, but there is an error that says:
It comes from the CSLStyleLoader.java. I don't remember changing anything related to it. I'll try to see what it is about. |
|
Ignore the error, this might because you did not initialize the submodules. But it should run anyways |
On the command line, execute Merge latest As Carl said: it can be ignored for this issue. |
koppor
left a comment
There was a problem hiding this comment.
I think, something went wrong during merge of main - and the architecture needs to be fixed 😅
…eateEntry function
…now be functional
…ildiyal/jabref into fix-for-issue-13261
|
Hi, We discussed this in our devcall:
In the badge, show the text "Entry already exists in library XXXX" (can we show the library name?) Use localization https://devdocs.jabref.org/code-howtos/localization.html#localization-in-fxml |
|
A helpful page about validation in ui: Wa had a discussion about that in the devcall: However in general, we think that the tooltips on the validation badges are not the best ui design. We go with it for now, as this is the current ui design approach in other places and we should think in the future to do this differently. Eventually when the entry editor will be rewritten (TM 😬) But for now, move forward as @Siedlerchr suggested. Mind that in rtl languages the "Jump to entry" should appear on the left of the textinput control. |
|
Hi @Siedlerchr ! I will keep looking at the tests.
Yes, that is doable ! In the commit before the latest one, I used the To highlight the entry present in the current library I am using the I'll try my best ! |
|
A new map with all BibEntry(ies)? This is a bad idea. Think of a library with 10.000 entries. Not uncommon. |
…lso added a new key in jabref_en.properties
Hey @Siedlerchr ! I wanted to talk about the Since I do not have access to other LibraryTabs (reason discussed before), let me know which implementation would be better:
I think utility-wise, option 1 is better because the implementation will alert the user over all the entries. And if they want to add a new entry to a library, they will know that the same one exists somewhere else too. Not being able to jump to it sucks, but at least the user will be aware. I will now send out a commit that implements option 1, which I personally think will give out more consistent and useful warnings. Do let me know ! In the meantime, I'll remove the commented code and add the suggested changes ! |
…commented code and unused variables.
|
Oh that's odd. The last time I hovered over the symbol, appeared every single time. I'll look into it once again. |
|
Hi again ! I've added the suggestions ! Working with the Tooltip Also, the |
|
Current state: Can be improved by the user NOT to have the DOI in the clipboard: Questions:
I liked the initial implementation better - much more consistent to other apps :) If question 1 cannot be solved, I vote for reverting to this... Can we have a call on it? |
|
Keep consistency. If we do a custom design here, the user will go wtf. |
Move fast? 😇 Hope that question 1 can be solved... |
|
About question 1: Should be easy enough with a property being added to the validation function in the viewmodel |
|
Oh sorry guys. I didn't get a notification for this discussion. I guess question 2 should be easy enough to implement. I have understood the first question. That's a very good catch ! I don't know how I didn't notice that. I'll see what I can do ! |
| doiCache.clear(); | ||
| Optional<BibDatabaseContext> activeDatabase = stateManager.getActiveDatabase(); | ||
|
|
||
| activeDatabase.stream() |
There was a problem hiding this comment.
Do we really need .stream() here - isn't a simple map enough?
There was a problem hiding this comment.
I guess I can make it cleaner.
I had a question though. Can users create BibEntrys that have a null DOI value in JabRef ? I learned that ifPresents are required while working with optionals, but I was wondering if we can make do without a few.
activeDatabase.map(BibDatabaseContext::getEntries)
.ifPresent(entries -> {
entries.forEach(entry -> {
entry.getField(StandardField.DOI)
.ifPresent(doi -> {
doiCache.put(doi, entry);
});
});
});
There was a problem hiding this comment.
No null values allowed - this would contradict Optional architecture.
|
@trag-bot didn't find any issues in the code! ✅✨ |
There was a problem hiding this comment.
Looks good.
The implementation is at risk that it is very slow for large libraries (with 10k+ entries)
Future work:
- Backgroundtask for DOI caching
- Cache the DOIs "globally" - do a subscription on changes of things etc. (complicated algorithm) -- maybe use the postgres database with views there --> nice opportunity to learn about SQL use
|
A bird in the hand is worth two in the bush. |
|
Thank you so much for being patient and giving the important insights necessary to complete this issue ! I'm kinda new to this, but I'd like to contribute more. Is it okay if i assign other issues to myself and continue contributing ? |
Sure - you can also work on the future work outlined at #13390 (review). |






Closes #13261
This pull request adds a
checkDOIfunction, listener logic and somefxmltoNewEntryView.javaandNewEntry.fxml. This addition aims to add a UI component that warns the user when trying to add an already existing entry to a library, while also allowing them to jump to it instead.Steps to test
demonstration.mp4
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)