From b18396e4e3aed99a2ab7ed8ca3838e55e8c69686 Mon Sep 17 00:00:00 2001 From: Niki Ulmanen Date: Mon, 29 Apr 2019 15:53:28 +0300 Subject: [PATCH] added timeout and sierra functions to flask --- OodiUI/__init__.py | 10 +++++++++- OodiUI/static/resetflag.js | 19 +++++++++++++++++++ OodiUI/static/style.css | 2 +- OodiUI/templates/base.html | 3 +++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 OodiUI/static/resetflag.js diff --git a/OodiUI/__init__.py b/OodiUI/__init__.py index 5497d14..da2b07f 100644 --- a/OodiUI/__init__.py +++ b/OodiUI/__init__.py @@ -31,7 +31,15 @@ def start_screen(): def start_emotions(): ### korvaa sierran metodi halutulla metodilla alla ### - return sierra.search_shelved_books("kalastus") + return sierra.ui_in_use() + + @app.route('/flag_reset', methods=['POST', 'GET']) + def flag_reset(): + print("ajax call received, resetting flag") + ### sierra function here ### + sierra.ui_not_in_use() + return "OK" + @app.route('/main', methods=['POST', 'GET']) def search_screen(): diff --git a/OodiUI/static/resetflag.js b/OodiUI/static/resetflag.js new file mode 100644 index 0000000..b6cdf1a --- /dev/null +++ b/OodiUI/static/resetflag.js @@ -0,0 +1,19 @@ +$(document).ready(function(){ + function backToStart() { + $.ajax({ + url: '/flag_reset', + cache: false, + headers: { + "cache-control": "no-cache" + }, + success: function(data) { + window.location.assign("/"); + }, + error: function(error) { + console.log(error); + } + }); + console.log("flag reset"); + } + setTimeout(backToStart, 300000); +}); diff --git a/OodiUI/static/style.css b/OodiUI/static/style.css index 22b3fd1..e19627f 100644 --- a/OodiUI/static/style.css +++ b/OodiUI/static/style.css @@ -10,7 +10,7 @@ html { align-content: center; font-size: 70pt; color: rgb(42, 52, 60); - left: 42.5%; + left: 40%; top: 10pt; } diff --git a/OodiUI/templates/base.html b/OodiUI/templates/base.html index 5c06f6e..2f56f96 100644 --- a/OodiUI/templates/base.html +++ b/OodiUI/templates/base.html @@ -56,6 +56,9 @@

Look for a book category

+ + + {% endblock %} {% block head %}