From 357c44fde657991601aa4a795fff33774356d86a Mon Sep 17 00:00:00 2001 From: AbdelwahabAdam Date: Sat, 5 Nov 2022 06:46:30 -0700 Subject: [PATCH] fix: jans-cli add threads for Clients Delete (ref: #2868) --- jans-cli-tui/plugins/010_oxauth/main.py | 56 ++++++------------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/jans-cli-tui/plugins/010_oxauth/main.py b/jans-cli-tui/plugins/010_oxauth/main.py index 0c307b7b4ee..fe4fb17663a 100755 --- a/jans-cli-tui/plugins/010_oxauth/main.py +++ b/jans-cli-tui/plugins/010_oxauth/main.py @@ -323,15 +323,14 @@ def oauth_get_clients(self) -> None: self.app.start_progressing() t.start() - def delete_client(self) -> None: + def delete_client(self, **kwargs: Any) -> None: """Method to get the clients data from server """ - t = threading.Thread(target=self.oauth_update_delete_client, daemon=True) + t = threading.Thread(target=self.oauth_delete_client(kwargs), daemon=True) self.app.start_progressing() t.start() - - def oauth_update_delete_client(self, **kwargs: Any): + def oauth_delete_client(self, kwargs: Any): """This method for the deletion of the clients data Args: @@ -370,45 +369,6 @@ async def coroutine(): asyncio.ensure_future(coroutine()) - - - # def delete_client(self, **kwargs: Any): - # """This method for the deletion of the clients data - - # Args: - # selected (_type_): The selected Client - # event (_type_): _description_ - - # Returns: - # str: The server response - # """ - - # dialog = self.app.get_confirm_dialog(_("Are you sure want to delete client inum:")+"\n {} ?".format(kwargs ['selected'][0])) - - # async def coroutine(): - # focused_before = self.app.layout.current_window - # result = await self.app.show_dialog_as_float(dialog) - # try: - # self.app.layout.focus(focused_before) - # except: - # self.app.layout.focus(self.app.center_frame) - - # if result.lower() == 'yes': - # result = self.app.cli_object.process_command_by_id( - # operation_id='delete-oauth-openid-clients-by-inum', - # url_suffix='inum:{}'.format(kwargs ['selected'][0]), - # endpoint_args='', - # data_fn='', - # data={} - # ) - # # TODO Need to do `self.oauth_get_clients()` only if clients list is not empty - # self.oauth_get_clients() - # return result - - # asyncio.ensure_future(coroutine()) - - - def oauth_get_scopes( self, start_index: Optional[int]= 0, @@ -781,6 +741,16 @@ def save_client(self, dialog: Dialog) -> None: self.app.show_message(_("Error!"), _("An error ocurred while saving client:\n") + str(response.text)) + + # def oauth_save_client(self, dialog: Dialog) -> None: + # """Method to get the clients data from server + # """ + # t = threading.Thread(target=self.oauth_delete_client, daemon=True) + # self.app.start_progressing() + # t.start() + + + def save_scope(self, dialog: Dialog) -> None: """This method to save the client data to server