aboutsummaryrefslogtreecommitdiff
path: root/app/templates/annotate/index.html
blob: 106ef2ab120c83a9547025854331ee8168a4407e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{% extends "base.html" %}

{% block styles %}
{{super()}}
<link rel="stylesheet" href="{{url_for('static', filename='annotate.css')}}">
{% endblock %}

{% block app_content %}
<h1>{{ task.dataset.name }}</h1>

<div id="rubric" class="row">
	<div class="col-md-12">
		<p>{{ rubric | safe }}</p>
	</div>
</div>

<div id="graph"></div>

<div id="wrap-buttons" class="row">
	<div class="col-md-6 text-left">
	<button class="btn btn-primary float-md-left" type="button" id="btn-reset">Reset</button>
	</div>
	<div class="col-md-6 text-right">
	<button class="btn btn-warning float-md-right" type="button" id="btn-none">No Changepoints</button>
	<button class="btn btn-success float-md-right" id="btn-submit" type="button">Submit</button>
	</div>
</div>
<br>

<!-- Modal -->
<div class="modal fade" id="submitNoCPModal" tabindex="-1" role="dialog" aria-labelledby="submitNoCPModalTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="submitNoCPModalLongTitle">No Changepoints Selected</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
	      Please use the "No Changepoints" button when you think there are no changepoints in the time series.
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>

<!-- Modal -->
<div class="modal fade" id="NoCPYesCPModal" tabindex="-1" role="dialog" aria-labelledby="NoCPYesCPModalTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="NoCPYesCPModalLongTitle">Changepoints Selected</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
	      There are selected changepoints, please click the Reset button before clicking the "No Changepoints" button.
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>

<h3>Selected Changepoints</h3>
<div id="changepoint-table">
	<table id="cp-table" class="table table-striped">
	</table>
</div>

{# Based on: https://github.com/benalexkeen/d3-flask-blog-post/blob/master/templates/index.html #}
{# And: https://bl.ocks.org/mbostock/35964711079355050ff1 #}
<script src="//d3js.org/d3.v5.min.js"></script>
<script src="{{ url_for('static', filename='js/makeChart.js') }}"></script>
<script src="{{ url_for('static', filename='js/updateTable.js') }}"></script>
<script src="{{ url_for('static', filename='js/buttons.js') }}"></script>
<script>makeChart({{ data.chart_data | safe }});</script>
<script>
// reset button
var reset = document.getElementById("btn-reset");
reset.onclick = resetOnClick;
// no changepoint button
var nocp = document.getElementById("btn-none");
nocp.onclick = function() {
	noCPOnClick({{ task.id }});
};
// submit button
var submit = document.getElementById("btn-submit");
submit.onclick = function() {
	submitOnClick({{ task.id }});
};
</script>
{% endblock %}