parent
de18a9f293
commit
749ca41080
@ -0,0 +1,25 @@ |
||||
from typing import List, Dict |
||||
|
||||
from asciimatics.widgets import Label |
||||
|
||||
from ...utils import get_failed_operations |
||||
from ..TransactionView import TransactionView |
||||
|
||||
|
||||
class AddUserTransactionView(TransactionView): |
||||
def _show_msg(self, msg: str = '\n'): |
||||
for line in msg.splitlines(): |
||||
self._msg_layout.add_widget(Label(line, align='^')) |
||||
|
||||
def write_extra_txn_info(self, data: List[Dict]): |
||||
if data[-1]['status'] != 'completed': |
||||
return |
||||
result = data[-1]['result'] |
||||
failed_operations = get_failed_operations(data) |
||||
self._show_msg() |
||||
self._show_msg('User password is: ' + result['password']) |
||||
if 'send_welcome_message' in failed_operations: |
||||
self._show_msg() |
||||
self._show_msg('Since the welcome message was not sent,') |
||||
self._show_msg('you need to email this password to the user.') |
||||
self.force_update() |
Loading…
Reference in new issue