From 11514bca960dc5f7c9723092bf790115120ee9bc Mon Sep 17 00:00:00 2001 From: Timur Nurlygayanov Date: Sun, 24 Feb 2013 07:28:07 -0500 Subject: [PATCH] Added WebUI for correct configuration of new service AD. --- dashboard/api/windc.py | 2 +- dashboard/windc/tables.py | 24 +++++++++++++++++++----- dashboard/windc/workflows.py | 31 +++++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/dashboard/api/windc.py b/dashboard/api/windc.py index f67713e..3d412e8 100644 --- a/dashboard/api/windc.py +++ b/dashboard/api/windc.py @@ -49,7 +49,7 @@ def datacenters_list(request): return windcclient(request).datacenters.list() def services_create(request, datacenter, parameters): - name = parameters.get('name', '') + name = parameters.get('dc_name', '') return windcclient(request).services.create(datacenter, name) def services_list(request, datacenter): diff --git a/dashboard/windc/tables.py b/dashboard/windc/tables.py index 8b24622..0998797 100644 --- a/dashboard/windc/tables.py +++ b/dashboard/windc/tables.py @@ -87,7 +87,7 @@ class DeleteDataCenter(tables.BatchAction): class EditService(tables.LinkAction): name = "edit" - verbose_name = _("Edit Service") + verbose_name = _("Edit") url = "horizon:project:windc:update" classes = ("ajax-modal", "btn-edit") @@ -95,6 +95,16 @@ class EditService(tables.LinkAction): return True +class DeleteService(tables.LinkAction): + name = "delete" + verbose_name = _("Delete") + url = "horizon:project:windc:delete" + classes = ("ajax-modal", "btn-edit") + + def allowed(self, request, instance): + return True + + class ShowDataCenterServices(tables.LinkAction): name = "edit" verbose_name = _("Services") @@ -128,13 +138,17 @@ class WinDCTable(tables.DataTable): class WinServicesTable(tables.DataTable): - name = tables.Column("name", - link=("horizon:project:windc"), - verbose_name=_("Name")) + name = tables.Column('name', + link=('horizon:project:windc'), + verbose_name=_('Name')) + _type = tables.Column('type', + verbose_name=_('Type')) + status = tables.Column('status', + verbose_name=_('Status')) class Meta: name = "services" verbose_name = _("Services") row_class = UpdateRow table_actions = (CreateService,) - row_actions = (EditService,) + row_actions = (EditService, DeleteService) diff --git a/dashboard/windc/workflows.py b/dashboard/windc/workflows.py index 7854b88..e61e81a 100644 --- a/dashboard/windc/workflows.py +++ b/dashboard/windc/workflows.py @@ -72,11 +72,11 @@ class ConfigureDCAction(workflows.Action): class ConfigureDC(workflows.Step): action_class = ConfigureDCAction - contibutes = ("name",) + contibutes = ('name',) def contribute(self, data, context): if data: - context['name'] = data.get("name", "") + context['name'] = data.get('name', '') return context @@ -84,9 +84,9 @@ class ConfigureWinDCAction(workflows.Action): dc_name = forms.CharField(label=_("Domain Name"), required=False) - dc_net_name = forms.CharField(label=_("Domain NetBIOS Name"), - required=False, - help_text=_("A NetBIOS name of new domain.")) + #dc_net_name = forms.CharField(label=_("Domain NetBIOS Name"), + # required=False, + # help_text=_("A NetBIOS name of new domain.")) dc_count = forms.IntegerField(label=_("Domain Controllers Count"), required=True, @@ -114,6 +114,16 @@ class ConfigureWinDCAction(workflows.Action): class ConfigureWinDC(workflows.Step): action_class = ConfigureWinDCAction + contibutes = ('dc_name', 'dc_count', 'adm_password', 'recovery_password') + + def contribute(self, data, context): + if data: + context['dc_name'] = data.get('dc_name', '') + context['dc_count'] = data.get('dc_count', 1) + context['adm_password'] = data.get('adm_password', '') + context['recovery_password'] = data.get('recovery_password', '') + context['type'] = 'active_directory_service' + return context class ConfigureWinIISAction(workflows.Action): @@ -139,6 +149,15 @@ class ConfigureWinIISAction(workflows.Action): class ConfigureWinIIS(workflows.Step): action_class = ConfigureWinIISAction + contibutes = ('iis_name', 'iis_count', 'iis_domain') + + def contribute(self, data, context): + if data: + context['iis_name'] = data.get('iis_name', '') + context['iis_count'] = data.get('iis_count', 1) + context['iis_domain'] = data.get('iis_domain', '') + return context + class CreateWinService(workflows.Workflow): slug = "create" @@ -152,7 +171,7 @@ class CreateWinService(workflows.Workflow): ConfigureWinIIS) def format_status_message(self, message): - name = self.context.get('name', 'noname') + name = self.context.get('dc_name', 'noname') return message % name def handle(self, request, context):