Skip to content

Commit

Permalink
fix: jans-cli more progressing
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar committed Oct 31, 2022
1 parent 46bed0b commit 1235cd6
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions jans-cli-tui/plugins/010_oxauth/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,11 @@ def get_next(
data_fn=None,
data={}
)

except Exception as e:
self.app.stop_progressing()
self.app.show_message(_("Error getting scopes"), str(e))
return
self.app.stop_progressing()

if rsponse.status_code not in (200, 201):
self.app.show_message(_("Error getting scopes"), str(rsponse.text))
Expand Down Expand Up @@ -422,6 +423,7 @@ def oauth_get_scopes(self) -> None:
"""
self.oauth_data_container['scopes'] = HSplit([Label(_("Please wait while getting Scopes"),style='class:outh-waitscopedata.label')], width=D(),style='class:outh-waitclientdata')
t = threading.Thread(target=self.oauth_update_scopes, daemon=True)
self.app.start_progressing()
t.start()

# ---------------------------------------------------------------------- #
Expand Down Expand Up @@ -456,11 +458,12 @@ def get_next(
data_fn=None,
data={}
)

except Exception as e:
self.app.stop_progressing()
self.app.show_message(_("Error getting properties"), str(e))
return

self.app.stop_progressing()
if rsponse.status_code not in (200, 201):
self.app.show_message(_("Error getting properties"), str(rsponse.text))
return
Expand Down Expand Up @@ -568,6 +571,7 @@ def oauth_get_properties(self) -> None:
"""
self.oauth_data_container['properties'] = HSplit([Label(_("Please wait while getting properties"),style='class:outh-waitclientdata.label')], width=D(),style='class:outh-waitclientdata')
t = threading.Thread(target=self.oauth_update_properties, daemon=True)
self.app.start_progressing()
t.start()

def view_property(self, **params: Any) -> None:
Expand All @@ -591,6 +595,7 @@ def search_properties(self, tbuffer:Buffer,) -> None:
self.app.show_message(_("Error!"), _("Search string should be at least three characters"),tobefocused=self.oauth_containers['properties'])
return
t = threading.Thread(target=self.oauth_update_properties, args=(0,tbuffer.text), daemon=True)
self.app.start_progressing()
t.start()

# ---------------------------------------------------------------------- #
Expand All @@ -611,9 +616,11 @@ def oauth_update_keys(self) -> None:
data={}
)
except Exception as e:
self.app.stop_progressing()
self.app.show_message(_("Error getting keys"), str(e))
return

self.app.stop_progressing()
if rsponse.status_code not in (200, 201):
self.app.show_message(_("Error getting keys"), str(rsponse.text))
return
Expand Down Expand Up @@ -665,6 +672,7 @@ def oauth_get_keys(self) -> None:
"""
self.oauth_data_container['keys'] = HSplit([Label(_("Please wait while getting Keys"), style='class:outh-waitscopedata.label')], width=D(), style='class:outh-waitclientdata')
t = threading.Thread(target=self.oauth_update_keys, daemon=True)
self.app.start_progressing()
t.start()

def edit_scope_dialog(self, **params: Any) -> None:
Expand Down Expand Up @@ -699,7 +707,7 @@ def save_client(self, dialog: Dialog) -> None:
data_fn='',
data=dialog.data
)

self.app.stop_progressing()
if response.status_code in (200, 201):
self.oauth_get_clients()
return True
Expand All @@ -723,7 +731,7 @@ def save_scope(self, dialog: Dialog) -> None:
data_fn='',
data=dialog.data
)

self.app.stop_progressing()
if response.status_code in (200, 201):
self.oauth_get_scopes()
return True
Expand All @@ -736,6 +744,7 @@ def search_scope(self, tbuffer:Buffer,) -> None:
return

t = threading.Thread(target=self.oauth_update_scopes, args=(0,tbuffer.text), daemon=True)
self.app.start_progressing()
t.start()

def search_clients(self, tbuffer:Buffer,) -> None:
Expand All @@ -744,6 +753,7 @@ def search_clients(self, tbuffer:Buffer,) -> None:
return

t = threading.Thread(target=self.oauth_update_clients, args=(0,tbuffer.text), daemon=True)
self.app.start_progressing()
t.start()

def add_scope(self) -> None:
Expand Down

0 comments on commit 1235cd6

Please sign in to comment.