summaryrefslogtreecommitdiff
path: root/dashboard_website/dashboard.py
diff options
context:
space:
mode:
Diffstat (limited to 'dashboard_website/dashboard.py')
-rw-r--r--dashboard_website/dashboard.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/dashboard_website/dashboard.py b/dashboard_website/dashboard.py
index 06af267..7d0d920 100644
--- a/dashboard_website/dashboard.py
+++ b/dashboard_website/dashboard.py
@@ -215,6 +215,15 @@ def getLatestInfo():
return jsonify(data)
+@app.route("/addClue", methods=['POST'])
+def addClueWeb():
+ content = request.get_json()
+
+ if not ('clue_name' in content and 'longitude' in content and 'latitude' in content and 'clue_info' in content):
+ return jsonify({'status' : "ERROR 1"})
+
+ return jsonify({'status' : "OK",})
+
# main page
# GET = get main page
@@ -223,6 +232,32 @@ def siteIndex():
#clues = db.getClues(); bikes = db.getBikes()
return render_template("index.html")#, clues=clues, bikes=bikes)
+# add csv, download as csv
+@app.route("/controls", methods=['GET', 'POST'])
+def siteControls():
+ if request.method == "GET":
+ return render_template("controls.html")
+ if request.method == "POST":
+ cmd = request.form.get('command')
+ print(cmd)
+ if cmd == "downloadSave":
+ print("send")
+ db.save()
+ return send_from_directory(".", "savefile.csv", as_attachment=True)
+ elif cmd == "loadDirty":
+ dirty_csv = request.files['dirtyfile']
+ dirty_csv.save("dirt.csv")
+ if db.loadDirty("dirt.csv") != 0:
+ return jsonify({"status" : "ERROR"})
+ return jsonify({"status" : "OK"})
+ elif cmd == "loadClean":
+ dirty_csv = request.files['cleanfile']
+ dirty_csv.save("clean.csv")
+ if db.load("clean.csv") != 0:
+ return jsonify({"status" : "ERROR"})
+ return jsonify({"status" : "OK"})
+
+ return render_template("controls.html")
if __name__ == "__main__":