mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-17 14:39:56 +02:00
Closes #20981: Enhance JSON rendering for Custom Validators and Protection Rules in Config Revision View (#21376)
* feat(config): Add extra context to ConfigRevisionView Introduces `get_extra_context` method for `ConfigRevisionView` to format JSON-based attributes like `CUSTOM_VALIDATORS`, `DEFAULT_USER_PREFERENCES`, and `PROTECTION_RULES`. This ensures clearer rendering of configuration data in the UI. Fixes #20981 * Reduce padding on JSON blocks --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
<div class="col col-md-12">
|
||||
<div class="card">
|
||||
<h2 class="card-header">{% trans "Configuration Data" %}</h2>
|
||||
{% include 'core/inc/config_data.html' with config=object.data %}
|
||||
{% include 'core/inc/config_data.html' %}
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<tr>
|
||||
<th scope="row" class="ps-3">{% trans "Custom validators" %}</th>
|
||||
{% if config.CUSTOM_VALIDATORS %}
|
||||
<td><pre>{{ config.CUSTOM_VALIDATORS }}</pre></td>
|
||||
<td><pre class="p-0">{{ config.CUSTOM_VALIDATORS }}</pre></td>
|
||||
{% else %}
|
||||
<td>{{ ''|placeholder }}</td>
|
||||
{% endif %}
|
||||
@@ -103,7 +103,7 @@
|
||||
<tr>
|
||||
<th scope="row" class="border-0 ps-3">{% trans "Protection rules" %}</th>
|
||||
{% if config.PROTECTION_RULES %}
|
||||
<td class="border-0"><pre>{{ config.PROTECTION_RULES }}</pre></td>
|
||||
<td class="border-0"><pre class="p-0">{{ config.PROTECTION_RULES }}</pre></td>
|
||||
{% else %}
|
||||
<td class="border-0">{{ ''|placeholder }}</td>
|
||||
{% endif %}
|
||||
@@ -116,7 +116,7 @@
|
||||
<tr>
|
||||
<th scope="row" class="border-0 ps-3">{% trans "Default preferences" %}</th>
|
||||
{% if config.DEFAULT_USER_PREFERENCES %}
|
||||
<td class="border-0"><pre>{{ config.DEFAULT_USER_PREFERENCES|json }}</pre></td>
|
||||
<td class="border-0"><pre class="p-0">{{ config.DEFAULT_USER_PREFERENCES }}</pre></td>
|
||||
{% else %}
|
||||
<td class="border-0">{{ ''|placeholder }}</td>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user