Skip to content

Commit 0b3cad3

Browse files
committed
move session playback to analysis
1 parent 9039f36 commit 0b3cad3

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

web/analysis/templatetags/analysis_tags.py

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from django.template.defaultfilters import register
1212
from django.utils.html import escape
1313
from django.utils.safestring import mark_safe
14+
from uuid import uuid3, NAMESPACE_DNS
1415

1516

1617
@register.filter("is_string")
@@ -238,3 +239,9 @@ def _print(lvl, s):
238239
result.write('<pre style="margin: 0">' + escape(str(obj)) + "</pre>")
239240

240241
return mark_safe(result.getvalue())
242+
243+
244+
@register.filter(name="playback_url")
245+
def playback_url(task_id):
246+
session_id = uuid3(NAMESPACE_DNS, str(task_id)).hex[:16]
247+
return f"{task_id}_{session_id}"
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,39 @@
1-
<section id="playback">
2-
<h4>Session Playback</h4>
3-
<div>
1+
<link href="{{ STATIC_URL }}css/playback.css" rel="stylesheet" type="text/css"/>
2+
<script src="{{ STATIC_URL }}js/playback.js"></script>
3+
<script src="{{ STATIC_URL }}js/guacamole-common-js/1.4.0-all.min.js"></script>
4+
<a class="accordion-toggle" data-toggle="collapse" aria-expanded="false" href="#playback"><h4>Session Playback</h4></a>
5+
<div id="playback" class="collapse" >
46
{% if analysis.info.options.nohuman %}
5-
<button class="btn btn-secondary" onclick='window.open(window.location.origin + "/guac/playback/{{analysis.info.id}}")';><span class="fas fa-play"></span> Playback</button>
7+
<div id="terminal" style="width: 100%; height: 100%;">
8+
<!--
9+
Guacamole recording player
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
-->
12+
<div id="player">
13+
<!-- Player display -->
14+
<div id="display">
15+
<div class="notification-container">
16+
<div class="seek-notification">
17+
<p>
18+
Seek in progress...
19+
<button id="cancel-seek">Cancel</button>
20+
</p>
21+
</div>
22+
</div>
23+
</div>
24+
<!-- Player controls -->
25+
<div class="controls">
26+
<button id="play-pause">Play</button>
27+
<input id="position-slider" type="range">
28+
<span id="position">00:00</span>
29+
<span>/</span>
30+
<span id="duration">00:00</span>
31+
</div>
32+
</div>
33+
<!-- -->
34+
<script>initExamplePlayer("{{analysis.info.id|playback_url}}")</script>
35+
</div>
636
{% else %}
737
No playback available.
838
{% endif %}
9-
</div>
10-
</section>
39+
</div>>

0 commit comments

Comments
 (0)