Skip to content

Commit

Permalink
[#313] Web UI
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillmakhonin committed Dec 27, 2018
1 parent 55a00a6 commit 4e4e005
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
7 changes: 5 additions & 2 deletions legion/legion/edi/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = '/'
Expand Down Expand Up @@ -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
Expand Down
33 changes: 29 additions & 4 deletions legion/legion/templates/edi/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
<html>
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">

<title>Legion EDI web console</title>
</head>

<body>
<div class="container">
<h1>Legion EDI</h1>
<h3>Your personal authorisation token is:</h3>
<textarea onClick="this.setSelectionRange(0, this.value.length)">{{ token }}</textarea>
</div>
</body>

<style>
textarea {
font-family:monospace;
width:100%;
min-height: 300px;
padding: 5px 10px;
}
</style>

<body>
<h1>It works</h1>
</body>
</html>

0 comments on commit 4e4e005

Please sign in to comment.