Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jans-cli-tui): keybindings <d> and <delete> to delete item, <v> to view item #7729

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions jans-cli-tui/cli_tui/plugins/010_auth_server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 <b>s</b> to save client summary, <b>d</b> to display configurations")),
jans_help=HTML(_("Press key <b>s</b> to save client summary, <b>v</b> to display configurations")),
custom_key_bindings=[('s', self.save_client_summary)],
headerColor=cli_style.navbar_headcolor,
entriesColor=cli_style.navbar_entriescolor,
Expand All @@ -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'<s> {_("Save client summary")}\n')


self.oauth_containers['keys'] = HSplit([
VSplit([
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions jans-cli-tui/cli_tui/utils/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ class common_strings:
help_enter = f'<Enter> {_("Confirm or Edit current selection")}'
help_esc = f'<Esc> {_("Close the current dialog")}'
help_alt_letter = f'<Alt + letter> {_("Navigate to an other tab")}'
help_d = f'<d> {_("Display current item in JSON format if possible")}'
help_delete = f'<Delete> {_("Delete current item project if possible")}'
help_d = f'<v> {_("View current item in JSON format if possible")}'
help_delete = f'<d> <Delete> {_("Delete current item project if possible")}'
help_link_str = f'{_("For More Visit")} https://docs.jans.io/v1.0.6/admin/config-guide/tui/'
3 changes: 2 additions & 1 deletion jans-cli-tui/cli_tui/wui_components/jans_vetrical_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down