Skip to content

Commit

Permalink
remove conditional views from golden config overview
Browse files Browse the repository at this point in the history
  • Loading branch information
jtdub committed Dec 13, 2024
1 parent a21f35c commit 47e4b89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
31 changes: 13 additions & 18 deletions nautobot_golden_config/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,24 +262,19 @@ class GoldenConfigTable(BaseTable):
text=lambda record: record.device.name,
verbose_name="Device",
)

if ENABLE_BACKUP:
backup_last_success_date = Column(
verbose_name="Backup Status", empty_values=(), order_by="backup_last_success_date"
)
if ENABLE_INTENDED:
intended_last_success_date = Column(
verbose_name="Intended Status",
empty_values=(),
order_by="intended_last_success_date",
)
if ENABLE_COMPLIANCE:
compliance_last_success_date = Column(
verbose_name="Compliance Status",
empty_values=(),
order_by="compliance_last_success_date",
)

backup_last_success_date = Column(
verbose_name="Backup Status", empty_values=(), order_by="backup_last_success_date"
)
intended_last_success_date = Column(
verbose_name="Intended Status",
empty_values=(),
order_by="intended_last_success_date",
)
compliance_last_success_date = Column(
verbose_name="Compliance Status",
empty_values=(),
order_by="compliance_last_success_date",
)
actions = TemplateColumn(
template_code=ALL_ACTIONS, verbose_name="Actions", extra_context=CONFIG_FEATURES, orderable=False
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,9 @@ <h1>{% block title %}Configuration Overview{% endblock %}</h1>
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Execute <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% if compliance %}
<li><a href="{% url 'extras:job_run_by_class_path' class_path='nautobot_golden_config.jobs.ComplianceJob' %}">Compliance</a></li>
{% endif %}
{% if intended %}
<li><a href="{% url 'extras:job_run_by_class_path' class_path='nautobot_golden_config.jobs.IntendedJob' %}">Intended</a></li>
{% endif %}
{% if backup %}
<li><a href="{% url 'extras:job_run_by_class_path' class_path='nautobot_golden_config.jobs.BackupJob' %}">Backup</a></li>
{% endif %}
{% if not compliance and not intended and not backup %}
<li><a href="#" class="disabled">Features are not enabled.</a></li>
{% endif %}
Expand Down

0 comments on commit 47e4b89

Please sign in to comment.