2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-10 13:10:26 +00:00

Go to portfolio page after exiting entry update menu

This commit is contained in:
Miguel Mota 2021-01-31 22:30:20 -08:00
parent 11d6ec1878
commit 3c9b482708
3 changed files with 12 additions and 4 deletions

View File

@ -218,6 +218,8 @@ docker-run:
docker-push: docker-push:
docker push cointop/cointop:latest docker push cointop/cointop:latest
docker-build-and-push: docker-build docker-push
docker-run-ssh: docker-run-ssh:
docker run -p 2222:22 -v ~/.ssh/demo:/keys --entrypoint cointop -it cointop/cointop server -k /keys/id_rsa docker run -p 2222:22 -v ~/.ssh/demo:/keys --entrypoint cointop -it cointop/cointop server -k /keys/id_rsa

View File

@ -332,6 +332,9 @@ func (ct *Cointop) SetPortfolioHoldings() error {
ct.debuglog("setPortfolioHoldings()") ct.debuglog("setPortfolioHoldings()")
defer ct.HidePortfolioUpdateMenu() defer ct.HidePortfolioUpdateMenu()
coin := ct.HighlightedRowCoin() coin := ct.HighlightedRowCoin()
if coin == nil {
return nil
}
// read input field // read input field
b := make([]byte, 100) b := make([]byte, 100)
@ -370,6 +373,7 @@ func (ct *Cointop) SetPortfolioHoldings() error {
return err return err
} }
ct.ToggleShowPortfolio()
return nil return nil
} }
@ -559,14 +563,14 @@ func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error {
if sortBy != "" { if sortBy != "" {
if _, ok := portfolioColumns[sortBy]; !ok { if _, ok := portfolioColumns[sortBy]; !ok {
return fmt.Errorf("The option %q is not a valid column name", sortBy) return fmt.Errorf("the option %q is not a valid column name", sortBy)
} }
ct.Sort(sortBy, sortDesc, holdings, true) ct.Sort(sortBy, sortDesc, holdings, true)
} }
if _, ok := outputFormats[format]; !ok { if _, ok := outputFormats[format]; !ok {
return fmt.Errorf("The option %q is not a valid format type", format) return fmt.Errorf("the option %q is not a valid format type", format)
} }
total := ct.GetPortfolioTotal() total := ct.GetPortfolioTotal()
@ -574,7 +578,7 @@ func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error {
symbol := ct.CurrencySymbol() symbol := ct.CurrencySymbol()
for i, entry := range holdings { for i, entry := range holdings {
if filter != nil && len(filter) > 0 { if len(filter) > 0 {
found := false found := false
for _, item := range filter { for _, item := range filter {
item = strings.ToLower(strings.TrimSpace(item)) item = strings.ToLower(strings.TrimSpace(item))
@ -687,7 +691,7 @@ func (ct *Cointop) PrintTotalHoldings(options *TablePrintOptions) error {
portfolio := ct.GetPortfolioSlice() portfolio := ct.GetPortfolioSlice()
var total float64 var total float64
for _, entry := range portfolio { for _, entry := range portfolio {
if filter != nil && len(filter) > 0 { if len(filter) > 0 {
found := false found := false
for _, item := range filter { for _, item := range filter {
item = strings.ToLower(strings.TrimSpace(item)) item = strings.ToLower(strings.TrimSpace(item))

View File

@ -256,6 +256,7 @@ func (ct *Cointop) UpdatePriceAlertsUpdateMenu(isNew bool) error {
// ShowPriceAlertsAddMenu shows the alert add menu // ShowPriceAlertsAddMenu shows the alert add menu
func (ct *Cointop) ShowPriceAlertsAddMenu() error { func (ct *Cointop) ShowPriceAlertsAddMenu() error {
ct.debuglog("showPriceAlertsAddMenu()") ct.debuglog("showPriceAlertsAddMenu()")
ct.ToggleSelectedView(PriceAlertsView)
ct.State.lastSelectedRowIndex = ct.HighlightedPageRowIndex() ct.State.lastSelectedRowIndex = ct.HighlightedPageRowIndex()
ct.UpdatePriceAlertsUpdateMenu(true) ct.UpdatePriceAlertsUpdateMenu(true)
ct.ui.SetCursor(true) ct.ui.SetCursor(true)
@ -267,6 +268,7 @@ func (ct *Cointop) ShowPriceAlertsAddMenu() error {
// ShowPriceAlertsUpdateMenu shows the alerts update menu // ShowPriceAlertsUpdateMenu shows the alerts update menu
func (ct *Cointop) ShowPriceAlertsUpdateMenu() error { func (ct *Cointop) ShowPriceAlertsUpdateMenu() error {
ct.ToggleSelectedView(PriceAlertsView)
ct.debuglog("showPriceAlertsUpdateMenu()") ct.debuglog("showPriceAlertsUpdateMenu()")
ct.State.lastSelectedRowIndex = ct.HighlightedPageRowIndex() ct.State.lastSelectedRowIndex = ct.HighlightedPageRowIndex()
ct.UpdatePriceAlertsUpdateMenu(false) ct.UpdatePriceAlertsUpdateMenu(false)