mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
# Conflicts: # netbox/dcim/tables/template_code.py # netbox/netbox/views/__init__.py # netbox/project-static/css/base.css # netbox/templates/base.html # netbox/templates/circuits/circuit.html # netbox/templates/circuits/circuittermination_edit.html # netbox/templates/circuits/inc/circuit_termination.html # netbox/templates/circuits/provider.html # netbox/templates/dcim/device.html # netbox/templates/dcim/device/base.html # netbox/templates/dcim/device_component.html # netbox/templates/dcim/devicetype.html # netbox/templates/dcim/inc/device_napalm_tabs.html # netbox/templates/dcim/rack.html # netbox/templates/dcim/site.html # netbox/templates/dcim/virtualchassis.html # netbox/templates/extras/configcontext.html # netbox/templates/extras/object_journal.html # netbox/templates/extras/tag.html # netbox/templates/generic/object.html # netbox/templates/generic/object_list.html # netbox/templates/home.html # netbox/templates/inc/nav_menu.html # netbox/templates/ipam/aggregate.html # netbox/templates/ipam/ipaddress.html # netbox/templates/ipam/prefix.html # netbox/templates/ipam/vlan.html # netbox/templates/ipam/vlangroup_edit.html # netbox/templates/ipam/vlangroup_vlans.html # netbox/templates/secrets/secret.html # netbox/templates/tenancy/tenant.html # netbox/templates/users/api_tokens.html # netbox/templates/virtualization/cluster.html # netbox/templates/virtualization/vminterface_edit.html # netbox/utilities/forms/fields.py # netbox/utilities/templates/buttons/export.html
106 lines
4.4 KiB
HTML
106 lines
4.4 KiB
HTML
{% extends 'generic/object_edit.html' %}
|
|
{% load form_helpers %}
|
|
{% load helpers %}
|
|
|
|
{% block form %}
|
|
<div class="field-group">
|
|
<h4>VLAN Group</h4>
|
|
{% render_field form.name %}
|
|
{% render_field form.slug %}
|
|
{% render_field form.description %}
|
|
</div>
|
|
<div class="field-group">
|
|
<h4>Scope</h4>
|
|
{% render_field form.scope_type %}
|
|
{% render_field form.region %}
|
|
{% render_field form.sitegroup %}
|
|
{% render_field form.site %}
|
|
{% render_field form.location %}
|
|
{% render_field form.rack %}
|
|
{% render_field form.clustergroup %}
|
|
{% render_field form.cluster %}
|
|
</div>
|
|
{% if form.custom_fields %}
|
|
<div class="field-group">
|
|
<h4>Custom Fields</h4>
|
|
{% render_custom_fields form %}
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block javascript %}
|
|
<script type="text/javascript">
|
|
// TODO: Employ form field attrs to clean up this mess
|
|
let scope_type = $('#id_scope_type');
|
|
scope_type.change(function() {
|
|
let label = this.options[this.selectedIndex].text;
|
|
if (label.endsWith('region')) {
|
|
$('#id_region').parents('.form-group').show();
|
|
$('#id_sitegroup').parents('.form-group').hide();
|
|
$('#id_site').parents('.form-group').hide();
|
|
$('#id_location').parents('.form-group').hide();
|
|
$('#id_rack').parents('.form-group').hide();
|
|
$('#id_clustergroup').parents('.form-group').hide();
|
|
$('#id_cluster').parents('.form-group').hide();
|
|
} else if (label.endsWith('site group')) {
|
|
$('#id_region').parents('.form-group').hide();
|
|
$('#id_sitegroup').parents('.form-group').show();
|
|
$('#id_site').parents('.form-group').hide();
|
|
$('#id_location').parents('.form-group').hide();
|
|
$('#id_rack').parents('.form-group').hide();
|
|
$('#id_clustergroup').parents('.form-group').hide();
|
|
$('#id_cluster').parents('.form-group').hide();
|
|
} else if (label.endsWith('site')) {
|
|
$('#id_region').parents('.form-group').show();
|
|
$('#id_sitegroup').parents('.form-group').show();
|
|
$('#id_site').parents('.form-group').show();
|
|
$('#id_location').parents('.form-group').hide();
|
|
$('#id_rack').parents('.form-group').hide();
|
|
$('#id_clustergroup').parents('.form-group').hide();
|
|
$('#id_cluster').parents('.form-group').hide();
|
|
} else if (label.endsWith('location')) {
|
|
$('#id_region').parents('.form-group').show();
|
|
$('#id_sitegroup').parents('.form-group').show();
|
|
$('#id_site').parents('.form-group').show();
|
|
$('#id_location').parents('.form-group').show();
|
|
$('#id_rack').parents('.form-group').hide();
|
|
$('#id_clustergroup').parents('.form-group').hide();
|
|
$('#id_cluster').parents('.form-group').hide();
|
|
} else if (label.endsWith('rack')) {
|
|
$('#id_region').parents('.form-group').show();
|
|
$('#id_sitegroup').parents('.form-group').show();
|
|
$('#id_site').parents('.form-group').show();
|
|
$('#id_location').parents('.form-group').show();
|
|
$('#id_rack').parents('.form-group').show();
|
|
$('#id_clustergroup').parents('.form-group').hide();
|
|
$('#id_cluster').parents('.form-group').hide();
|
|
} else if (label.endsWith('cluster group')) {
|
|
$('#id_region').parents('.form-group').hide();
|
|
$('#id_sitegroup').parents('.form-group').hide();
|
|
$('#id_site').parents('.form-group').hide();
|
|
$('#id_location').parents('.form-group').hide();
|
|
$('#id_rack').parents('.form-group').hide();
|
|
$('#id_clustergroup').parents('.form-group').show();
|
|
$('#id_cluster').parents('.form-group').hide();
|
|
} else if (label.endsWith('cluster')) {
|
|
$('#id_region').parents('.form-group').hide();
|
|
$('#id_sitegroup').parents('.form-group').hide();
|
|
$('#id_site').parents('.form-group').hide();
|
|
$('#id_location').parents('.form-group').hide();
|
|
$('#id_rack').parents('.form-group').hide();
|
|
$('#id_clustergroup').parents('.form-group').show();
|
|
$('#id_cluster').parents('.form-group').show();
|
|
} else {
|
|
$('#id_region').parents('.form-group').hide();
|
|
$('#id_sitegroup').parents('.form-group').hide();
|
|
$('#id_site').parents('.form-group').hide();
|
|
$('#id_location').parents('.form-group').hide();
|
|
$('#id_rack').parents('.form-group').hide();
|
|
$('#id_clustergroup').parents('.form-group').hide();
|
|
$('#id_cluster').parents('.form-group').hide();
|
|
}
|
|
});
|
|
scope_type.change();
|
|
</script>
|
|
{% endblock %}
|