parent
ebaeeaaf13
commit
6b3ad28e89
@ -0,0 +1,42 @@ |
||||
from asciimatics.widgets import Layout, Text |
||||
|
||||
from ...utils import defer, http_post |
||||
from ..CeoFrame import CeoFrame |
||||
from ceod.transactions.groups import AddGroupTransaction |
||||
|
||||
|
||||
class AddGroupView(CeoFrame): |
||||
def __init__(self, screen, width, height, model): |
||||
super().__init__( |
||||
screen, height, width, model, 'AddGroup', |
||||
save_data=True, |
||||
) |
||||
layout = Layout([100], fill_frame=True) |
||||
self.add_layout(layout) |
||||
self._cn = Text('Name:', 'cn') |
||||
layout.add_widget(self._cn) |
||||
self._description = Text('Description:', 'description') |
||||
layout.add_widget(self._description) |
||||
|
||||
self.add_buttons( |
||||
back_btn=True, |
||||
next_scene='Confirm', on_next=self._next) |
||||
self.fix() |
||||
|
||||
def _next(self): |
||||
cn = self._cn.value |
||||
description = self._description.value |
||||
body = { |
||||
'cn': cn, |
||||
'description': description, |
||||
} |
||||
self._model.confirm_lines = [ |
||||
'The following group will be created:', |
||||
'', |
||||
('cn', cn), |
||||
('description', description), |
||||
'', |
||||
'Are you sure you want to continue?', |
||||
] |
||||
self._model.deferred_req = defer(http_post, '/api/groups', json=body) |
||||
self._model.operations = AddGroupTransaction.operations |
@ -0,0 +1,2 @@ |
||||
# -*- coding: utf-8 -*- |
||||
|
Loading…
Reference in new issue