From 4e4e0054e922d1d27a25ac3737027f368a03f654 Mon Sep 17 00:00:00 2001 From: Kirill Makhonin Date: Thu, 27 Dec 2018 16:59:19 +0300 Subject: [PATCH] [#313] Web UI --- legion/legion/edi/server.py | 7 ++++-- legion/legion/templates/edi/index.html | 33 ++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/legion/legion/edi/server.py b/legion/legion/edi/server.py index cb7cf8f4c..a7b024fd5 100644 --- a/legion/legion/edi/server.py +++ b/legion/legion/edi/server.py @@ -24,7 +24,7 @@ import legion.external.grafana import legion.http import legion.model -from flask import Flask, Blueprint, render_template +from flask import Flask, Blueprint, render_template, request from flask import current_app as app import os import jwt @@ -35,6 +35,7 @@ TEMPLATES_FOLDER = os.path.abspath(os.path.join( os.path.dirname(__file__), os.pardir, 'templates', 'edi') ) +AUTH_COOKIE_NAME = '_oauth2_proxy' EDI_VERSION = '1.0' EDI_ROOT = '/' @@ -102,7 +103,9 @@ def root(): :return: dict -- root information """ - return render_template('index.html') + token = request.cookies.get(AUTH_COOKIE_NAME, 'INVALID COOKIE') + return render_template('index.html', + token=token) @blueprint.route(build_blueprint_url(EDI_API_ROOT), methods=['GET']) @legion.http.provide_json_response diff --git a/legion/legion/templates/edi/index.html b/legion/legion/templates/edi/index.html index 12310d85a..51d1355ac 100644 --- a/legion/legion/templates/edi/index.html +++ b/legion/legion/templates/edi/index.html @@ -1,6 +1,31 @@ - + + + + + + + + + + Legion EDI web console + + + +
+

Legion EDI

+

Your personal authorisation token is:

+ +
+ + + - -

It works

- \ No newline at end of file