add placeholder details in detail of device

This commit is contained in:
Cayo Puigdefabregas 2022-07-15 16:47:39 +02:00
parent 03fbfcb73b
commit 2b5ff4cb2f
2 changed files with 8 additions and 1 deletions

View file

@ -143,6 +143,7 @@ class DeviceDetailView(GenericMixin):
self.context.update( self.context.update(
{ {
'device': device, 'device': device,
'placeholder': device.binding or device.placeholder,
'page_title': 'Device {}'.format(device.devicehub_id), 'page_title': 'Device {}'.format(device.devicehub_id),
} }
) )

View file

@ -23,9 +23,15 @@
<ul class="nav nav-tabs nav-tabs-bordered"> <ul class="nav nav-tabs nav-tabs-bordered">
<li class="nav-item"> <li class="nav-item">
<button class="nav-link active" data-bs-toggle="tab" data-bs-target="#type">Type</button> <a class="nav-link" href="{{ url_for('inventory.device_details', id=placeholder.device.devicehub_id) }}">Placeholder device</a>
</li> </li>
{% if placeholder.binding %}
<li class="nav-item">
<a class="nav-link" href="{{ url_for('inventory.device_details', id=placeholder.binding.devicehub_id) }}">Workbench device</a>
</li>
{% endif %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{{ device.public_link }}" target="_blank">Web</a> <a class="nav-link" href="{{ device.public_link }}" target="_blank">Web</a>
</li> </li>