Merge "Add domain record detail screen"
This commit is contained in:
commit
981691527f
@ -180,11 +180,11 @@ class DomainsTable(tables.DataTable):
|
||||
row_actions = (ManageRecords, EditDomain, DeleteDomain,)
|
||||
|
||||
|
||||
def update_record_link(record):
|
||||
def record__details_link(record):
|
||||
'''Returns a link to the view for updating DNS records.'''
|
||||
|
||||
return urlresolvers.reverse(
|
||||
"horizon:project:dns_domains:update_record",
|
||||
"horizon:project:dns_domains:view_record",
|
||||
args=(record.domain_id, record.id))
|
||||
|
||||
|
||||
@ -194,8 +194,7 @@ class RecordsTable(tables.DataTable):
|
||||
|
||||
name = tables.Column("name",
|
||||
verbose_name=_("Name"),
|
||||
link=update_record_link,
|
||||
link_classes=('ajax-modal',)
|
||||
link=record__details_link,
|
||||
)
|
||||
|
||||
type = tables.Column("type",
|
||||
|
@ -0,0 +1,36 @@
|
||||
{% load i18n sizeformat %}
|
||||
|
||||
<h3><a href="{% url 'horizon:project:dns_domains:records' domain_id %}">{% trans "All Records" %}</a></h3>
|
||||
|
||||
<h4>{{ record.name|default:_("None") }}</h4>
|
||||
|
||||
<div class="info detail">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>{% trans "Name" %}</dt>
|
||||
<dd>{{ record.name|default:_("None") }}</dd>
|
||||
<dt>{% trans "ID" %}</dt>
|
||||
<dd>{{ record.id|default:_("None") }}</dd>
|
||||
<dt>{% trans "Type" %}</dt>
|
||||
<dd>{{ record.type|default:_("Unknown") }}</dd>
|
||||
<dt>{% trans "Description" %}</dt>
|
||||
<dd>{{ record.description|default:_("None") }}</dd>
|
||||
<dt>{% trans "Record Data" %}</dt>
|
||||
<dd>{{ record.data|default:_("None") }}</dd>
|
||||
<dt>{% trans "Priority" %}</dt>
|
||||
<dd>{{ record.priority|yesno|capfirst }}</dd>
|
||||
<dt>{% trans "TTL" %}</dt>
|
||||
<dd>{{ record.ttl|default:_("None") }}</dd>
|
||||
<dt>{% trans "Created" %}</dt>
|
||||
{% if record.created_at %}
|
||||
<dd>{{ record.created_at|parse_isotime }}</dd>
|
||||
{% else %}
|
||||
<dd>{% trans "Unknown" %}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Updated" %}</dt>
|
||||
{% if record.updated_at %}
|
||||
<dd>{{ record.updated_at|parse_isotime }}</dd>
|
||||
{% else %}
|
||||
<dd>{% trans "Unknown" %}</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
@ -0,0 +1,11 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans 'Record Detail' %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title="Record Detail" %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/dns_domains/_record_detail.html' %}
|
||||
{% endblock %}
|
@ -20,6 +20,7 @@ from .views import IndexView # noqa
|
||||
from .views import RecordsView # noqa
|
||||
from .views import UpdateDomainView # noqa
|
||||
from .views import UpdateRecordView # noqa
|
||||
from .views import ViewRecordDetailsView # noqa
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
@ -42,7 +43,10 @@ urlpatterns = patterns(
|
||||
url(r'^(?P<domain_id>[^/]+)/records/create$',
|
||||
CreateRecordView.as_view(),
|
||||
name='create_record'),
|
||||
url(r'^(?P<domain_id>[^/]+)/records/(?P<record_id>[^/]+)/$',
|
||||
url(r'^(?P<domain_id>[^/]+)/records/(?P<record_id>[^/]+)/update$',
|
||||
UpdateRecordView.as_view(),
|
||||
name='update_record'),
|
||||
url(r'^(?P<domain_id>[^/]+)/records/(?P<record_id>[^/]+)/$',
|
||||
ViewRecordDetailsView.as_view(),
|
||||
name='view_record'),
|
||||
)
|
||||
|
@ -161,6 +161,29 @@ class CreateRecordView(BaseRecordFormView):
|
||||
template_name = 'project/dns_domains/create_record.html'
|
||||
|
||||
|
||||
class ViewRecordDetailsView(HorizonTemplateView):
|
||||
template_name = 'project/dns_domains/record_detail.html'
|
||||
|
||||
def get_record(self):
|
||||
domain_id = self.kwargs['domain_id']
|
||||
record_id = self.kwargs['record_id']
|
||||
try:
|
||||
return api.designate.record_get(self.request, domain_id, record_id)
|
||||
except Exception:
|
||||
redirect = reverse('horizon:project:dns_domains:records',
|
||||
args=(self.kwargs['domain_id'],))
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve domain record.'),
|
||||
redirect=redirect)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ViewRecordDetailsView, self).get_context_data(**kwargs)
|
||||
self.record = self.get_record()
|
||||
context["record"] = self.record
|
||||
context["domain_id"] = self.kwargs['domain_id']
|
||||
return context
|
||||
|
||||
|
||||
class UpdateRecordView(BaseRecordFormView):
|
||||
form_class = RecordUpdate
|
||||
template_name = 'project/dns_domains/update_record.html'
|
||||
|
Loading…
Reference in New Issue
Block a user