feat: add tenant groups and required tenancy
This commit is contained in:
@@ -10,13 +10,18 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col col-md-9 col-xl-7">
|
||||
<div class="card">
|
||||
<div class="card-header"><h2 class="card-title">Mandantenfilter</h2></div>
|
||||
<div class="card-header"><h2 class="card-title">Mandanten</h2></div>
|
||||
<div class="card-body">
|
||||
{% if config_forces_disabled %}
|
||||
{% if tenant_filter_locked %}
|
||||
<div class="alert alert-warning">
|
||||
Der Mandantenfilter ist in <code>PLUGINS_CONFIG</code> fest deaktiviert und kann hier nicht aktiviert werden.
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if tenant_required_locked %}
|
||||
<div class="alert alert-warning">
|
||||
Die verpflichtende Mandantenzuordnung ist in <code>PLUGINS_CONFIG</code> fest deaktiviert.
|
||||
</div>
|
||||
{% endif %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% if form.non_field_errors %}<div class="alert alert-danger">{{ form.non_field_errors }}</div>{% endif %}
|
||||
@@ -27,9 +32,18 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-text mb-3">{{ form.tenant_filter_enabled.help_text }}</div>
|
||||
<button class="btn btn-primary" type="submit"{% if config_forces_disabled %} disabled{% endif %}>
|
||||
Speichern
|
||||
</button>
|
||||
<div class="form-check form-switch mt-4">
|
||||
{{ form.tenant_required }}
|
||||
<label class="form-check-label fw-bold" for="{{ form.tenant_required.id_for_label }}">
|
||||
{{ form.tenant_required.label }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-text mb-3">{{ form.tenant_required.help_text }}</div>
|
||||
<div class="alert alert-info">
|
||||
Die Pflicht gilt nur für Objekttypen, die in NetBox ein Mandantenfeld besitzen.
|
||||
Bestehende Objekte ohne Mandant müssen beim nächsten Speichern ergänzt werden.
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">Speichern</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,13 @@
|
||||
>
|
||||
<i class="mdi mdi-domain" aria-hidden="true"></i>
|
||||
<span class="d-none d-xl-inline ms-1 tenant-filter-label">
|
||||
{% if selected_tenant %}{{ selected_tenant }}{% else %}Alle Mandanten{% endif %}
|
||||
{% if selected_tenant %}
|
||||
{{ selected_tenant }}
|
||||
{% elif selected_tenant_group %}
|
||||
{{ selected_tenant_group }}
|
||||
{% else %}
|
||||
Alle Mandanten
|
||||
{% endif %}
|
||||
</span>
|
||||
<i class="mdi mdi-chevron-down" aria-hidden="true"></i>
|
||||
</button>
|
||||
@@ -18,26 +24,39 @@
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ return_url }}">
|
||||
<label class="form-label fw-bold">
|
||||
Mandant
|
||||
Mandant oder Mandantengruppe
|
||||
</label>
|
||||
<select
|
||||
class="form-select"
|
||||
name="tenant"
|
||||
name="scope"
|
||||
onchange="this.form.submit()"
|
||||
aria-label="Mandant global auswählen"
|
||||
>
|
||||
<option value="">Alle Mandanten</option>
|
||||
{% for tenant in tenants %}
|
||||
<option value="{{ tenant.pk }}"{% if selected_tenant.pk == tenant.pk %} selected{% endif %}>
|
||||
{{ tenant.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
{% if tenant_groups %}
|
||||
<optgroup label="Mandantengruppen">
|
||||
{% for group in tenant_groups %}
|
||||
<option value="group:{{ group.pk }}"{% if selected_tenant_group.pk == group.pk %} selected{% endif %}>
|
||||
{{ group.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
{% if tenants %}
|
||||
<optgroup label="Mandanten">
|
||||
{% for tenant in tenants %}
|
||||
<option value="tenant:{{ tenant.pk }}"{% if selected_tenant.pk == tenant.pk %} selected{% endif %}>
|
||||
{{ tenant.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
</select>
|
||||
<noscript>
|
||||
<button class="btn btn-primary w-100 mt-2" type="submit">Anwenden</button>
|
||||
</noscript>
|
||||
<p class="text-secondary small mb-0 mt-2">
|
||||
Wirkt auf mandantenfähige Listen und die globale Suche.
|
||||
Gruppen schließen alle direkt und untergeordnet zugeordneten Mandanten ein.
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user