rvv041 - Code optimizations

ABList removed from focusRing
	 address_book's column address renamed to abaddress
This commit is contained in:
Rene V. Vergara A. 2024-06-03 14:04:16 -04:00
parent 1c88ea5f08
commit 51116e8083
2 changed files with 15 additions and 15 deletions

View file

@ -1050,12 +1050,12 @@ appEvent (BT.VtyEvent e) = do
Just (_, a) -> do
liftIO $
setClipboard $
T.unpack $ addressBookAddress (entityVal a)
T.unpack $ addressBookAbaddress (entityVal a)
BT.modify $
set msg $
"Address copied to Clipboard from >>\n" ++
T.unpack (addressBookDescrip (entityVal a)) ++ "->\n" ++
T.unpack (addressBookAddress (entityVal a)) ++ "!"
T.unpack (addressBookAbaddress (entityVal a)) ++ "!"
BT.modify $ set displayBox MsgDisplay
_ -> do
BT.modify $ set msg "Error while copying the address!!"
@ -1066,7 +1066,7 @@ appEvent (BT.VtyEvent e) = do
Just (_, a) -> do
BT.modify $
set txForm $
mkSendForm (s ^. balance) (SendInput (addressBookAddress (entityVal a)) 0.0 "")
mkSendForm (s ^. balance) (SendInput (addressBookAbaddress (entityVal a)) 0.0 "")
BT.modify $ set dialogBox SendTx
_ -> do
BT.modify $ set msg "No receiver address available!!"
@ -1075,10 +1075,10 @@ appEvent (BT.VtyEvent e) = do
V.EvKey (V.KChar 'e') [] -> do
case L.listSelectedElement $ s ^. abaddresses of
Just (_, a) -> do
BT.modify $ set abCurAdrs (addressBookAddress (entityVal a))
BT.modify $ set abCurAdrs (addressBookAbaddress (entityVal a))
BT.modify $
set abForm $
mkNewABForm (AdrBookEntry (addressBookDescrip (entityVal a)) (addressBookAddress (entityVal a)))
mkNewABForm (AdrBookEntry (addressBookDescrip (entityVal a)) (addressBookAbaddress (entityVal a)))
BT.modify $ set dialogBox AdrBookUpdForm
_ -> do
BT.modify $ set dialogBox Blank
@ -1086,10 +1086,10 @@ appEvent (BT.VtyEvent e) = do
V.EvKey (V.KChar 'd') [] -> do
case L.listSelectedElement $ s ^. abaddresses of
Just (_, a) -> do
BT.modify $ set abCurAdrs (addressBookAddress (entityVal a))
BT.modify $ set abCurAdrs (addressBookAbaddress (entityVal a))
BT.modify $
set abForm $
mkNewABForm (AdrBookEntry (addressBookDescrip (entityVal a)) (addressBookAddress (entityVal a)))
mkNewABForm (AdrBookEntry (addressBookDescrip (entityVal a)) (addressBookAbaddress (entityVal a)))
BT.modify $ set dialogBox AdrBookDelForm
_ -> do
BT.modify $ set dialogBox Blank
@ -1105,7 +1105,7 @@ appEvent (BT.VtyEvent e) = do
" Descr: " ++
T.unpack (addressBookDescrip (entityVal a)) ++
"\n Address: " ++
T.unpack (addressBookAddress (entityVal a))
T.unpack (addressBookAbaddress (entityVal a))
BT.modify $ set displayBox AdrBookEntryDisplay
_ -> do
BT.modify $ set dialogBox Blank
@ -1322,7 +1322,7 @@ runZenithCLI config = do
else Blank)
True
(mkInputForm $ DialogInput "Main")
(F.focusRing [AList, TList,ABList])
(F.focusRing [AList, TList])
(zgb_blocks chainInfo)
dbFilePath
host

View file

@ -249,8 +249,8 @@ share
AddressBook
network ZcashNetDB
descrip T.Text
address T.Text
UniqueABA address
abaddress T.Text
UniqueABA abaddress
deriving Show Eq
|]
@ -1500,8 +1500,8 @@ updateAdrsInAdrBook pool d a ia = do
PS.retryOnBusy $
flip PS.runSqlPool pool $ do
update $ \ab -> do
set ab [AddressBookDescrip =. val d, AddressBookAddress =. val a]
where_ $ ab ^. AddressBookAddress ==. val ia
set ab [AddressBookDescrip =. val d, AddressBookAbaddress =. val a]
where_ $ ab ^. AddressBookAbaddress ==. val ia
-- | Get one AddrssBook record using the Address as a key
getABookRec :: ConnectionPool -> T.Text -> IO [Entity AddressBook]
@ -1511,7 +1511,7 @@ getABookRec pool a = do
flip PS.runSqlPool pool $
select $ do
adrbook <- from $ table @AddressBook
where_ ((adrbook ^. AddressBookAddress) ==. val a)
where_ ((adrbook ^. AddressBookAbaddress) ==. val a)
return adrbook
-- | delete an existing address from AddressBook
@ -1522,7 +1522,7 @@ deleteAdrsFromAB pool ia = do
flip PS.runSqlPool pool $ do
delete $ do
ab <- from $ table @AddressBook
where_ (ab ^. AddressBookAddress ==. val ia)
where_ (ab ^. AddressBookAbaddress ==. val ia)
rmdups :: Ord a => [a] -> [a]
rmdups = map head . group . sort