Skip to content
Snippets Groups Projects
Commit e40f1a94 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Allow logs to be downloaded

parent 7557aabe
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ from app import app ...@@ -7,6 +7,7 @@ from app import app
CONFIG_PATH = "pipeline.toml" CONFIG_PATH = "pipeline.toml"
PLOTS_PATH = "../plots" PLOTS_PATH = "../plots"
LOGS_PATH = "../logs"
USERNAME = None USERNAME = None
PASSWORD = None PASSWORD = None
app.config['FREEZER_DESTINATION'] = '../km3web' app.config['FREEZER_DESTINATION'] = '../km3web'
...@@ -154,14 +155,22 @@ def trigger(): ...@@ -154,14 +155,22 @@ def trigger():
@app.route('/logs.html') @app.route('/logs.html')
@requires_auth @requires_auth
def logs(): def logs():
msg_logs = glob("logs/MSG*.log") msg_logs = map(basename,
return render_template('logs.html', logs=msg_logs) sorted(glob(join(app.root_path, LOGS_PATH, "MSG*.log"))))
return render_template('logs.html', filenames=msg_logs)
@app.route('/logs/<path:filename>')
@requires_auth
def custom_static_logfile(filename):
filepath = join(app.root_path, LOGS_PATH)
print("Serving: {}/{}".format(filepath, filename))
return send_from_directory(join(app.root_path, LOGS_PATH), filename)
@app.route('/plots/<path:filename>') @app.route('/plots/<path:filename>')
@requires_auth @requires_auth
def custom_static(filename): def custom_static(filename):
print(filename)
filepath = join(app.root_path, PLOTS_PATH) filepath = join(app.root_path, PLOTS_PATH)
print(filepath) print("Serving: {}/{}".format(filepath, filename))
return send_from_directory(join(app.root_path, PLOTS_PATH), filename) return send_from_directory(join(app.root_path, PLOTS_PATH), filename)
...@@ -25,3 +25,7 @@ img.plot { ...@@ -25,3 +25,7 @@ img.plot {
height:100%; height:100%;
display: none; display: none;
} }
#logs {
margin-top: 50px;
}
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="active"><a href="compact.html">CMPCT</a></li> <li class="active"><a href="compact.html">CMPCT</a></li>
</ul> </ul>
<ul class="nav navbar-nav">
<li class="active"><a href="logs.html">Logs</a></li>
</ul>
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="active"><a href="https://git.km3net.de/km3py/km3mon/issues">Issues</a></li> <li class="active"><a href="https://git.km3net.de/km3py/km3mon/issues">Issues</a></li>
</ul> </ul>
...@@ -71,7 +74,7 @@ ...@@ -71,7 +74,7 @@
</nav> </nav>
{% block infoheader %}{% endblock %} {% block infoheader %}{% endblock %}
{% block plots %}{% endblock %} {% block main %}{% endblock %}
<script type = "text/javascript"> <script type = "text/javascript">
$(document).ready(function(){ $(document).ready(function(){
......
{% extends "base.html" %} {% extends "base.html" %}
{% block logs %} {% block main %}
<div class="container-fluid" id="logs"> <div class="container-fluid" id="logs">
{% for filename in logs %}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{{ filename }} {% for filename in filenames %}
<a href="/logs/{{ filename }}" class="btn btn-warning" role="button">{{ filename }}</a></button>
{% endfor %}
</div> </div>
</div> </div>
{% endfor %}
</div> </div>
{% endblock %} {% endblock %}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block plots %} {% block main %}
<div class="container-fluid" id="plots"> <div class="container-fluid" id="plots">
{% for row in plots %} {% for row in plots %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment