Skip to content

Commit

Permalink
add a way to pause loader, so we can read errors
Browse files Browse the repository at this point in the history
Signed-off-by: matthias.gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Feb 13, 2024
1 parent b079dcc commit 64c9869
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion osc_tui/popup.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,12 @@ def delete_cb():
form.current_grid.refresh()


loaderPause = False

def pauseLoader():
global loaderPause
loaderPause = True

def startLoading(form, refresh):
term_size = os.get_terminal_size()
class PendingPopup(fmForm.Form):
Expand Down Expand Up @@ -991,6 +997,7 @@ def capsule():

thread = Thread(target=capsule)
thread.start()
global loaderPause
i = 0
while waiting:
frames = [
Expand Down Expand Up @@ -1022,12 +1029,14 @@ def capsule():
" /\n" +
" +-- \n"
]
notify(frames[i], wide=True)
if loaderPause is False:
notify(frames[i], wide=True)
i = i + 1
if(i >= len(frames)):
i = 0
curses.napms(150)
curses.flushinp()
loaderPause = False
thread.join()


Expand Down
1 change: 1 addition & 0 deletions osc_tui/profileSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def cb():
try:
result = func(*args, **kwargs)
except requests.exceptions.HTTPError as e:
popup.pauseLoader()
oscscreen.notify_confirm(
"Error while submitting the request:\n{}\nCode: {}\nReason: {}".
format(main.GATEWAY.log.str(),
Expand Down

0 comments on commit 64c9869

Please sign in to comment.