Fixed small issues with WebUI.
This commit is contained in:
parent
c5a66bbac5
commit
68ee90d1a4
@ -20,19 +20,30 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django import forms
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
|
|
||||||
from horizon import exceptions
|
|
||||||
from horizon import forms
|
from horizon import forms
|
||||||
|
from horizon import exceptions
|
||||||
from horizon import messages
|
from horizon import messages
|
||||||
|
|
||||||
|
import pdb
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class WizardForm1(forms.Form):
|
||||||
|
_type = forms.ChoiceField(label=_("Service Type"))
|
||||||
|
|
||||||
|
|
||||||
|
class WizardForm2(forms.Form):
|
||||||
|
subject = forms.CharField(max_length=100)
|
||||||
|
sender = forms.CharField(max_length=1)
|
||||||
|
|
||||||
|
|
||||||
class UpdateWinDC(forms.SelfHandlingForm):
|
class UpdateWinDC(forms.SelfHandlingForm):
|
||||||
tenant_id = forms.CharField(widget=forms.HiddenInput)
|
tenant_id = forms.CharField(widget=forms.HiddenInput)
|
||||||
data_center = forms.CharField(widget=forms.HiddenInput)
|
data_center = forms.CharField(widget=forms.HiddenInput)
|
||||||
|
@ -116,6 +116,16 @@ class EditService(tables.LinkAction):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class Wizard(tables.LinkAction):
|
||||||
|
name = "wizard"
|
||||||
|
verbose_name = _("Wizard")
|
||||||
|
url = "horizon:project:windc:update"
|
||||||
|
classes = ("ajax-modal", "btn-edit")
|
||||||
|
|
||||||
|
def allowed(self, request, instance):
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class ShowDataCenterServices(tables.LinkAction):
|
class ShowDataCenterServices(tables.LinkAction):
|
||||||
name = "edit"
|
name = "edit"
|
||||||
verbose_name = _("Services")
|
verbose_name = _("Services")
|
||||||
@ -144,18 +154,36 @@ class WinDCTable(tables.DataTable):
|
|||||||
name = "windc"
|
name = "windc"
|
||||||
verbose_name = _("Windows Data Centers")
|
verbose_name = _("Windows Data Centers")
|
||||||
row_class = UpdateRow
|
row_class = UpdateRow
|
||||||
table_actions = (CreateDataCenter,)
|
table_actions = (CreateDataCenter, Wizard)
|
||||||
row_actions = (ShowDataCenterServices,DeleteDataCenter)
|
row_actions = (ShowDataCenterServices,DeleteDataCenter)
|
||||||
|
|
||||||
|
|
||||||
|
STATUS_DISPLAY_CHOICES = (
|
||||||
|
("create", "Deploy"),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class WinServicesTable(tables.DataTable):
|
class WinServicesTable(tables.DataTable):
|
||||||
name = tables.Column('dc_name', verbose_name=_('Name'))
|
|
||||||
|
STATUS_CHOICES = (
|
||||||
|
(None, True),
|
||||||
|
("deployed", True),
|
||||||
|
("active", True),
|
||||||
|
("error", False),
|
||||||
|
)
|
||||||
|
|
||||||
|
name = tables.Column('dc_name', verbose_name=_('Name'),
|
||||||
|
link=("horizon:project:windc:service_details"),)
|
||||||
_type = tables.Column('type', verbose_name=_('Type'))
|
_type = tables.Column('type', verbose_name=_('Type'))
|
||||||
status = tables.Column('status', verbose_name=_('Status'))
|
status = tables.Column('status', verbose_name=_('Status'),
|
||||||
|
status=True,
|
||||||
|
status_choices=STATUS_CHOICES,
|
||||||
|
display_choices=STATUS_DISPLAY_CHOICES)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
name = "services"
|
name = "services"
|
||||||
verbose_name = _("Services")
|
verbose_name = _("Services")
|
||||||
row_class = UpdateRow
|
row_class = UpdateRow
|
||||||
|
status_columns = ['status']
|
||||||
table_actions = (CreateService,)
|
table_actions = (CreateService,)
|
||||||
row_actions = (EditService, DeleteService)
|
row_actions = (EditService, DeleteService)
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<p>{% blocktrans %}You can deploy few domain controllers with one name.{% endblocktrans %}</p>
|
<p>{% blocktrans %}You can deploy few Active Directory services with one domain name.{% endblocktrans %}</p>
|
||||||
|
<p>{% blocktrans %}The DNS service will automatically created for each Active Directory.{% endblocktrans %}</p>
|
28
dashboard/windc/templates/windc/_services_tabs.html
Normal file
28
dashboard/windc/templates/windc/_services_tabs.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{% extends "horizon/common/_modal_form.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% block modal-header %}{% trans "Create Service" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block modal-body %}
|
||||||
|
<p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</p>
|
||||||
|
<form action="" method="post">{% csrf_token %}
|
||||||
|
<table>
|
||||||
|
{{ wizard.management_form }}
|
||||||
|
{% if wizard.form.forms %}
|
||||||
|
{{ wizard.form.management_form }}
|
||||||
|
{% for form in wizard.form.forms %}
|
||||||
|
{{ form }}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{{ wizard.form }}
|
||||||
|
{% endif %}
|
||||||
|
{{ wizard.form.forms }}
|
||||||
|
</table>
|
||||||
|
{% if wizard.steps.prev %}
|
||||||
|
<button name="wizard_goto_step" class="btn btn-small" type="submit" value="{{ wizard.steps.prev }}">{% trans "Back" %}</button>
|
||||||
|
<input type="submit" class="btn btn-primary pull-right" value="{% trans 'Deploy' %}"/>
|
||||||
|
{% else %}
|
||||||
|
<button name="wizard_goto_step" class="btn btn-small" type="submit" value="{{ wizard.steps.next }}">{% trans "Next" %}</button>
|
||||||
|
<input type="submit" class="btn btn-primary pull-right" value="{% trans 'Deploy' %}"/>
|
||||||
|
{% endif %}
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
@ -21,7 +21,8 @@
|
|||||||
from django.conf.urls.defaults import patterns, url
|
from django.conf.urls.defaults import patterns, url
|
||||||
|
|
||||||
from .views import IndexView, CreateWinDCView, WinServices, CreateWinServiceView
|
from .views import IndexView, CreateWinDCView, WinServices, CreateWinServiceView
|
||||||
|
from .views import Wizard
|
||||||
|
from .forms import WizardForm1, WizardForm2
|
||||||
|
|
||||||
VIEW_MOD = 'openstack_dashboard.dashboards.project.windc.views'
|
VIEW_MOD = 'openstack_dashboard.dashboards.project.windc.views'
|
||||||
|
|
||||||
@ -29,6 +30,10 @@ urlpatterns = patterns(VIEW_MOD,
|
|||||||
url(r'^$', IndexView.as_view(), name='index'),
|
url(r'^$', IndexView.as_view(), name='index'),
|
||||||
url(r'^create$', CreateWinServiceView.as_view(), name='create'),
|
url(r'^create$', CreateWinServiceView.as_view(), name='create'),
|
||||||
url(r'^create_dc$', CreateWinDCView.as_view(), name='create_dc'),
|
url(r'^create_dc$', CreateWinDCView.as_view(), name='create_dc'),
|
||||||
url(r'^(?P<domain_controller_id>[^/]+)/$', WinServices.as_view(),
|
url(r'^(?P<data_center_id>[^/]+)/$', WinServices.as_view(),
|
||||||
name='services')
|
name='services'),
|
||||||
|
url(r'^update$', Wizard.as_view([WizardForm2, WizardForm2]),
|
||||||
|
name='update'),
|
||||||
|
url(r'^(?P<service_id>[^/]+)/$', WinServices.as_view(),
|
||||||
|
name='service_details')
|
||||||
)
|
)
|
||||||
|
@ -24,24 +24,42 @@ import logging
|
|||||||
|
|
||||||
from django import http
|
from django import http
|
||||||
from django import shortcuts
|
from django import shortcuts
|
||||||
|
from django.views import generic
|
||||||
from django.core.urlresolvers import reverse, reverse_lazy
|
from django.core.urlresolvers import reverse, reverse_lazy
|
||||||
from django.utils.datastructures import SortedDict
|
from django.utils.datastructures import SortedDict
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django.contrib.formtools.wizard.views import SessionWizardView
|
||||||
|
|
||||||
from horizon import exceptions
|
from horizon import exceptions
|
||||||
from horizon import forms
|
from horizon import forms
|
||||||
from horizon import tabs
|
from horizon import tabs
|
||||||
from horizon import tables
|
from horizon import tables
|
||||||
from horizon import workflows
|
from horizon import workflows
|
||||||
|
from horizon.forms.views import ModalFormMixin
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
from .tables import WinDCTable, WinServicesTable
|
from .tables import WinDCTable, WinServicesTable
|
||||||
from .workflows import CreateWinService, CreateWinDC
|
from .workflows import CreateWinService, CreateWinDC
|
||||||
|
from .forms import WizardForm1, WizardForm2
|
||||||
|
|
||||||
|
import pdb
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class Wizard(ModalFormMixin, SessionWizardView, generic.FormView):
|
||||||
|
template_name = 'project/windc/services_tabs.html'
|
||||||
|
|
||||||
|
def done(self, form_list, **kwargs):
|
||||||
|
#do_something_with_the_form_data(form_list)
|
||||||
|
return HttpResponseRedirect('/')
|
||||||
|
|
||||||
|
def get_form(self, step=None, data=None, files=None):
|
||||||
|
form = super(Wizard, self).get_form(step, data, files)
|
||||||
|
print step
|
||||||
|
print data
|
||||||
|
print files
|
||||||
|
return form
|
||||||
|
|
||||||
class IndexView(tables.DataTableView):
|
class IndexView(tables.DataTableView):
|
||||||
table_class = WinDCTable
|
table_class = WinDCTable
|
||||||
template_name = 'project/windc/index.html'
|
template_name = 'project/windc/index.html'
|
||||||
@ -69,7 +87,7 @@ class WinServices(tables.DataTableView):
|
|||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
try:
|
try:
|
||||||
dc_id = self.kwargs['domain_controller_id']
|
dc_id = self.kwargs['data_center_id']
|
||||||
datacenter = api.windc.datacenters_get(self.request, dc_id)
|
datacenter = api.windc.datacenters_get(self.request, dc_id)
|
||||||
self.dc_name = datacenter.name
|
self.dc_name = datacenter.name
|
||||||
services = api.windc.services_list(self.request, datacenter)
|
services = api.windc.services_list(self.request, datacenter)
|
||||||
|
@ -88,7 +88,7 @@ class ConfigureWinDCAction(workflows.Action):
|
|||||||
# required=False,
|
# required=False,
|
||||||
# help_text=_("A NetBIOS name of new domain."))
|
# help_text=_("A NetBIOS name of new domain."))
|
||||||
|
|
||||||
dc_count = forms.IntegerField(label=_("Domain Controllers Count"),
|
dc_count = forms.IntegerField(label=_("Instances Count"),
|
||||||
required=True,
|
required=True,
|
||||||
min_value=1,
|
min_value=1,
|
||||||
max_value=100,
|
max_value=100,
|
||||||
@ -108,7 +108,7 @@ class ConfigureWinDCAction(workflows.Action):
|
|||||||
"Recovery Mode."))
|
"Recovery Mode."))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
name = _("Domain Controllers")
|
name = _("Active Directory")
|
||||||
help_text_template = ("project/windc/_dc_help.html")
|
help_text_template = ("project/windc/_dc_help.html")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user