Skip to content

Commit

Permalink
fix: jans-cli add threads for Clients Delete (ref: #2868)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelwahabAdam committed Nov 5, 2022
1 parent 82f6d35 commit 357c44f
Showing 1 changed file with 13 additions and 43 deletions.
56 changes: 13 additions & 43 deletions jans-cli-tui/plugins/010_oxauth/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 357c44f

Please sign in to comment.