modify details page and binding/unbinding page

This commit is contained in:
Cayo Puigdefabregas 2022-08-11 14:50:47 +02:00
parent 57ba86eb39
commit 138dc66b9a
5 changed files with 153 additions and 135 deletions

View File

@ -180,65 +180,66 @@ class BindingView(GenericMixin):
def dispatch_request(self, dhid, phid): def dispatch_request(self, dhid, phid):
self.get_context() self.get_context()
device = ( old_device = (
Device.query.filter(Device.owner_id == g.user.id) Device.query.filter(Device.owner_id == g.user.id)
.filter(Device.devicehub_id == dhid) .filter(Device.devicehub_id == dhid)
.one() .first()
) )
placeholder = ( new_placeholder = (
Placeholder.query.filter(Placeholder.owner_id == g.user.id) Placeholder.query.filter(Placeholder.owner_id == g.user.id)
.filter(Placeholder.phid == phid) .filter(Placeholder.phid == phid)
.one() .first()
) )
if device.is_abstract() != 'Abstract': if not old_device or old_device.placeholder.status != 'Abstract':
next_url = url_for('inventory.device_details', id=dhid) next_url = url_for('inventory.device_details', id=dhid)
messages.error('Device "{}" not is a Abstract device!'.format(dhid)) messages.error('Device Dhid: "{}" not is a Abstract device!'.format(dhid))
return flask.redirect(next_url) return flask.redirect(next_url)
if device.placeholder: if not new_placeholder or new_placeholder.status != 'Real':
device = device.placeholder.binding next_url = url_for('inventory.device_details', id=dhid)
dhid = device.devicehub_id messages.error('Device Phid: "{}" not is a Abstract device!'.format(phid))
return flask.redirect(next_url)
old_placeholder = old_device.placeholder
new_device = new_placeholder.device
abstract_device = old_placeholder.binding
new_dhid = new_device.devicehub_id
if request.method == 'POST': if request.method == 'POST':
old_placeholder = device.binding
old_device_placeholder = old_placeholder.device
if old_placeholder.is_abstract: for plog in PlaceholdersLog.query.filter_by(
for plog in PlaceholdersLog.query.filter_by( placeholder_id=old_placeholder.id
placeholder_id=old_placeholder.id ):
): db.session.delete(plog)
db.session.delete(plog)
for ac in old_device_placeholder.actions: for ac in old_device.actions:
ac.devices.add(placeholder.device) ac.devices.add(new_device)
ac.devices.remove(old_device_placeholder) ac.devices.remove(old_device)
for act in ac.actions_device: for act in ac.actions_device:
if act.device == old_device_placeholder: if act.device == old_device:
db.session.delete(act) db.session.delete(act)
for tag in list(old_device_placeholder.tags): for tag in list(old_device.tags):
tag.device = placeholder.device tag.device = new_device
db.session.delete(old_device_placeholder) db.session.delete(old_device)
abstract_device.binding = new_placeholder
device.binding = placeholder
db.session.commit() db.session.commit()
next_url = url_for('inventory.device_details', id=dhid)
next_url = url_for('inventory.device_details', id=new_dhid)
messages.success( messages.success(
'Device "{}" bind successfully with {}!'.format(dhid, phid) 'Device Dhid: "{}" bind successfully with Phid: {}!'.format(dhid, phid)
) )
return flask.redirect(next_url) return flask.redirect(next_url)
self.context.update( self.context.update(
{ {
'device': device.binding.device, 'new_placeholder': new_placeholder,
'placeholder': placeholder, 'old_placeholder': old_placeholder,
'page_title': 'Binding confirm', 'page_title': 'Binding confirm',
'actions': list(device.binding.device.actions) 'actions': list(old_device.actions) + list(new_device.actions),
+ list(placeholder.device.actions), 'tags': list(old_device.tags) + list(new_device.tags),
'tags': list(device.binding.device.tags)
+ list(placeholder.device.tags),
} }
) )
@ -256,31 +257,29 @@ class UnBindingView(GenericMixin):
.filter(Placeholder.phid == phid) .filter(Placeholder.phid == phid)
.one() .one()
) )
if not placeholder.binding: if not placeholder.binding or placeholder.status != 'Twin':
next_url = url_for( next_url = url_for(
'inventory.device_details', id=placeholder.device.devicehub_id 'inventory.device_details', id=placeholder.device.devicehub_id
) )
return flask.redirect(next_url) return flask.redirect(next_url)
device = placeholder.binding if placeholder.status != 'Twin':
dhid = placeholder.device.devicehub_id
if device.is_abstract() != 'Twin':
dhid = device.devicehub_id
next_url = url_for('inventory.device_details', id=dhid) next_url = url_for('inventory.device_details', id=dhid)
messages.error('Device "{}" not is a Twin device!'.format(dhid)) messages.error('Device Dhid: "{}" not is a Twin device!'.format(dhid))
return flask.redirect(next_url) return flask.redirect(next_url)
self.get_context() self.get_context()
if request.method == 'POST': if request.method == 'POST':
new_device = self.clone_device(device) new_device = self.clone_device(placeholder.binding)
next_url = url_for('inventory.device_details', id=new_device.devicehub_id) new_dhid = new_device.devicehub_id
messages.success('Device "{}" unbind successfully!'.format(phid)) next_url = url_for('inventory.device_details', id=new_dhid)
messages.success('Device Phid: "{}" unbind successfully!'.format(phid))
return flask.redirect(next_url) return flask.redirect(next_url)
self.context.update( self.context.update(
{ {
'device': device,
'placeholder': placeholder, 'placeholder': placeholder,
'page_title': 'Unbinding confirm', 'page_title': 'Unbinding confirm',
} }

View File

@ -935,6 +935,14 @@ class Placeholder(Thing):
actions.reverse() actions.reverse()
return actions return actions
@property
def status(self):
if self.is_abstract:
return 'Abstract'
if self.binding:
return 'Twin'
return 'Real'
class Computer(Device): class Computer(Device):
"""A chassis with components inside that can be processed """A chassis with components inside that can be processed

View File

@ -26,109 +26,104 @@
<thead> <thead>
<tr class="text-center"> <tr class="text-center">
<th scope="col">Basic Data</th> <th scope="col">Basic Data</th>
<th scope="col">Info to be Entered</th> <th scope="col">Info Twin device</th>
<th scope="col">Info to be Decoupled</th> <th scope="col">Info Abstract device</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">PHID:</th>
<td class="table-success text-right">{{ placeholder.phid or '' }}</td>
<td class="table-danger">{{ device.placeholder.phid or '' }}</td>
</tr>
<tr> <tr>
<th scope="row">Manufacturer:</th> <th scope="row">Manufacturer:</th>
<td class="table-success text-right">{{ placeholder.device.manufacturer or '' }}</td> <td class="table-success text-right">{{ new_placeholder.device.manufacturer or '' }}</td>
<td class="table-danger">{{ device.manufacturer or '' }}</td> <td class="table-danger">{{ old_placeholder.device.manufacturer or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Model:</th> <th scope="row">Model:</th>
<td class="table-success">{{ placeholder.device.model or '' }}</td> <td class="table-success">{{ new_placeholder.device.model or '' }}</td>
<td class="table-danger">{{ device.model or '' }}</td> <td class="table-danger">{{ old_placeholder.device.model or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Serial Number:</th> <th scope="row">Serial Number:</th>
<td class="table-success">{{ placeholder.device.serial_number or '' }}</td> <td class="table-success">{{ new_placeholder.device.serial_number or '' }}</td>
<td class="table-danger">{{ device.serial_number or '' }}</td> <td class="table-danger">{{ old_placeholder.device.serial_number or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Brand:</th> <th scope="row">Brand:</th>
<td class="table-success">{{ placeholder.device.brand or '' }}</td> <td class="table-success">{{ new_placeholder.device.brand or '' }}</td>
<td class="table-danger">{{ device.brand or '' }}</td> <td class="table-danger">{{ old_placeholder.device.brand or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Sku:</th> <th scope="row">Sku:</th>
<td class="table-success">{{ placeholder.device.sku or '' }}</td> <td class="table-success">{{ new_placeholder.device.sku or '' }}</td>
<td class="table-danger">{{ device.sku or '' }}</td> <td class="table-danger">{{ old_placeholder.device.sku or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Generation:</th> <th scope="row">Generation:</th>
<td class="table-success">{{ placeholder.device.generation or '' }}</td> <td class="table-success">{{ new_placeholder.device.generation or '' }}</td>
<td class="table-danger">{{ device.generation or '' }}</td> <td class="table-danger">{{ old_placeholder.device.generation or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Version:</th> <th scope="row">Version:</th>
<td class="table-success">{{ placeholder.device.version or '' }}</td> <td class="table-success">{{ new_placeholder.device.version or '' }}</td>
<td class="table-danger">{{ device.version or '' }}</td> <td class="table-danger">{{ old_placeholder.device.version or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Weight:</th> <th scope="row">Weight:</th>
<td class="table-success">{{ placeholder.device.weight or '' }}</td> <td class="table-success">{{ new_placeholder.device.weight or '' }}</td>
<td class="table-danger">{{ device.weight or '' }}</td> <td class="table-danger">{{ old_placeholder.device.weight or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Width:</th> <th scope="row">Width:</th>
<td class="table-success">{{ placeholder.device.width or '' }}</td> <td class="table-success">{{ new_placeholder.device.width or '' }}</td>
<td class="table-danger">{{ device.width or '' }}</td> <td class="table-danger">{{ old_placeholder.device.width or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Height:</th> <th scope="row">Height:</th>
<td class="table-success">{{ placeholder.device.height or '' }}</td> <td class="table-success">{{ new_placeholder.device.height or '' }}</td>
<td class="table-danger">{{ device.height or '' }}</td> <td class="table-danger">{{ old_placeholder.device.height or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Depth:</th> <th scope="row">Depth:</th>
<td class="table-success">{{ placeholder.device.depth or '' }}</td> <td class="table-success">{{ new_placeholder.device.depth or '' }}</td>
<td class="table-danger">{{ device.depth or '' }}</td> <td class="table-danger">{{ old_placeholder.device.depth or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Color:</th> <th scope="row">Color:</th>
<td class="table-success">{{ placeholder.device.color or '' }}</td> <td class="table-success">{{ new_placeholder.device.color or '' }}</td>
<td class="table-danger">{{ device.color or '' }}</td> <td class="table-danger">{{ old_placeholder.device.color or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Production date:</th> <th scope="row">Production date:</th>
<td class="table-success">{{ placeholder.device.production_date or '' }}</td> <td class="table-success">{{ new_placeholder.device.production_date or '' }}</td>
<td class="table-danger">{{ device.production_date or '' }}</td> <td class="table-danger">{{ old_placeholder.device.production_date or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Variant:</th> <th scope="row">Variant:</th>
<td class="table-success">{{ placeholder.device.variant or '' }}</td> <td class="table-success">{{ new_placeholder.device.variant or '' }}</td>
<td class="table-danger">{{ device.variant or '' }}</td> <td class="table-danger">{{ old_placeholder.device.variant or '' }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<br /> <br />
{% if placeholder.device.components or device.components %} {% if new_placeholder.device.components or old_placeholder.device.components %}
<h2>Components</h2> <h2>Components</h2>
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr class="text-center"> <tr class="text-center">
<th scope="col">Info to be Entered</th> <th scope="col">Info Twin device</th>
<th scope="col">Info to be Decoupled</th> <th scope="col">Info Abstract device</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td class="table-success text-right"> <td class="table-success text-right">
{% for c in placeholder.device.components %} {% for c in new_placeholder.device.components %}
* {{ c.verbose_name }}<br /> * {{ c.verbose_name }}<br />
{% endfor %} {% endfor %}
</td> </td>
<td class="table-danger"> <td class="table-danger">
{% for c in device.components %} {% for c in old_placeholder.device.components %}
* {{ c.verbose_name }}<br /> * {{ c.verbose_name }}<br />
{% endfor %} {% endfor %}
</td> </td>
@ -144,8 +139,8 @@
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr class="text-center"> <tr class="text-center">
<th scope="col">Info to be Entered</th> <th scope="col">Info Twin device</th>
<th scope="col">Info to be Decoupled</th> <th scope="col">Info Abstract device</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -169,8 +164,8 @@
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr class="text-center"> <tr class="text-center">
<th scope="col">Info to be Entered</th> <th scope="col">Info Twin device</th>
<th scope="col">Info to be Decoupled</th> <th scope="col">Info Abstract device</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -189,7 +184,7 @@
<div> <div>
<form method="post"> <form method="post">
<a href="{{ url_for('inventory.device_details', id=device.placeholder.binding.devicehub_id) }}" class="btn btn-danger">Cancel</a> <a href="{{ url_for('inventory.device_details', id=old_placeholder.device.devicehub_id) }}" class="btn btn-danger">Cancel</a>
<button class="btn btn-primary" type="submit">Confirm</button> <button class="btn btn-primary" type="submit">Confirm</button>
</form> </form>
</div> </div>

View File

@ -46,13 +46,13 @@
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#components">Components</button> <button class="nav-link" data-bs-toggle="tab" data-bs-target="#components">Components</button>
</li> </li>
{% if device.is_abstract() == 'Abstract' %} {% if placeholder.status == 'Abstract' %}
<li class="nav-item"> <li class="nav-item">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#binding">Binding</button> <button class="nav-link" data-bs-toggle="tab" data-bs-target="#binding">Binding</button>
</li> </li>
{% endif %} {% endif %}
{% if device.is_abstract() == 'Twin' %} {% if placeholder.status == 'Twin' %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{{ url_for('inventory.unbinding', phid=placeholder.phid) }}">Unbinding</a> <a class="nav-link" href="{{ url_for('inventory.unbinding', phid=placeholder.phid) }}">Unbinding</a>
</li> </li>
@ -67,7 +67,7 @@
<div class="col-lg-3 col-md-4 label "> <div class="col-lg-3 col-md-4 label ">
(<a href="{{ url_for('inventory.device_edit', id=placeholder.device.devicehub_id)}}">Edit Device</a>) (<a href="{{ url_for('inventory.device_edit', id=placeholder.device.devicehub_id)}}">Edit Device</a>)
</div> </div>
<div class="col-lg-9 col-md-8">{{ placeholder.device.is_abstract() }}</div> <div class="col-lg-9 col-md-8">{{ placeholder.status }}</div>
</div> </div>
<div class="row"> <div class="row">
@ -95,6 +95,7 @@
<div class="col-lg-9 col-md-8">{{ placeholder.device.serial_number or ''}}</div> <div class="col-lg-9 col-md-8">{{ placeholder.device.serial_number or ''}}</div>
</div> </div>
{% if placeholder.binding %}
<h5 class="card-title">Details Abstract parth</h5> <h5 class="card-title">Details Abstract parth</h5>
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label ">Type</div> <div class="col-lg-3 col-md-4 label ">Type</div>
@ -115,6 +116,7 @@
<div class="col-lg-3 col-md-4 label">Serial Number</div> <div class="col-lg-3 col-md-4 label">Serial Number</div>
<div class="col-lg-9 col-md-8">{{ placeholder.binding.serial_number or ''}}</div> <div class="col-lg-9 col-md-8">{{ placeholder.binding.serial_number or ''}}</div>
</div> </div>
{% endif %}
</div> </div>
<div class="tab-pane fade profile-overview" id="lots"> <div class="tab-pane fade profile-overview" id="lots">
@ -202,10 +204,15 @@
</div> </div>
<div class="tab-pane fade profile-overview" id="components"> <div class="tab-pane fade profile-overview" id="components">
<h5 class="card-title">Components Details</h5> <h5 class="card-title">Components Real parth</h5>
{% if device.binding %}
<div class="list-group col-6"> <div class="list-group col-6">
{% for component in device.components|sort(attribute='type') %} {{ placeholder.components or '' }}
</div>
{% if placeholder.binding %}
<h5 class="card-title">Components Abstract parth</h5>
<div class="list-group col-6">
{% for component in placeholder.binding.components|sort(attribute='type') %}
<div class="list-group-item"> <div class="list-group-item">
<div class="d-flex w-100 justify-content-between"> <div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ component.type }}</h5> <h5 class="mb-1">{{ component.type }}</h5>
@ -223,13 +230,9 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% else %}
<div class="col-6">
{{ device.placeholder.components or '' }}
</div>
{% endif %} {% endif %}
</div> </div>
{% if device.is_abstract() %} {% if placeholder.status %}
<div class="tab-pane fade {% if active_binding %}show active{% else %}profile-overview{% endif %}" id="binding"> <div class="tab-pane fade {% if active_binding %}show active{% else %}profile-overview{% endif %}" id="binding">
<h5 class="card-title">Binding</h5> <h5 class="card-title">Binding</h5>
<div class="list-group col-6"> <div class="list-group col-6">

View File

@ -26,84 +26,79 @@
<thead> <thead>
<tr class="text-center"> <tr class="text-center">
<th scope="col">Basic Data</th> <th scope="col">Basic Data</th>
<th scope="col">Info to be Entered</th> <th scope="col">Info Abstract device</th>
<th scope="col">Info to be Decoupled</th> <th scope="col">Info Real device</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">PHID:</th>
<td class="table-success"></td>
<td class="table-danger text-right">{{ placeholder.phid or '' }}</td>
</tr>
<tr> <tr>
<th scope="row">Manufacturer:</th> <th scope="row">Manufacturer:</th>
<td class="table-success">{{ device.manufacturer or '' }}</td> <td class="table-success">{{ placeholder.binding.manufacturer or '' }}</td>
<td class="table-danger text-right">{{ placeholder.device.manufacturer or '' }}</td> <td class="table-danger text-right">{{ placeholder.device.manufacturer or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Model:</th> <th scope="row">Model:</th>
<td class="table-success">{{ device.model or '' }}</td> <td class="table-success">{{ placeholder.binding.model or '' }}</td>
<td class="table-danger">{{ placeholder.device.model or '' }}</td> <td class="table-danger">{{ placeholder.device.model or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Serial Number:</th> <th scope="row">Serial Number:</th>
<td class="table-success">{{ device.serial_number or '' }}</td> <td class="table-success">{{ placeholder.binding.serial_number or '' }}</td>
<td class="table-danger">{{ placeholder.device.serial_number or '' }}</td> <td class="table-danger">{{ placeholder.device.serial_number or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Brand:</th> <th scope="row">Brand:</th>
<td class="table-success">{{ device.brand or '' }}</td> <td class="table-success">{{ placeholder.binding.brand or '' }}</td>
<td class="table-danger">{{ placeholder.device.brand or '' }}</td> <td class="table-danger">{{ placeholder.device.brand or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Sku:</th> <th scope="row">Sku:</th>
<td class="table-success">{{ device.sku or '' }}</td> <td class="table-success">{{ placeholder.binding.sku or '' }}</td>
<td class="table-danger">{{ placeholder.device.sku or '' }}</td> <td class="table-danger">{{ placeholder.device.sku or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Generation:</th> <th scope="row">Generation:</th>
<td class="table-success">{{ device.generation or '' }}</td> <td class="table-success">{{ placeholder.binding.generation or '' }}</td>
<td class="table-danger">{{ placeholder.device.generation or '' }}</td> <td class="table-danger">{{ placeholder.device.generation or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Version:</th> <th scope="row">Version:</th>
<td class="table-success">{{ device.version or '' }}</td> <td class="table-success">{{ placeholder.binding.version or '' }}</td>
<td class="table-danger">{{ placeholder.device.version or '' }}</td> <td class="table-danger">{{ placeholder.device.version or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Weight:</th> <th scope="row">Weight:</th>
<td class="table-success">{{ device.weight or '' }}</td> <td class="table-success">{{ placeholder.binding.weight or '' }}</td>
<td class="table-danger">{{ placeholder.device.weight or '' }}</td> <td class="table-danger">{{ placeholder.device.weight or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Width:</th> <th scope="row">Width:</th>
<td class="table-success">{{ device.width or '' }}</td> <td class="table-success">{{ placeholder.binding.width or '' }}</td>
<td class="table-danger">{{ placeholder.device.width or '' }}</td> <td class="table-danger">{{ placeholder.device.width or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Height:</th> <th scope="row">Height:</th>
<td class="table-success">{{ device.height or '' }}</td> <td class="table-success">{{ placeholder.binding.height or '' }}</td>
<td class="table-danger">{{ placeholder.device.height or '' }}</td> <td class="table-danger">{{ placeholder.device.height or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Depth:</th> <th scope="row">Depth:</th>
<td class="table-success">{{ device.depth or '' }}</td> <td class="table-success">{{ placeholder.binding.depth or '' }}</td>
<td class="table-danger">{{ placeholder.device.depth or '' }}</td> <td class="table-danger">{{ placeholder.device.depth or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Color:</th> <th scope="row">Color:</th>
<td class="table-success">{{ device.color or '' }}</td> <td class="table-success">{{ placeholder.binding.color or '' }}</td>
<td class="table-danger">{{ placeholder.device.color or '' }}</td> <td class="table-danger">{{ placeholder.device.color or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Production date:</th> <th scope="row">Production date:</th>
<td class="table-success">{{ device.production_date or '' }}</td> <td class="table-success">{{ placeholder.binding.production_date or '' }}</td>
<td class="table-danger">{{ placeholder.device.production_date or '' }}</td> <td class="table-danger">{{ placeholder.device.production_date or '' }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Variant:</th> <th scope="row">Variant:</th>
<td class="table-success">{{ device.variant or '' }}</td> <td class="table-success">{{ placeholder.binding.variant or '' }}</td>
<td class="table-danger">{{ placeholder.device.variant or '' }}</td> <td class="table-danger">{{ placeholder.device.variant or '' }}</td>
</tr> </tr>
</tbody> </tbody>
@ -111,26 +106,21 @@
<br /> <br />
{% if placeholder.device.components or device.components %} {% if placeholder.components %}
<h2>Components</h2> <h2>Components</h2>
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr class="text-center"> <tr class="text-center">
<th scope="col">Info to be Entered</th> <th scope="col">Info Abstract device</th>
<th scope="col">Info to be Decoupled</th> <th scope="col">Info Real device</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td class="table-success"> <td class="table-success">
{% for c in device.components %}
* {{ c.verbose_name }}<br />
{% endfor %}
</td> </td>
<td class="table-danger text-right"> <td class="table-danger text-right">
{% for c in placeholder.device.components %} {{ placeholder.components or ''}}
* {{ c.verbose_name }}<br />
{% endfor %}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -139,19 +129,19 @@
<br /> <br />
{% if placeholder.device.manual_actions or device.manual_actions %} {% if placeholder.device.manual_actions or placeholder.binding.manual_actions %}
<h2>Actions</h2> <h2>Actions</h2>
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr class="text-center"> <tr class="text-center">
<th scope="col">Info to be Entered</th> <th scope="col">Info Abstract device</th>
<th scope="col">Info to be Decoupled</th> <th scope="col">Info Real device</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td class="table-success"> <td class="table-success">
{% for a in device.manual_actions %} {% for a in placeholder.binding.manual_actions %}
* {{ a.t }}<br /> * {{ a.t }}<br />
{% endfor %} {% endfor %}
</td> </td>
@ -165,6 +155,29 @@
</table> </table>
{% endif %} {% endif %}
{% if placeholder.device.tags %}
<h2>Tags</h2>
<table class="table table-hover">
<thead>
<tr class="text-center">
<th scope="col">Info Abstract device</th>
<th scope="col">Info Real device</th>
</tr>
</thead>
<tbody>
<tr>
<td class="table-success">
</td>
<td class="table-danger text-right">
{% for a in placeholder.device.tags %}
* {{ a.t }}<br />
{% endfor %}
</td>
</tr>
</tbody>
</table>
{% endif %}
<div> <div>
<form method="post"> <form method="post">
<a href="{{ url_for('inventory.device_details', id=placeholder.device.devicehub_id) }}" class="btn btn-danger">Cancel</a> <a href="{{ url_for('inventory.device_details', id=placeholder.device.devicehub_id) }}" class="btn btn-danger">Cancel</a>