Added Jinja filter for handle formatting of zone type labels to enforce modern social standards.

Removed text label of dashboard domain list action menu to reduce size.

Continuing work on re-design and clean-up of dashboard view.
This commit is contained in:
Matt Scott 2023-02-19 09:48:43 -05:00
parent d70ded18c2
commit 4f83879e95
4 changed files with 19 additions and 5 deletions

View File

@ -77,6 +77,7 @@ def create_app(config=None):
app.jinja_env.filters['display_setting_state'] = utils.display_setting_state
app.jinja_env.filters['pretty_domain_name'] = utils.pretty_domain_name
app.jinja_env.filters['format_datetime_local'] = utils.format_datetime
app.jinja_env.filters['format_zone_type'] = utils.format_zone_type
# Register context proccessors
from .models.setting import Setting

View File

@ -132,6 +132,16 @@ def display_master_name(data):
return ", ".join(matches)
def format_zone_type(data):
"""Formats the given zone type for modern social standards."""
data = str(data).lower()
if data == 'master':
data = 'primary'
elif data == 'slave':
data = 'secondary'
return data.title()
def display_time(amount, units='s', remove_seconds=True):
"""
Convert timestamp to normal time format

View File

@ -199,7 +199,7 @@
<!-- /.card-header -->
<div class="card-body table-responsive p-0 pt-2">
<table id='tbl_domain_list_{{ boxId }}'
class="table table-striped table-hover">
class="table table-striped table-hover records table-sm">
<thead>
<tr>
<th>Name</th>
@ -236,6 +236,9 @@
{% block head_styles %}
<style type="text/css">
table.records thead th, table.records tbody td { text-align: center; vertical-align: middle; }
table.records tbody td:first-of-type { text-align: left; }
table.records thead th:last-of-type { width: 50px; }
div.table-responsive > div.dataTables_wrapper > div.row:first-of-type { margin: 0 0.5em 0 0.5em; }
div.table-responsive > div.dataTables_wrapper > div.row:last-of-type { margin: 0.4em 0.5em 0.4em 0.5em; }
div.table-responsive > div.dataTables_wrapper table.dataTable { margin: 0!important; }

View File

@ -11,7 +11,7 @@
{% endmacro %}
{% macro type(domain) %}
{{ domain.type }}
{{ domain.type | format_zone_type }}
{% endmacro %}
{% macro serial(domain) %}
@ -19,12 +19,12 @@
{% endmacro %}
{% macro master(domain) %}
{% if domain.master == '[]'%}-{% else %}{{ domain.master | display_master_name }}{% endif %}
{% if domain.master == '[]'%}N/A{% else %}{{ domain.master | display_master_name }}{% endif %}
{% endmacro %}
{% macro account(domain) %}
{% if current_user.role.name in ['Administrator', 'Operator'] %}
{{ domain.account.name if domain.account else '-' }}
{{ domain.account.name if domain.account else 'None' }}
{% endif %}
{% endmacro %}
@ -32,7 +32,7 @@
<td width="6%">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa-solid fa-bars"></i>&nbsp;Actions
<i class="fa-solid fa-bars"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu">
{% if current_user.role.name in ['Administrator', 'Operator'] %}