Skip to content

Commit

Permalink
Merge pull request #36 from ctreffe/release-v0.4.3
Browse files Browse the repository at this point in the history
# Mortimer v0.4.3

## Bugfixes

* Fixed a bug that caused the `web_experiments.experiment()` page to crash as a consequence of a specific experiment startup error.

## Smaller changes

* Improved error handling: Subjects will now always receive a neutral error page, if an experiment crashes. Previously, they were redirected to the login page in some cases.
* Small UI improvements
  • Loading branch information
jobrachem authored Apr 9, 2020
2 parents b8f176f + 8557b8a commit da28089
Show file tree
Hide file tree
Showing 13 changed files with 180 additions and 147 deletions.
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Mortimer v0.4.3

## Bugfixes

* Fixed a bug that caused the `web_experiments.experiment()` page to crash as a consequence of a specific experiment startup error.

## Smaller changes

* Improved error handling: Subjects will now always receive a neutral error page, if an experiment crashes. Previously, they were redirected to the login page in some cases.
* Small UI improvements

# Mortimer v0.4.2

## Bugfixes
Expand Down
3 changes: 1 addition & 2 deletions mortimer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
from flask_mail import Mail
from flask_dropzone import Dropzone
import pymongo
import alfred

__version__ = '0.4.2'
__version__ = '0.4.3'

# the EnvironSetter sets enviroment variables for the current session
# It is not included in the GitHub repository, because it contains sensitive
Expand Down
2 changes: 1 addition & 1 deletion mortimer/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Config:

# Flask-Dropzone settings:
DROPZONE_ALLOWED_FILE_CUSTOM = True
DROPZONE_ALLOWED_FILE_TYPE = ".pdf, image/*, .txt, .xml, .pem, .mp3, .mp4, .ogg"
DROPZONE_ALLOWED_FILE_TYPE = ".pdf, image/*, .txt, .xml, .pem, .mp3, .mp4, .ogg, .csv"
DROPZONE_MAX_FILE_SIZE = 10
DROPZONE_MAX_FILES = 100
DROPZONE_UPLOAD_ON_CLICK = True
Expand Down
14 changes: 10 additions & 4 deletions mortimer/errors/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@
errors = Blueprint("erros", __name__)


@errors.app_errorhandler(404)
def error_404(error):
return render_template('errors/404.html'), 404
@errors.app_errorhandler(400)
def error_400(error):
return render_template("errors/400.html"), 400


@errors.app_errorhandler(403)
def error_403(error):
return render_template('errors/403.html'), 403


@errors.app_errorhandler(404)
def error_404(error):
return render_template('errors/404.html'), 404


@errors.app_errorhandler(500)
def error_500(error):
return render_template('errors/500.html'), 500
return render_template('errors/500_alfred.html'), 500

10 changes: 5 additions & 5 deletions mortimer/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#sidebar ul.components {
padding: 20px 0;
border-bttom: 1px solid #47748b;
border-bottom: 1px solid #47748b;
}

#sidebar ul p {
Expand All @@ -56,8 +56,8 @@
/*background: #343a40;*/
}

#contentNav {
color: #fff;
/* #contentNav {
color: inherit;
}
#contentNav ul li a{
Expand All @@ -66,8 +66,8 @@
}
#contentNav ul li a:hover {
color: #343a40;
}
color: #6c757d;
} */

#sidebar ul li.active > a, a[aria-expanded="true"] {
color: #fff;
Expand Down
2 changes: 1 addition & 1 deletion mortimer/templates/create_experiment.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<i class="fas fa-globe mr-2"></i>Web Experiment (current)</a>
</li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a href="{{ url_for('local_experiments.new_local_experiment') }}" class="nav-link active"><i
<li class="nav-item"><a href="{{ url_for('local_experiments.new_local_experiment') }}" class="nav-link"><i
class="fas fa-dot-circle mr-2"></i>Local Experiment</a></li>
</ul>

Expand Down
9 changes: 9 additions & 0 deletions mortimer/templates/errors/400.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends "skeleton.html" %}


{% block layout %}
<div class="jumbotron mt-5">
<h1>Bad Request (400)</h1>
<p>Something went wrong. Please try again later.</p>
</div>
{% endblock %}
175 changes: 83 additions & 92 deletions mortimer/templates/experiment.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,20 @@ <h2 class="card-text"><span class="badge badge-success">public</span></h2>
</div>
</div>
</div>
</div>

<div class="col mb-4">
<div class="card h-100 text-center">
<div class="card-header">
Script
</div>
<div class="card-body">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#uploadModal"><i
class="fas fa-upload"></i> Upload Script</button>
</div>
</div>
</div>

</div>


{% if experiment.description %}
Expand All @@ -153,102 +165,18 @@ <h6 class="border-bottom pt-2 mt-3"><b>Description</b></h6>

