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

Add missing filtering on lists #5963

Merged
merged 18 commits into from Jan 26, 2022
Merged

Add missing filtering on lists #5963

merged 18 commits into from Jan 26, 2022

Conversation

ghost
Copy link

@ghost ghost commented Jan 12, 2022

Fixes #5307

PR introduce possibility to filtering these lists:

  • Portfolio -> Open Trades
  • Funds -> Receive Funds
  • Funds -> Send Funds
  • Funds -> Reserved Funds
  • Funds -> Locked Funds
  • Funds -> Transactions

Code from Funds -> Transactions was also simplified to be more consistent with whole code base.

@ghost ghost marked this pull request as ready for review January 13, 2022 09:59
@ghost ghost mentioned this pull request Jan 15, 2022
@ripcurlx ripcurlx added this to the v1.8.2 milestone Jan 17, 2022
if (filterString.isEmpty())
return true;

if (item.getBalance().toString().contains(filterString)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not cover formatted string. E.g. if balance is 0.01 BTC and you type in 0.01 it is not found.
Better create a new string field in the itme (formatter.formatCoin(this.balance) which reflects the displayed string

Copy link
Author

Choose a reason for hiding this comment

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

boolean matchesBuyersPaymentAccountData = false;
boolean matchesSellersPaymentAccountData = false;
if (contract != null) {
isBuyerOnion = contract.getBuyerNodeAddress().getFullAddress().contains(filterString);
Copy link
Contributor

Choose a reason for hiding this comment

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

Those predicates appear several times. Would be good to make it reusable code

Copy link
Author

Choose a reason for hiding this comment

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

pubKeyRing
);
} else {
return new DummyTransactionAwareTradable(tradable);
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that is from old code, but as that case never gets executed I think we should return null here and then filter out null in the next step. Tradable is only extended from OpenOffer and TradeModel (one other case is not relevant here). The DummyTransactionAwareTradable can be removed then.

Copy link
Author

Choose a reason for hiding this comment

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

@chimp1984
Copy link
Contributor

chimp1984 commented Jan 20, 2022

I have not looked closely to the other filter predicates. But basically it shoud always take the display string as that is what users would expect to be able to filter. Maybe there are some cases where additional domain data filtering is useful as well, but should be additional to the display string case.
As we have not plenty of filters in the app it would be good to have them re-usable also with reusable predicates where it makes sense.

I am not so 100% sure if we should show the filter fields by default or extend it just when the user demand it. E.g. add a filter icon and when the user opens it show the field. That would help to not overload more the already overloaded UI.
We can persist the selection of hte icon, so users who prefer to have the filter get it automatically displayed at next restart.

I know the earlier filter implementations have been done the same way (by myself), but as we extend it now to more screens I think its worth to put a bit more effort into it.

Beside that great to see that filter added to more screens.

@ghost ghost mentioned this pull request Jan 21, 2022
3 tasks
@ghost
Copy link
Author

ghost commented Jan 21, 2022

@chimp1984 I fixed these small issues you mentioned on particular code lines.

1.

Regarding code reusability I've moved it forward, details:

  • I created FilteringUtils that supports filtering upon certain entities
  • I created generic FilterBox component that encapsulates filtering layout, listener and common logic

The main problem I have now is some inconsistency in code - fields are rendered in two ways:
A) with model usage, like here
B) inside item, like here

I think we should unify it (personally I think B approach is better). What do you think?

I'll appreciate your feedback about changes I made so far.

2.

basically it shoud always take the display string as that is what users would expect to be able to filter. Maybe there are some cases where additional domain data filtering is useful as well, but should be additional to the display string case.

Let's polish it after all of the work regarding reusability will be done

3.

I am not so 100% sure if we should show the filter fields by default or extend it just when the user demand it. E.g. add a filter icon and when the user opens it show the field. That would help to not overload more the already overloaded UI.
We can persist the selection of hte icon, so users who prefer to have the filter get it automatically displayed at next restart.

It seems to be quite complex - I prefer not doing it in the scope of this particular pull request.

@ghost ghost requested a review from chimp1984 January 21, 2022 20:23
@chimp1984
Copy link
Contributor

I think we should unify it (personally I think B approach is better). What do you think?

Yes agree. Don't remember the reasons why that was in the ViewModel, maybe because it accessed other ViewDataModel code or as it was already used from earlier code. But I also dislike that.

Rest looks good to me. Not sure if I find time for a full review... If @ripcurlx does not find time ping me again.

Thanks.

@ghost
Copy link
Author

ghost commented Jan 22, 2022

I think we should unify it (personally I think B approach is better). What do you think?

Yes agree.

This part is finished - FilterBox is now used consistently across all of the lists.

@ripcurlx
Copy link
Contributor

I'll try to review it tomorrow. Could you please resolve the conflict of this PR with master which was caused by a merge today. Thanks!

@ghost
Copy link
Author

ghost commented Jan 24, 2022

Thanks @ripcurlx. It's rebased.

@ripcurlx
Copy link
Contributor

I'm in the middle of an in-depth code review and started now to test it in the client itself.
When entering send funds it fails with following exception:

java.lang.NullPointerException: Cannot invoke "bisq.desktop.components.list.FilterBox.initialize(javafx.collections.transformation.FilteredList, javafx.scene.control.TableView)" because "this.filterBox" is null
	at bisq.desktop.main.funds.withdrawal.WithdrawalView.initialize(WithdrawalView.java:190)
	at bisq.desktop.common.view.InitializableView.initialize(InitializableView.java:41)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2655)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
	at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2517)
	at bisq.desktop.common.fxml.FxmlViewLoader.loadFromFxml(FxmlViewLoader.java:107)

@ripcurlx
Copy link
Contributor

I think it would be great to ignore lower upper case differentiation in transactions on the Details column as users are expecting it like that IMO

@ripcurlx
Copy link
Contributor

I think it would be great to ignore lower upper case differentiation in transactions on the Details column as users are expecting it like that IMO

Similar behavior would be great for:

  • My Open Offers for Date/Time, Market, payment method and offer type
  • Open Trades for Date/Time, Market,Payment method and My role
  • Unconfirmed BSQ Swaps for Date/Time,Market and Offer type (actually not sure why we display the market at all in BSQ Swaps)
  • History for Date/Time, Market, Offer type and status
  • Failed for Date/Time, Market, Offer type and status

But great to see this option now for all lists 👍

@ghost
Copy link
Author

ghost commented Jan 25, 2022

@ripcurlx Thanks for review - I either fixed or put additional explanation on comments

@ghost ghost requested a review from ripcurlx January 25, 2022 14:13
Copy link
Contributor

@ripcurlx ripcurlx left a comment

Choose a reason for hiding this comment

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

ACK - Tested it on Regtest

@ripcurlx ripcurlx merged commit ffd2a92 into bisq-network:master Jan 26, 2022
@ghost
Copy link

ghost commented Feb 1, 2022

Column sorting by date is broken in portfolio -> closed trades view. It used to sort by date, now it sorts by date string.

@pazza83
Copy link

pazza83 commented Mar 12, 2022

@xyzmaker123 thanks for this. It is working well for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a filter to the 'Funds' section in Bisq to able searching of; Trade IDs, Tx IDs, BTC amount, etc
3 participants