Skip to content

Commit

Permalink
allows user to request a transcript by putting its id in the url
Browse files Browse the repository at this point in the history
  • Loading branch information
Coos Baakman committed Aug 6, 2019
1 parent 18dbbe3 commit d8c9479
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
4 changes: 4 additions & 0 deletions metadome/presentation/web/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
def index():
return render_template('index.html')

@bp.route('/transcript/<transcript_id>/', methods=['GET'])
def transcript(transcript_id):
return render_template('dashboard.html', transcript_id=transcript_id)

@bp.route('/dashboard', methods=['GET'])
def dashboard():
gene_names = GeneRepository.retrieve_all_gene_names_from_file()
Expand Down
15 changes: 13 additions & 2 deletions metadome/presentation/web/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Scripts needed for functionality on this page -->
<script src="{{ url_for('static', filename='js/d3-tip.js') }}"></script>
<script src="{{ url_for('static', filename='js/dashboard/visualization.js') }}" async></script>
<script src="{{ url_for('web.dashboard_js') }}" async></script>
<script src="{{ url_for('web.dashboard_js') }}" type="text/javascript"></script>

<script async>
$( function() {
Expand All @@ -16,6 +16,13 @@
});
</script>

{% if transcript_id|length > 0 %}
<script type="text/javascript">
visualizeTranscript('{{ transcript_id }}');
</script>
{% endif %}


<!-- Custom stylesheet for this page -->
<link rel="stylesheet"
href="{{ url_for('static', filename='css/tolerance_graph.css') }}">
Expand Down Expand Up @@ -142,7 +149,11 @@
<button class="button is-info" id="reset_zoom" onclick='resetZoom()'>Reset Zoom</button>
</div>
<div class="control">
<button class="button" id="reset_button" onclick='location.href="{{ url_for("web.dashboard") }}"'>Reset Page</button>
{% if transcript_id|length > 0 %}
<button class="button" id="reset_button" onclick='location.href="{{ url_for("web.transcript", transcript_id=transcript_id) }}"'>Reset Page</button>
{% else %}
<button class="button" id="reset_button" onclick='location.href="{{ url_for("web.dashboard") }}"'>Reset Page</button>
{% endif %}
</div>
</div>
</div>
Expand Down
15 changes: 15 additions & 0 deletions metadome/presentation/web/templates/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,21 @@ function visualize() {
}
}

function visualizeTranscript(transcript_id) {
$("#loading_overlay").addClass('is-active');
$("#loading_label").text("Loading...");
$.ajax(
{
type: 'POST',
url: "{{ url_for('api.submit_visualization_job_for_transcript') }}",
data: JSON.stringify({'transcript_id': transcript_id}),
success: function(data) { getVisualizationStatus(data.transcript_id, 0); },
contentType: "application/json",
dataType: 'json'
}
);
}

function getVisualizationStatus(transcript_id, checkCount) {
$.get(Flask.url_for("api.get_visualization_status_for_transcript",
{'transcript_id': transcript_id}),
Expand Down

0 comments on commit d8c9479

Please sign in to comment.