Commit d44c906c authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

admin device view card-icons added

parent a046c0b4
......@@ -1101,3 +1101,24 @@ Traceback (most recent call last):
File "./app/helpers/device_data_model.py", line 147, in read_data
return json.loads(data.decode('utf-8'))
AttributeError: 'memoryview' object has no attribute 'decode'
[2020-07-04 14:08:40,976] ERROR in app: Exception on /recent-activity [GET]
Traceback (most recent call last):
File "/home/pi/thso.server/env/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/pi/thso.server/env/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/pi/thso.server/env/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/pi/thso.server/env/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/pi/thso.server/env/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/pi/thso.server/env/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "./app/helpers/decorators.py", line 23, in restricted_function
return f(*args, **kwargs)
File "./app/views.py", line 364, in recent_activity
ra += '<tr><th scope="row">'+r[1]+'</th><th>'+r[2]+'</th><th>'+r[0]+'</th><th>'+str(ddm.read_data(r[3], dev[3]))+'</th></tr>'
File "./app/helpers/device_data_model.py", line 147, in read_data
return json.loads(data.decode('utf-8'))
AttributeError: 'memoryview' object has no attribute 'decode'
......@@ -34,6 +34,11 @@
<h5 class="card-title text-uppercase text-muted mb-0">Name</h5>
<span class="h2 font-weight-bold mb-0">{{ dev[0] }}</span>
</div>
<div class="col-auto">
<div class="icon icon-shape bg-info text-white rounded-circle shadow">
<i class="fas fa-microchip"></i>
</div>
</div>
</div>
</div>
</div>
......@@ -46,6 +51,11 @@
<h5 class="card-title text-uppercase text-muted mb-0">Device ID</h5>
<span class="h2 font-weight-bold mb-0">{{ dev[1] }}</span>
</div>
<div class="col-auto">
<div class="icon icon-shape bg-primary text-white rounded-circle shadow">
<i class="fas fa-tag"></i>
</div>
</div>
</div>
</div>
</div>
......@@ -58,6 +68,11 @@
<h5 class="card-title text-uppercase text-muted mb-0">Last time up</h5>
<span class="h2 font-weight-bold mb-0">{{ ltup }}</span>
</div>
<div class="col-auto">
<div class="icon icon-shape bg-danger text-white rounded-circle shadow">
<i class="fas fa-history"></i>
</div>
</div>
</div>
</div>
</div>
......
......@@ -148,7 +148,7 @@
success: function(data) {
if (data.length == 0) {
$("#table_load_more").remove();
else {
} else {
data = eval(data);
data.forEach(function (entry) {
str = "<tr onclick=window.location=\"/administration/"+entry[0]+"\"><th>"+entry[0]+"</th>"+"<th>"+entry[1]+"</th></tr>";
......
......@@ -360,7 +360,7 @@ def recent_activity():
ra = ''
for r in recent_activity:
dev = dd.get(r[5], r[6])[1]
ra += '<tr><th scope="row">'+r[1]+'</th><th>'+r[2]+'</th><th>'+r[0]+'</th><th>'+str(ddm.read_data(r[3], dev[3]))+'</th></tr>'
ra += '<tr><th scope="row">'+r[1]+'</th><th>'+r[2]+'</th><th>'+r[0]+'</th><th>'+str(ddm.read_data(r[3].tobytes(), dev[3]))+'</th></tr>'
return ra, 200
......
......@@ -527,7 +527,7 @@ def administration_user_recent_activity(name):
for r in recent_activity:
dev = dd.get(r[5], r[6])[1]
ra += '<tr><th scope="row">'+r[1]+'</th><th>'+r[2]+'</th><th>'+r[0]+'</th><th>'+str(ddm.read_data(r[3], dev[3]))+'</th></tr>'
ra += '<tr><th scope="row">'+r[1]+'</th><th>'+r[2]+'</th><th>'+r[0]+'</th><th>'+str(ddm.read_data(r[3].tobytes(), dev[3]))+'</th></tr>'
return ra, 200
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment