Commit 7515fd5d authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

new admin urlpaths tested + admin view cards added

parent bf0820b1
......@@ -29,7 +29,7 @@
<h3 class="mb-0">Add Device</h3>
</div>
<div class="card-body">
<form action="/administration/users/{{ user }}/application/{{ app[1] }}/add-device" method="post">
<form action="/administration/{{ user }}/application/{{ app[1] }}/add-device" method="post">
<div class="form-group">
<label>Name:</label><br>
<input type="text" maxlength="30" class="form-control" id="devname" name="devname" required><br>
......
......@@ -25,6 +25,11 @@
<h5 class="card-title text-uppercase text-muted mb-0">Name</h5>
<span class="h2 font-weight-bold mb-0">{{ app[0] }}</span>
</div>
<div class="col-auto">
<div class="icon icon-shape bg-success text-white rounded-circle shadow">
<i class="fas fa-cube"></i>
</div>
</div>
</div>
</div>
</div>
......@@ -37,6 +42,11 @@
<h5 class="card-title text-uppercase text-muted mb-0">App-Key</h5>
<span class="h2 font-weight-bold mb-0">{{ app[1] }}</span>
</div>
<div class="col-auto">
<div class="icon icon-shape bg-warning text-white rounded-circle shadow">
<i class="fas fa-key"></i>
</div>
</div>
</div>
</div>
</div>
......@@ -49,6 +59,19 @@
<h5 class="card-title text-uppercase text-muted mb-0">Secure</h5>
<span class="h2 font-weight-bold mb-0">{% if app[4] %} Yes {% else %} No {% endif %}</span>
</div>
{% if app[4] %}
<div class="col-auto">
<div class="icon icon-shape bg-info text-white rounded-circle shadow">
<i class="fas fa-lock"></i>
</div>
</div>
{% else %}
<div class="col-auto">
<div class="icon icon-shape bg-danger text-white rounded-circle shadow">
<i class="fas fa-unlock"></i>
</div>
</div>
{% endif %}
</div>
</div>
</div>
......
......@@ -2,6 +2,10 @@
{% block title %} Administration - {{ user }} - Dashboard - HPC&amp;A IoT {% endblock %}
{% block header %}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
{% endblock %}
{% block location %}
<a class="h4 mb-0 text-white text-uppercase d-none d-lg-inline-block" href="/administration">Administration</a>
<p class="h4 mb-0 text-white text-uppercase d-none d-lg-inline-block"> &nbsp;-&nbsp; </p>
......@@ -23,8 +27,8 @@
<span class="h2 font-weight-bold mb-0">{{ info[0] }}</span>
</div>
<div class="col-auto">
<div class="icon icon-shape bg-danger text-white rounded-circle shadow">
<i class="fas fa-chart-bar"></i>
<div class="icon icon-shape bg-success text-white rounded-circle shadow">
<i class="fas fa-cubes"></i>
</div>
</div>
</div>
......@@ -40,8 +44,8 @@
<span class="h2 font-weight-bold mb-0">{{ info[1] }}</span>
</div>
<div class="col-auto">
<div class="icon icon-shape bg-warning text-white rounded-circle shadow">
<i class="fas fa-chart-pie"></i>
<div class="icon icon-shape bg-info text-white rounded-circle shadow">
<i class="fas fa-microchip"></i>
</div>
</div>
</div>
......@@ -57,8 +61,8 @@
<span class="h2 font-weight-bold mb-0">{{ info[2] }}</span>
</div>
<div class="col-auto">
<div class="icon icon-shape bg-yellow text-white rounded-circle shadow">
<i class="fas fa-users"></i>
<div class="icon icon-shape bg-warning text-white rounded-circle shadow">
<i class="fas fa-area-chart"></i>
</div>
</div>
</div>
......@@ -74,8 +78,8 @@
<span class="h2 font-weight-bold mb-0">{{ info[3] }}</span>
</div>
<div class="col-auto">
<div class="icon icon-shape bg-info text-white rounded-circle shadow">
<i class="fas fa-percent"></i>
<div class="icon icon-shape bg-danger text-white rounded-circle shadow">
<i class="fas fa-line-chart"></i>
</div>
</div>
</div>
......
......@@ -101,7 +101,7 @@ def administration_user_new_application(name):
flash('Error: {}'.format(res[1]), 'danger')
return render_template(request.url)
res = dd.create_table(appkey)
res = dd.create_table_ddm(appkey)
if not res[0]:
ad.delete(appkey)
......@@ -129,7 +129,7 @@ def administration_user_application_add_device(name, appkey):
dev_list = dd.get_list(appkey)
return render_template('new/admin/user-add-device.html', app=ap[1], free_ids=misc.prep_id_range(dev_list[1]), models=ddm.MODELS, user=name)
elif request.method == 'POST':
ddmin = misc.extract_ddm(request)
ddmin = ddm.extract(request)
res = dd.create_ddm(request.form['devname'], request.form['devid'], appkey, request.form['devdesc'], ddmin)
if not res[0]:
......@@ -172,7 +172,7 @@ def administration_user_application_device_settings(name, appkey, devid):
return render_template('new/admin/user-application-device-settings.html', app=ap[1], dev=dev[1], models=ddm.MODELS, user=name)
elif request.method == 'POST':
ddmin = misc.extract_ddm(request)
ddmin = ddm.extract(request)
res = dd.update_ddm(appkey, devid, request.form['devname'], request.form['devdesc'], ddmin)
if not res[0]:
......@@ -438,7 +438,7 @@ def administration_user_application_device_download_csv(name, appkey, devid):
with open(app.config['DATA_DOWNLOAD_DIR_OS']+'/'+fn, 'w+') as f:
f.write('utc,timestamp,')
for d in dumpd[1][0][2]:
for d in dev[3]['format']:
f.write(d)
f.write(',')
f.write('\n')
......
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