<div class="alert alert-info" role="alert">
<!-- <h3>Futurizing a script</h3> -->
<b>When you publish research</b> conducted using Alfred, please cite. <span title="In this proposed citation, we use the latest alfred version number that was used for data collection in the current experiment. The doi will always link to the Zenodo repository with all versions."><i class="fas fa-info-circle"></i></span><br>
Treffenstaedt, C., Wiemann, P. & Brachem, J. (2020). Alfred - A library for rapid experiment development (Version {{ alfred_versions[-1] }}). Göttingen, Germany: <a href="https://doi.org/10.5281/zenodo.1437219">https://doi.org/10.5281/zenodo.1437219</a>
<b>When you publish research</b> conducted using Alfred, please cite. <span
title="In this proposed citation, we use the latest alfred version number that was used for data collection in the current experiment. The doi will always link to the Zenodo repository with all versions."><i
class="fas fa-info-circle"></i></span><br>
Treffenstaedt, C., Wiemann, P. & Brachem, J. (2020). Alfred - A library for rapid experiment development (Version
{{ alfred_versions[-1] }}). Göttingen, Germany: <a
href="https://doi.org/10.5281/zenodo.1437219">https://doi.org/10.5281/zenodo.1437219</a>
</div>
Alfred versions used for data collection in this experiment:
{% for v in alfred_versions %}
<span class="badge badge-dark">{{ v }}</span>
<span class="badge badge-dark">{{ v }}</span>
{% endfor %}


