From 8ef02ba10ba3cedbca65014fa836a0b4ea480fda Mon Sep 17 00:00:00 2001 From: Mustafa Baser Date: Mon, 21 Nov 2022 15:40:43 +0300 Subject: [PATCH] fix: jans-cli search scope (ref: #3045) --- .../cli_tui/plugins/010_oxauth/main.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/jans-cli-tui/cli_tui/plugins/010_oxauth/main.py b/jans-cli-tui/cli_tui/plugins/010_oxauth/main.py index b629acd59e5..7c460759bae 100755 --- a/jans-cli-tui/cli_tui/plugins/010_oxauth/main.py +++ b/jans-cli-tui/cli_tui/plugins/010_oxauth/main.py @@ -355,20 +355,14 @@ async def coroutine(): def oauth_get_scopes( self, - start_index: Optional[int]= 0, - pattern: Optional[str]= '', + start_index: Optional[int]= 0, + pattern: Optional[str]= '', ) -> None: """update the current Scopes data to server Args: start_index (int, optional): add Button("Prev") to the layout. Defaults to 0. """ - def get_next( - start_index: int, - pattern: Optional[str]= '', - ) -> None: - self.oauth_get_scopes(start_index, pattern='') - async def coroutine(): @@ -376,7 +370,6 @@ async def coroutine(): if pattern: endpoint_args +=',pattern:'+pattern - cli_args = {'operation_id': 'get-oauth-scopes', 'endpoint_args':endpoint_args} self.app.start_progressing() response = await get_event_loop().run_in_executor(self.app.executor, self.app.cli_requests, cli_args) @@ -419,12 +412,12 @@ async def coroutine(): buttons = [] if start_index > 0: - handler_partial = partial(get_next, start_index-self.app.entries_per_page, pattern) + handler_partial = partial(self.oauth_get_scopes, start_index-self.app.entries_per_page, pattern) prev_button = Button(_("Prev"), handler=handler_partial) prev_button.window.jans_help = _("Retreives previous %d entries") % self.app.entries_per_page buttons.append(prev_button) if result['start'] + self.app.entries_per_page < result['totalEntriesCount']: - handler_partial = partial(get_next, start_index+self.app.entries_per_page, pattern) + handler_partial = partial(self.oauth_get_scopes, start_index+self.app.entries_per_page, pattern) next_button = Button(_("Next"), handler=handler_partial) next_button.window.jans_help = _("Retreives next %d entries") % self.app.entries_per_page buttons.append(next_button) @@ -759,9 +752,7 @@ def search_scope(self, tbuffer:Buffer,) -> None: self.app.show_message(_("Error!"), _("Search string should be at least three characters"),tobefocused=self.oauth_containers['scopes']) return - t = threading.Thread(target=self.oauth_update_scopes, args=(0,tbuffer.text), daemon=True) - self.app.start_progressing() - t.start() + self.oauth_get_scopes(pattern=tbuffer.text) def search_clients(self, tbuffer:Buffer,) -> None: if not len(tbuffer.text) > 2: