Compare commits

..

No commits in common. "b3111c8d12072baf226978dfbdeec01d30f334ca" and "8f2c127d9cd7455ebebb7b82ee6c700bad8660ec" have entirely different histories.

4 changed files with 9 additions and 38 deletions

Binary file not shown.

View File

@ -46,6 +46,7 @@ nav span:hover {
background-color: whitesmoke;
}
.ip_address {
font-size: 0.8em;
font-style: italic;
@ -77,12 +78,12 @@ nav span:hover {
src: url("/static/fontawesome-webfont.woff2");
}
.edit, .save, .lock, .unlock {
.edit, .save {
font-size: 0.8em;
color: dimgrey;
}
.edit:hover, .save:hover, .lock:hover, .unlock:hover {
.edit:hover, .save:hover {
color: red;
cursor: pointer;
}

View File

@ -73,7 +73,7 @@ function save_field(field) {
let params = {
device_id: device_id,
sub_dev_id: sub_dev_id,
field: field.classList[0],
field: field.className,
value: value
};
let query = Object.keys(params)
@ -120,33 +120,3 @@ function new_device() {
children[children.length - 1].id = json.device_id;
});
}
function lock_device(device) {
let fields = device.querySelectorAll('.editable');
fields.forEach(function(field) {
field.querySelector('.edit').remove();
});
device.querySelector('.id').querySelector('.lock').remove();
let unlock = document.createElement('span');
unlock.innerHTML = '';
unlock.className = 'unlock font-awesome';
unlock.setAttribute('onclick', 'unlock_device(this.parentElement.parentElement)');
device.querySelector('.id').appendChild(unlock);
}
function unlock_device(device) {
let fields = device.querySelectorAll('.editable');
fields.forEach(function(field) {
let edit = document.createElement('span');
edit.innerHTML = '';
edit.className = 'edit font-awesome';
edit.setAttribute('onclick', 'edit_field(this.parentElement)');
field.appendChild(edit);
});
device.querySelector('.id').querySelector('.unlock').remove();
let lock = document.createElement('span');
lock.innerHTML = '';
lock.className = 'lock font-awesome';
lock.setAttribute('onclick', 'lock_device(this.parentElement.parentElement)');
device.querySelector('.id').appendChild(lock);
}

View File

@ -18,16 +18,16 @@
<div id="devices">
{% for device in network %}
<div class="device {{ device.type }}" id="{{ device.id }}">
<div class="id editable"><span class="field_value">{{ device.id }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span> <span class="lock font-awesome" onclick="lock_device(this.parentElement.parentElement)">&#xe803;</span></div>
<div class="description editable"><span class="field_value">{{ device.description }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
<div class="location editable"><span class="field_value">{{ device.location }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
<div class="ip_address editable"><span class="field_value">{{ device.ip_address }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
<div class="id">{{ device.id }}</div>
<div class="description"><span class="field_value">{{ device.description }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
<div class="location"><span class="field_value">{{ device.location }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
<div class="ip_address"><span class="field_value"><i>{{ device.ip_address }}</i></span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
<div class="sub_devices">
{% for sub_dev in device.sub_devices %}
<div class="sub_device {{ sub_dev.type }}" id="{{ sub_dev.id }}">
<div class="id">{{ sub_dev.id }}</div>
<object class="outlet_image" data="/static/outlet.svg"></object>
<div class="description editable"><span class="field_value">{{ sub_dev.description }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
<div class="description"><span class="field_value">{{ sub_dev.description }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
</div>
{% endfor %}
</div>