From f06753fbf62617baa504dda85eafa2510e0032f6 Mon Sep 17 00:00:00 2001 From: AbdelwahabAdam Date: Tue, 29 Nov 2022 00:31:11 -0800 Subject: [PATCH] fix: jans-cli Error on deleting without verification of deletion (ref: #3107) --- jans-cli-tui/cli_tui/plugins/020_fido/main.py | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/jans-cli-tui/cli_tui/plugins/020_fido/main.py b/jans-cli-tui/cli_tui/plugins/020_fido/main.py index 496cfa46936..7029fb94971 100755 --- a/jans-cli-tui/cli_tui/plugins/020_fido/main.py +++ b/jans-cli-tui/cli_tui/plugins/020_fido/main.py @@ -69,7 +69,25 @@ def add_request_party(dialog: Dialog) -> None: def delete_requested_party(self, **kwargs: Any) -> None: """This method for deleting the requested party """ - self.requested_parties_container.remove_item(kwargs['selected']) + + dialog = self.app.get_confirm_dialog(_("Are you sure want to delete requested patry:")+"\n {} ?".format(kwargs['selected'][1])) + + 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.stop_progressing() + self.app.layout.focus(self.app.center_frame) + + if result.lower() == 'yes': + self.requested_parties_container.remove_item(kwargs['selected']) + self.app.stop_progressing() + + return result + + asyncio.ensure_future(coroutine()) def create_widgets(self): self.schema = self.app.cli_object.get_schema_from_reference('Fido2', '#/components/schemas/AppConfiguration')