From aea679ef92e94d624b4c359e01e70c6775b1c196 Mon Sep 17 00:00:00 2001 From: oleksandrK Date: Wed, 16 Aug 2023 16:35:27 +0200 Subject: [PATCH 1/3] Fix channels filter "Opened with". --- src/Pages/Channels.razor | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Pages/Channels.razor b/src/Pages/Channels.razor index 6bec5063..53e281f2 100644 --- a/src/Pages/Channels.razor +++ b/src/Pages/Channels.razor @@ -105,6 +105,7 @@ { @wallet.Name } + Unknown @@ -778,14 +779,25 @@ return true; } - private bool OnWalletFilter(object? itemValue, object? searchValue) +private bool OnWalletFilter(object? itemValue, object? searchValue) +{ + if (searchValue == null) + return true; + + if (searchValue is int intValue && (intValue == 0 || intValue == _wallets.Count + 1)) { - //If the wallet is null it might be a externally created channel, so we return true - if (itemValue == null) return true; + return itemValue == null; + } - return searchValue == null || (int) searchValue == 0 || (int) itemValue == (int) searchValue; + if (itemValue is int itemIntValue && searchValue is int searchIntValue) + { + return itemIntValue == searchIntValue; } + return false; +} + + private bool OnSourceNodeIdFilter(object? itemValue, object? searchValue) { //If searchValue is null, we set it to the filter initial value in the field From bebf98889d04ec1b26384cfeaecfb072ce5d0cc6 Mon Sep 17 00:00:00 2001 From: oleksandrK Date: Thu, 17 Aug 2023 12:56:39 +0200 Subject: [PATCH 2/3] Added some improvements. --- src/Pages/Channels.razor | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Pages/Channels.razor b/src/Pages/Channels.razor index 53e281f2..df884627 100644 --- a/src/Pages/Channels.razor +++ b/src/Pages/Channels.razor @@ -781,9 +781,9 @@ private bool OnWalletFilter(object? itemValue, object? searchValue) { - if (searchValue == null) + if (searchValue == null || searchValue as int? == 0){ return true; - + } if (searchValue is int intValue && (intValue == 0 || intValue == _wallets.Count + 1)) { return itemValue == null; @@ -797,7 +797,6 @@ private bool OnWalletFilter(object? itemValue, object? searchValue) return false; } - private bool OnSourceNodeIdFilter(object? itemValue, object? searchValue) { //If searchValue is null, we set it to the filter initial value in the field From cde7835e1b159b3073510b6b1342fb31a6a18b05 Mon Sep 17 00:00:00 2001 From: oleksandrK Date: Thu, 17 Aug 2023 16:27:00 +0200 Subject: [PATCH 3/3] Added some improvements of the logic. --- src/Pages/Channels.razor | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/Pages/Channels.razor b/src/Pages/Channels.razor index df884627..7e9abdf3 100644 --- a/src/Pages/Channels.razor +++ b/src/Pages/Channels.razor @@ -105,7 +105,7 @@ { @wallet.Name } - Unknown + Unknown @@ -779,24 +779,20 @@ return true; } -private bool OnWalletFilter(object? itemValue, object? searchValue) -{ - if (searchValue == null || searchValue as int? == 0){ - return true; - } - if (searchValue is int intValue && (intValue == 0 || intValue == _wallets.Count + 1)) + private bool OnWalletFilter(object? itemValue, object? searchValue) { - return itemValue == null; - } + if (searchValue == null || searchValue is 0) + { + return true; + } + if (searchValue is -1) + { + return itemValue == null; + } - if (itemValue is int itemIntValue && searchValue is int searchIntValue) - { - return itemIntValue == searchIntValue; + return itemValue is int itemIntValue && searchValue is int searchIntValue && itemIntValue == searchIntValue; } - return false; -} - private bool OnSourceNodeIdFilter(object? itemValue, object? searchValue) { //If searchValue is null, we set it to the filter initial value in the field