<!-- <div class="article content-section">
<h3 class="pt-2"><b>Data</b></h3>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">N</th>
<th scope="col" class="text-center"><span class="badge badge-success">Finished</span></th>
<th scope="col" class="text-center"><span class="badge badge-warning">Unfinished</span></th>
<th scope="col" class="text-center"><span class="badge badge-dark">Total</span></th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">All Versions</th>
<td class="text-center">{{ datasets["all_finished_datasets"] }}</td>
<td class="text-center">{{ datasets["all_unfinished_datasets"] }}</td>
<td class="text-center">{{ datasets["all_datasets"] }}</td>
</tr>
{% for version, info in versions.items() %}
<tr>
<th scope="row">Version {{ version }} </th>
<td class="text-center">{{ info["finished"] }}</td>
<td class="text-center">{{ info["unfinished"] }}</td>
<td class="text-center">{{ info["total"] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div> -->


<div class="mt-2">
<form method="POST"
action="{{ url_for('web_experiments.experiment', username=experiment.author, exp_title=experiment.title) }}"
enctype="multipart/form-data" class="needs-validation" novalidate>
{{ form.hidden_tag() }}
<h3 class="border-bottom pt-2"><b>{{ form.script.label() }}</b></h3>
<div class="form-row">
<div class="col col-sm-2">

<div class="form-group row">
<label class="col col-form-label">Version</label>
<div class="col">
{% if form.version.errors %}
{{ form.version(class="form-control form-control-sm is-invalid") }}

<div class="invalid-feedback">
{% for error in form.version.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>

{% else %}
{{ form.version(class="form-control form-control-sm", placeholder=experiment.version) }}
{% endif %}
</div>
</div>

</div>
<div class="col">

{{ form.script(class="form-control-file") }}
{% if form.script.errors %}
{% for error in form.script.errors %}
<span class="text-danger">{{ error }}</span><br>
{% endfor %}
{% endif %}
</div>
</div>
<small id="versionHelpBlock" class="form-text text-muted">
Changing the version number allows you to choose, for which versions of an experiment you want to download data.
If you made substantial changes to your experiment, you should change the version.
</small>
<div class="form-row pt-3">
<div class="col">
{{ form.submit(class="btn btn-primary btn-sm", id="submit")}}
</div>
</div>
</form>


</div>

<div class="article content-section mt-5 float-right">

<button type="button" class="btn btn-danger ml-1 mt-2 mb-2" data-toggle="modal" data-target="#deleteModal"><i
Expand Down Expand Up @@ -283,6 +211,69 @@ <h5 class="modal-title" id="deleteModalLabel">Delete Experiment</h5>
</div>


<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="uploadModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="uploadModalLabel">Upload script.py</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Here, you can upload a new script.py. Your current script.py will be replaced.</p>
</div>
<div class="modal-footer">
<form method="POST"
action="{{ url_for('web_experiments.experiment', username=experiment.author, exp_title=experiment.title) }}"
enctype="multipart/form-data" class="needs-validation" novalidate>
{{ form.hidden_tag() }}

<div class="form-group">

{{ form.script(class="form-control-file") }}
{% if form.script.errors %}
{% for error in form.script.errors %}
<span class="text-danger">{{ error }}</span><br>
{% endfor %}
{% endif %}
</div>

<div class="form-group">
{{ form.version.label(class="form-control-label") }}*
{% if form.version.errors %}
{{ form.version(class="form-control form-control-sm is-invalid") }}
<!-- , placeholder=form.version.label.text -->

<div class="invalid-feedback">
{% for error in form.version.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>

{% else %}
{{ form.version(class="form-control form-control-sm", placeholder=experiment.version) }}
{% endif %}
</div>

<small id="versionHelpBlock" class="form-text text-muted">
Changing the version number allows you to choose, for which versions of an experiment you want to download
data.
If you made substantial changes to your experiment, you should change the version.
</small>
<div class="form-row pt-3">
<div class="col">
{{ form.submit(class="btn btn-primary", id="submit")}}
</div>
</div>
</form>
</div>
</div>
</div>
</div>



{% endblock content %}

Expand Down
2 changes: 1 addition & 1 deletion mortimer/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h3 style="display: inline;">mortimer</h3><small class="text-light"> v{{ v_morti
<div id="content">


<nav class="navbar navbar-expand-sm bg-secondary sticky-top" id="contentNav">
<nav class="navbar navbar-light navbar-expand-sm shadow-sm bg-light text-secondary" id="contentNav">
<div class="container-fluid">

{% block navigation %}{% endblock %}
Expand Down
58 changes: 29 additions & 29 deletions mortimer/templates/layout_experiment.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@
{% block navigation %}

<ul class="nav navbar-nav mr-auto">
<li class="nav-item">
<a href="{{ url_for('web_experiments.experiment', exp_title=experiment.title, username=experiment.author) }}"
class="nav-link">
{% if experiment.active == True %}
<span class="badge badge-success">active</span>
{% else %}
<span class="badge badge-warning">inactive</span>
{% endif %}<i class="fas fa-home mr-2 ml-2"></i>{{ experiment.title }}</a>
</li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a
href="{{ url_for('web_experiments.experiment_script', exp_title=experiment.title, username=experiment.author) }}"
class="nav-link active"><i class="fas fa-code mr-2"></i>Script</a></li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a
href="{{ url_for('web_experiments.manage_resources', experiment_title=experiment.title, username=experiment.author) }}"
class="nav-link"><i class="fas fa-folder mr-2"></i>Resources</a></li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a
href="{{ url_for('web_experiments.web_export', experiment_title=experiment.title, username=experiment.author) }}"
class="nav-link"><i class="fas fa-download mr-2"></i>Export</a></li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a
href="{{ url_for('web_experiments.experiment_config', experiment_title=experiment.title, username=experiment.author) }}"
class="nav-link"><i class="fas fa-sliders-h mr-2"></i>Configuration</a></li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a
href="{{ url_for('web_experiments.experiment_log', experiment_title=experiment.title, username=experiment.author) }}"
class="nav-link"><i class="fas fa-clipboard mr-2"></i>Log</a></li>
<li class="nav-item">
<a href="{{ url_for('web_experiments.experiment', exp_title=experiment.title, username=experiment.author) }}"
class="nav-link active" id="nav-experiment">
{% if experiment.active == True %}
<span class="badge badge-success">active</span>
{% else %}
<span class="badge badge-warning">inactive</span>
{% endif %}<i class="fas fa-home mr-2 ml-2"></i>{{ experiment.title }}</a>
</li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a
href="{{ url_for('web_experiments.experiment_script', exp_title=experiment.title, username=experiment.author) }}"
class="nav-link active" id="nav-script"><i class="fas fa-code mr-2"></i>Script</a></li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a
href="{{ url_for('web_experiments.manage_resources', experiment_title=experiment.title, username=experiment.author) }}"
class="nav-link active" id="nav-resources"><i class="fas fa-folder mr-2"></i>Resources</a></li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a
href="{{ url_for('web_experiments.web_export', experiment_title=experiment.title, username=experiment.author) }}"
class="nav-link active" id="nav-export"><i class="fas fa-download mr-2"></i>Export</a></li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a
href="{{ url_for('web_experiments.experiment_config', experiment_title=experiment.title, username=experiment.author) }}"
class="nav-link active" id="nav-config"><i class="fas fa-sliders-h mr-2"></i>Configuration</a></li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a
href="{{ url_for('web_experiments.experiment_log', experiment_title=experiment.title, username=experiment.author) }}"
class="nav-link active" id="nav-log"><i class="fas fa-clipboard mr-2"></i>Log</a></li>
</ul>

{% endblock %}
2 changes: 1 addition & 1 deletion mortimer/templates/user_experiments.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<i class="fas fa-globe mr-2"></i>Web Experiments (current)</a>
</li>
<li class="nav-item nav-link">|</li>
<li class="nav-item"><a href="{{ url_for('local_experiments.experiments') }}" class="nav-link active"><i
<li class="nav-item"><a href="{{ url_for('local_experiments.experiments') }}" class="nav-link"><i
class="fas fa-dot-circle mr-2"></i>Local Experiments</a></li>
</ul>

Expand Down
Loading

0 comments on commit da28089

Please sign in to comment.