From d4a6e927f69177a36cb9a9ed73138f9949a9c34a Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 29 Dec 2020 14:24:41 -0800 Subject: [PATCH] refactor loading javascript, html, and status payload --- wowstash/blueprints/wallet/routes.py | 10 +++----- wowstash/templates/scripts.html | 33 ++++++++++++++++++++++++++ wowstash/templates/wallet/loading.html | 32 ------------------------- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/wowstash/blueprints/wallet/routes.py b/wowstash/blueprints/wallet/routes.py index 77de7dd..47983e5 100644 --- a/wowstash/blueprints/wallet/routes.py +++ b/wowstash/blueprints/wallet/routes.py @@ -42,7 +42,6 @@ def setup(): @login_required def loading(): if current_user.wallet_connected and current_user.wallet_created: - sleep(1) return redirect(url_for('wallet.dashboard')) if current_user.wallet_created is False: return redirect(url_for('wallet.setup')) @@ -63,10 +62,12 @@ def dashboard(): password=current_user.wallet_password ) if not docker.container_exists(current_user.wallet_container): + print('container does not exist.') current_user.clear_wallet_data() return redirect(url_for('wallet.loading')) if not wallet.connected: + print('container not connected') return redirect(url_for('wallet.loading')) address = wallet.get_address() @@ -127,18 +128,13 @@ def create(): def status(): user_vol = docker.get_user_volume(current_user.id) restore_container = cache.get_data(f'restoring_{current_user.id}') - if restore_container: - restoring = True - else: - restoring = False data = { 'created': current_user.wallet_created, 'connected': current_user.wallet_connected, 'port': current_user.wallet_port, 'container': current_user.wallet_container, 'volume': docker.volume_exists(user_vol), - 'restoring': restoring, - 'restore_container': restore_container + 'restoring': docker.container_exists(restore_container) } return jsonify(data) diff --git a/wowstash/templates/scripts.html b/wowstash/templates/scripts.html index bbd331b..4710ed6 100644 --- a/wowstash/templates/scripts.html +++ b/wowstash/templates/scripts.html @@ -4,6 +4,39 @@ +{% if request.path == '/wallet/loading' %} + +{% endif %} + {% if request.path == '/wallet/dashboard' %} - {% include 'footer.html' %} {% include 'scripts.html' %}