From fa0da850df0346ec44caed70dfc287bb7733e089 Mon Sep 17 00:00:00 2001 From: Mustafa Baser Date: Wed, 14 Feb 2024 21:09:54 +0300 Subject: [PATCH] feat(jans-cli-tui): keybindings and to delete item, to view item Signed-off-by: Mustafa Baser --- .../cli_tui/plugins/010_auth_server/main.py | 14 +++++++------- jans-cli-tui/cli_tui/utils/static.py | 4 ++-- .../cli_tui/wui_components/jans_vetrical_nav.py | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/jans-cli-tui/cli_tui/plugins/010_auth_server/main.py b/jans-cli-tui/cli_tui/plugins/010_auth_server/main.py index e286fc54d0d..aa2d53addef 100755 --- a/jans-cli-tui/cli_tui/plugins/010_auth_server/main.py +++ b/jans-cli-tui/cli_tui/plugins/010_auth_server/main.py @@ -27,8 +27,7 @@ from utils.static import DialogResult, cli_style, common_strings from utils.background_tasks import retrieve_enabled_scripts -from utils.utils import DialogUtils -from utils.utils import common_data +from utils.utils import DialogUtils, common_data, get_help_with from utils.multi_lang import _ from wui_components.jans_path_browser import jans_file_browser_dialog, BrowseType @@ -108,11 +107,11 @@ async def get_appconfiguration(self) -> None: def help(self): current_tab = self.nav_bar.navbar_entries[self.nav_bar.cur_navbar_selection][0] - tap_help = getattr(getattr(self, current_tab, None), 'jans_help', None) - if tap_help: - help_message = tap_help + if hasattr(self.oauth_containers[current_tab], 'jans_help'): + help_message = self.oauth_containers[current_tab].jans_help else: help_message = self.app.jans_help + self.app.show_message(_("Help "),help_message,tobefocused=self.app.center_container) async def retrieve_sopes(self) -> None: @@ -204,7 +203,7 @@ def oauth_prepare_containers(self) -> None: on_enter=self.edit_client, on_display=self.app.data_display_dialog, on_delete=self.delete_client, - jans_help=HTML(_("Press key s to save client summary, d to display configurations")), + jans_help=HTML(_("Press key s to save client summary, v to display configurations")), custom_key_bindings=[('s', self.save_client_summary)], headerColor=cli_style.navbar_headcolor, entriesColor=cli_style.navbar_entriescolor, @@ -224,6 +223,8 @@ def oauth_prepare_containers(self) -> None: DynamicContainer(lambda: self.clients_container_buttons) ],style=cli_style.container) + self.oauth_containers['clients'].jans_help = get_help_with(f' {_("Save client summary")}\n') + self.oauth_containers['keys'] = HSplit([ VSplit([ @@ -318,7 +319,6 @@ def oauth_nav_selection_changed( self.oauth_main_area = set_area - def save_client_summary(self, event): def do_save(path): diff --git a/jans-cli-tui/cli_tui/utils/static.py b/jans-cli-tui/cli_tui/utils/static.py index 571a59189a6..343fa46069e 100755 --- a/jans-cli-tui/cli_tui/utils/static.py +++ b/jans-cli-tui/cli_tui/utils/static.py @@ -36,6 +36,6 @@ class common_strings: help_enter = f' {_("Confirm or Edit current selection")}' help_esc = f' {_("Close the current dialog")}' help_alt_letter = f' {_("Navigate to an other tab")}' - help_d = f' {_("Display current item in JSON format if possible")}' - help_delete = f' {_("Delete current item project if possible")}' + help_d = f' {_("View current item in JSON format if possible")}' + help_delete = f' {_("Delete current item project if possible")}' help_link_str = f'{_("For More Visit")} https://docs.jans.io/v1.0.6/admin/config-guide/tui/' diff --git a/jans-cli-tui/cli_tui/wui_components/jans_vetrical_nav.py b/jans-cli-tui/cli_tui/wui_components/jans_vetrical_nav.py index a37e754c7d8..093a19a1f16 100644 --- a/jans-cli-tui/cli_tui/wui_components/jans_vetrical_nav.py +++ b/jans-cli-tui/cli_tui/wui_components/jans_vetrical_nav.py @@ -379,7 +379,7 @@ def _(event): if self.change_password: self.change_password(data=self.all_data[self.selectes]) - @kb.add('d') + @kb.add('v') def _(event): if not self.data: return @@ -392,6 +392,7 @@ def _(event): size=size, data=self.all_data[self.selectes]) + @kb.add('d') @kb.add('delete') def _(event): if self.data and self.on_delete: