{# HTMX template for device validation details modal #}
{# Redesigned to match the sync page's clean table layout #}
{# Compute existing device URL once for use throughout #}
{% if validation.existing_device %}
{% if existing_device_model_name == "virtualmachine" %}
{% url 'virtualization:virtualmachine' pk=validation.existing_device.pk as existing_device_url %}
{% else %}
{% url 'dcim:device' pk=validation.existing_device.pk as existing_device_url %}
{% endif %}
{% endif %}
{# Row: LibreNMS Status (left) + Device Info table (right) #}
{# Left: LibreNMS Status card #}
| Status |
{% if libre_device.status == 1 or libre_device.status == "1" %}
Up
{% elif libre_device.status == 0 or libre_device.status == "0" %}
Down
{% else %}
Unknown
{% endif %}
|
| Hostname |
{{ libre_device.hostname }} |
| ID |
{{ libre_device.device_id }} |
| IP |
{{ libre_device.ip|default:"—" }} |
| Location |
{{ libre_device.location|default:"—" }} |
{# Right: Device Information table #}
| Field |
NetBox Value |
LibreNMS Value |
{# Name row #}
| Name |
{% if validation.existing_device %}
{{ validation.existing_device.name }}
{% if validation.name_sync_available %}
{% endif %}
{% else %}
New device
{% endif %}
|
{{ validation.resolved_name|default:libre_device.sysName|default:libre_device.hostname }} |
{# Show only for non-VM contexts: true when no existing device (new import, not VM) OR when existing device is not a VM. #}
{% if not validation.existing_device and not validation.import_as_vm or validation.existing_device and existing_device_model_name != "virtualmachine" %}
| Site |
{% if validation.existing_device and validation.existing_device.site %}
{{ validation.existing_device.site }}
{% if validation.site.site and validation.existing_device.site.pk == validation.site.site.pk %}
{% endif %}
{% elif validation.site.site %}
{{ validation.site.site.name }}
{% else %}
No matching site
{% endif %}
|
{{ libre_device.location|default:"—" }} |
{# Device Type row #}
| Device Type |
{% if validation.device_type_mismatch %}
{{ validation.existing_device.device_type }}
{% elif validation.existing_device and validation.existing_device.device_type %}
{{ validation.existing_device.device_type }}
{% if sync_info and not sync_info.device_type_synced and sync_info.librenms_device_type %}
{% elif validation.device_type.device_type %}
{% endif %}
{% elif validation.device_type.device_type %}
{{ validation.device_type.device_type }}
{% else %}
No matching type
{% endif %}
|
{{ libre_device.hardware|default:"—" }} |
{% endif %}
{# Serial row (only for devices) #}
{# Show only for non-VM contexts: true when no existing device (new import, not VM) OR when existing device is not a VM. #}
{% if not validation.existing_device and not validation.import_as_vm or validation.existing_device and existing_device_model_name != "virtualmachine" %}
| Serial |
{% if validation.existing_device %}
{% if validation.existing_device.serial %}
{{ validation.existing_device.serial }}
{% else %}
Not set
{% endif %}
{% if sync_info and not sync_info.serial_synced %}
{% if validation.serial_action == 'conflict' %}
{% else %}
{% endif %}
{% elif sync_info and sync_info.serial_synced and sync_info.librenms_serial != '-' %}
{% endif %}
{% else %}
—
{% endif %}
|
{{ libre_device.serial|default:"—" }}
{% if validation.serial_duplicate %}
Conflict
{% endif %}
|
{% endif %}
{# Role row #}
|
{% if validation.import_as_vm %}Role{% else %}Device Role{% endif %}
|
{% if validation.existing_device and validation.existing_device.role %}
{{ validation.existing_device.role }}
{% elif validation.device_role.role %}
{{ validation.device_role.role.name }}
{% else %}
No role assigned
{% endif %}
|
— |
{# Platform row #}
| Platform |
{% if validation.existing_device and validation.existing_device.platform %}
{{ validation.existing_device.platform }}
{% if sync_info and not sync_info.platform_synced %}
{% if sync_info.platform_info.platform_exists %}
{% else %}
{% endif %}
{% elif sync_info and sync_info.platform_synced %}
{% endif %}
{% elif validation.platform.platform %}
{{ validation.platform.platform.name }}
{% elif sync_info and sync_info.platform_info.platform_exists %}
Not set
{% if validation.existing_device %}
{% endif %}
{% else %}
Optional
{% endif %}
|
{{ libre_device.os|default:"—" }} |
{% if validation.import_as_vm and not validation.existing_device or validation.existing_device and existing_device_model_name == "virtualmachine" %}
{# Cluster row (VMs only) #}
| Cluster |
{% if validation.cluster.cluster %}
{{ validation.cluster.cluster.name }}
{% else %}
No cluster assigned
{% endif %}
|
— |
{% else %}
{# Rack row #}
| Rack |
{% if validation.rack.rack %}
{% if validation.rack.rack.location %}
{{ validation.rack.rack.location.name }} — {{ validation.rack.rack.name }}
{% else %}
{{ validation.rack.rack.name }}
{% endif %}
{% else %}
Optional
{% endif %}
|
— |
{% endif %}
{# Primary IP row #}
| Primary IP |
{% if validation.existing_device and validation.existing_device.primary_ip %}
{{ validation.existing_device.primary_ip }}
{% elif libre_device.ip %}
{{ libre_device.ip }}
{% else %}
No primary IP
{% endif %}
|
{{ libre_device.ip|default:"—" }} |
{# Status & Actions #}
{% if validation.existing_device %}
{% if validation.existing_match_type == 'librenms_id' %}
{% if existing_id_servers %}
{% for srv in existing_id_servers %}
Linked — ID {{ srv.device_id }} @ {{ srv.display_name }}
{% endfor %}
{% else %}
Linked — ID {{ libre_device.device_id }}
{% endif %}
{% if validation.name_matches %}
Name match
{% elif validation.name_sync_available %}
Name differs
{% endif %}
{% if validation.serial_confirmed %}
Serial confirmed
{% elif validation.serial_action == 'conflict' %}
Serial conflict
{% elif validation.serial_action == 'update_serial' %}
Serial differs
{% endif %}
{% if validation.device_type_mismatch %}
Type mismatch
{% endif %}
{% if validation.librenms_id_needs_migration %}
Legacy ID format
{% endif %}
{% if validation.librenms_id_needs_migration %}
{% endif %}
{% elif validation.existing_match_type == 'hostname' %}
Hostname match
{% if validation.serial_confirmed %}
Serial confirmed
{% elif validation.serial_action == 'conflict' %}
Serial conflict
{% elif validation.serial_action == 'update_serial' %}
Serial differs
{% endif %}
{% if validation.device_type_mismatch %}
Type mismatch
{% endif %}
— Exists as
{{ validation.existing_device.name }},
not linked to LibreNMS.
{% if validation.serial_action == 'conflict' %}
Import blocked: The incoming serial number is already assigned to another device in NetBox.
Resolve the duplicate serial before linking.
{% elif validation.import_as_vm or existing_device_model_name == "virtualmachine" %}
Hostname match found for a VM — use the import action to proceed.
{% else %}
{% endif %}
{% elif validation.existing_match_type == 'serial' %}
Serial match
{% if validation.serial_action == 'hostname_differs' %}
Name differs
{% elif validation.serial_action == 'link' %}
Name match
{% endif %}
{% if validation.device_type_mismatch %}
Type mismatch
{% endif %}
— Exists as
{{ validation.existing_device.name }},
not linked to LibreNMS.
{% elif validation.existing_match_type == 'primary_ip' %}
{% else %}
{% endif %}
{% elif validation.is_ready %}
Ready to Import — All prerequisites are met.
{% elif validation.can_import %}
Can Import — Review warnings below before importing.
{% else %}
Cannot Import — Validation issues prevent import.
{% endif %}
{# Warnings #}
{% if validation.warnings %}
{% for warning in validation.warnings %}
- {{ warning }}
{% endfor %}
{% endif %}