diff options
Diffstat (limited to 'Web')
-rw-r--r-- | Web/Server/Results/results.csv | 2 | ||||
-rw-r--r-- | Web/Server/Server.py | 15 | ||||
-rw-r--r-- | Web/Server/static/Server.css | 22 | ||||
-rw-r--r-- | Web/Server/static/Server.js | 4 | ||||
-rw-r--r-- | Web/Server/templates/base.html | 5 | ||||
-rw-r--r-- | Web/Server/templates/index.html | 16 | ||||
-rw-r--r-- | Web/Server/templates/results.html | 4 |
7 files changed, 36 insertions, 32 deletions
diff --git a/Web/Server/Results/results.csv b/Web/Server/Results/results.csv index a16431a..82b0137 100644 --- a/Web/Server/Results/results.csv +++ b/Web/Server/Results/results.csv @@ -1,2 +1,2 @@ THIS IS RESULTS TEXT -Current Time = 21:17:28
\ No newline at end of file +Current Time = 10:55:30
\ No newline at end of file diff --git a/Web/Server/Server.py b/Web/Server/Server.py index 3a4f351..6070406 100644 --- a/Web/Server/Server.py +++ b/Web/Server/Server.py @@ -33,20 +33,20 @@ def upload_file(): if request.method == 'POST': # Check if the post request has the file part if 'file' not in request.files: - flash('No file part') - return redirect(request.url) + print("hi") + return render_template('index.html', error = 'No file part') # Grab the file file = request.files['file'] if file.filename == '': - flash('No file selected for uploading') - return redirect(request.url) + print("hi") + return render_template('index.html', error = 'No file selected for uploading') # Send the file content as a post to the PI if file and allowed_file(file.filename): dictToSend = {'filename':file.filename, 'file_content':file.read()} - file.close + file.close() print('Running test') response = requests.post(PI_URL + '/tests/endpoint', json=dictToSend) @@ -61,8 +61,9 @@ def upload_file(): return render_template('results.html') else: - flash('Allowed file types are .py') - return redirect(request.url) + print("hi") + return render_template('index.html', error = 'Allowed file types are .py') + return render_template('index.html', error = 'No file selected') @app.route('/results', methods=['GET']) def download(): diff --git a/Web/Server/static/Server.css b/Web/Server/static/Server.css index 78e53c7..10d8b23 100644 --- a/Web/Server/static/Server.css +++ b/Web/Server/static/Server.css @@ -2,15 +2,16 @@ color: white; background-color: maroon; border-style: solid; - border: 1px solid black; + border: 1px solid #d5d6d2; text-align: center; margin:5px; } .button { background-color: gold; - border: none; - color: white; + border: solid; + border-color:#d5d6d2; + color: black; padding: 15px 32px; text-align: center; text-decoration: none; @@ -20,11 +21,9 @@ .button:hover{ background-color: white; - color: gold; cursor: pointer; } - a{ color:white; text-decoration:none; @@ -33,6 +32,15 @@ a:hover{ text-decoration:underline } +#main{ + color: black; + background-color: #d5d6d2; + border-style: solid; + border: 1px solid #d5d6d2; + text-align: center; + margin:5px; +} + #about{ display: none; } @@ -46,7 +54,9 @@ a:hover{ } #choose_file{ - + border: none; + text-decoration: none; + display: inline-block; } #submit{ diff --git a/Web/Server/static/Server.js b/Web/Server/static/Server.js index 129951b..6c2be18 100644 --- a/Web/Server/static/Server.js +++ b/Web/Server/static/Server.js @@ -1,6 +1,6 @@ function showLoad(){ - var paragraph = document.getElementById("message"); - var text = document.createTextNode("RUNNING TEST"); + var paragraph = document.getElementById("running"); + var text = document.createTextNode("Running Test, Please wait for Results"); paragraph.appendChild(text); var div = document.getElementById("upload"); diff --git a/Web/Server/templates/base.html b/Web/Server/templates/base.html index e253819..a1bc09b 100644 --- a/Web/Server/templates/base.html +++ b/Web/Server/templates/base.html @@ -10,9 +10,6 @@ <button class="button" onclick="toggleAbout()">About</button> - <br> - <br> - <div id="about"> <h2 id="subtitle"> By Alin Butoi, Paul D’Amico, Dat Nguyen, Ross Olson, Rachel Schow <br> @@ -42,7 +39,7 @@ <br> </nav> - <div class = "container"> + <div id="main"> {% block content %} default content {% endblock %} diff --git a/Web/Server/templates/index.html b/Web/Server/templates/index.html index 730d6c5..6f7e738 100644 --- a/Web/Server/templates/index.html +++ b/Web/Server/templates/index.html @@ -2,17 +2,11 @@ {% block content %} <div id="upload"> - <h2>Upload a python file onto the Inverted Pendulum</h2> + <h2>Upload a python file onto the inverted pendulum</h2> <p> - {% with messages = get_flashed_messages() %} - {% if messages %} - <ul class=flashes> - {% for message in messages %} - <li>{{ message }}</li> - {% endfor %} - </ul> + {% if error %} + <h2>{{ error }}</h2> {% endif %} - {% endwith %} </p> <form method="post" action="/upload" enctype="multipart/form-data"> @@ -22,11 +16,11 @@ </p> </dl> <p> - <input id="submit" type="submit" value="Submit" onclick="showLoad()"> + <input id="submit" type="submit" value="Submit"> <!-- onclick="showLoad()"> --> </p> </form> </div> - <div id="message"></div> + <div id="running"></div> {% endblock %} diff --git a/Web/Server/templates/results.html b/Web/Server/templates/results.html index 5714f96..dd32d87 100644 --- a/Web/Server/templates/results.html +++ b/Web/Server/templates/results.html @@ -1,11 +1,13 @@ {% extends "base.html" %} {% block content %} + <br> + <br> <form method="get" action="/results"> <button type="submit">Download Results File</button> </form> <form method="get" action="/"> - <button type="submit">Return to upload another file</button> + <button type="submit">Upload another file</button> </form> {% endblock %}
\ No newline at end of file |