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

dev-conf view added

parent 8d792cf1
...@@ -156,6 +156,9 @@ def dev(): ...@@ -156,6 +156,9 @@ def dev():
dev = dh.get(session['appkey'], request.args.get('id')) dev = dh.get(session['appkey'], request.args.get('id'))
ltup = 'recently' ltup = 'recently'
session['devid'] = dev[1][1]
session['devname'] = dev[1][0]
return render_template('dev.html', dev=dev[1], appkey=session['appkey'], ltup=ltup) return render_template('dev.html', dev=dev[1], appkey=session['appkey'], ltup=ltup)
else: else:
res = dh.create(request.form['devname'], request.form['devid'], session['appkey'], request.form['devdesc']) res = dh.create(request.form['devname'], request.form['devid'], session['appkey'], request.form['devdesc'])
...@@ -172,6 +175,13 @@ def dev(): ...@@ -172,6 +175,13 @@ def dev():
return redirect(url_for('app')) return redirect(url_for('app'))
@server.route('/dev-conf', methods=['GET', 'POST'])
def dev_conf():
if request.method == 'GET':
return render_template('dev-conf.html', devname=session['devname'])
else:
pass
@server.route('/delete-dev') @server.route('/delete-dev')
def delete_dev(): def delete_dev():
dh = dd.DeviceDao() dh = dd.DeviceDao()
......
{% extends 'layout.html' %}
{% block title %} Configure Device: {% endblock %}
{% block content %}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<p> Device name : {{ devname }}
<form action="conf" method="post">
<div class="form-group">
<label>Config ID:</label><br>
<input type="text" id="confid" name="confid"><br>
</div>
<div class="form-group">
<label>Argument:</label><br>
<input type="text" id="argid" name="argid"><br>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Configure</button>
</div>
{% if feedback %}
<p class="text-danger float-right">{{ feedback }}</p>
{% endif %}
</form>
</div>
</div>
{% endblock %}
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<p>Last time up : {{ ltup }} </p> <p>Last time up : {{ ltup }} </p>
<a href="/data?id={{ dev[1] }}"><button type="submit" class="btn btn-primary">Data</button></a> <a href="/data?id={{ dev[1] }}"><button type="submit" class="btn btn-primary">Data</button></a>
<a href="/dev-conf={{ dev[1] }}"><button type="submit" class="btn btn-primary">Configure</button></a> <a href="/dev-conf?id={{ dev[1] }}"><button type="submit" class="btn btn-primary">Configure</button></a>
<a href="/delete-dev?id={{ dev[1] }}"><button type="submit" class="btn btn-danger" onclick="return conf();">Delete Device</button></a> <a href="/delete-dev?id={{ dev[1] }}"><button type="submit" class="btn btn-danger" onclick="return conf();">Delete Device</button></a>
</div> </div>
</div> </div>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="navbar-brand" href="#">Simple IoT Server</a> <a class="navbar-brand" href="/">HPC&A IoT Server</a>
</div> </div>
<div id="navbar" class="collapse navbar-collapse"> <div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col-md-6 col-md-offset3"> <div class="col-md-6 col-md-offset-3">
<form action="app" method="post"> <form action="app" method="post">
<div class="form-group"> <div class="form-group">
<label>Name:</label><br> <label>Name:</label><br>
......
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