Skip to content

Commit 6c76a41

Browse files
committed
Adds datepicker and improved graph/piechart
Adds ability to control time period shown on graph and pie chart in reporting tab. Preset range buttons have been included under two dropdown buttons, and it is possible to see the previous/next set range with the arrow buttons. Interactive legends have been added to both the datepicker and the piechart. Change-Id: Ieea8f22a5ac7e21996d4bd4223ea01694591bd72 Signed-off-by: Leonie Chamberlin-Medd <leonie@stackhpc.com>
1 parent d2c8505 commit 6c76a41

8 files changed

Lines changed: 668 additions & 80 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{% load i18n %}
2+
3+
{% block trimmed %}
4+
<div class="input-group date">
5+
{{ datepicker_input }}
6+
<label class="sr-only">{{ datepicker_label }}</label>
7+
<span class="input-group-addon datepicker-addon">
8+
<span class="fa fa-calendar"></span>
9+
</span>
10+
</div>
11+
<script>
12+
$(function () {
13+
$('.datepicker input').datepicker({
14+
todayBtn: "linked", // Enables the today button which quickly links back to today
15+
endDate: '0d', // Prevents the user from picking a date in the future
16+
});
17+
});
18+
</script>
19+
{% endblock %}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{% load i18n %}
2+
{%load static %}
3+
4+
<link rel="stylesheet" href="{% static 'cloudkitty/css/datepicker.css' %}">
5+
<script src="{% static 'cloudkitty/js/datepicker.js' %}" type="text/javascript" charset="utf-8"></script>
6+
7+
<form action="?" method="get" id="{{ datepicker_id }}" class="form-inline">
8+
<h4>{% trans "Select a period of time to view data in:" %}
9+
<span class="small help-block">{% trans "The date should be in YYYY-MM-DD format." %}</span>
10+
</h4>
11+
<div class="datepicker form-group">
12+
{% with datepicker_input=form.start datepicker_label="From" %}
13+
{% include 'project/reporting/_datepicker_reporting.html' %}
14+
{% endwith %}
15+
</div>
16+
<span class="datepicker-delimiter">
17+
<span class="datepicker-delimiter-text">{% trans 'to' %}</span>
18+
</span>
19+
<div class="datepicker form-group">
20+
{% with datepicker_input=form.end datepicker_label="To" %}
21+
{% include 'project/reporting/_datepicker_reporting.html' %}
22+
{% endwith %}
23+
</div>
24+
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
25+
</form>
26+
27+
<div class="controls-container">
28+
<div class="dropdown default-ranges">
29+
<button class="dropbtn">{% trans "Period Range" %}</button>
30+
<div class="dropdown-content">
31+
<button data-period="day" data-view="current">{% trans "Day View" %}</button>
32+
<button data-period="week" data-view="current">{% trans "Week View" %}</button>
33+
<button data-period="month" data-view="current">{% trans "Month View" %}</button>
34+
<button data-period="year" data-view="current">{% trans "Year View" %}</button>
35+
</div>
36+
</div>
37+
<div class="dropdown preset-ranges">
38+
<button class="dropbtn">{% trans "Preset Ranges" %}</button>
39+
<div class="dropdown-content">
40+
<button data-period="day" data-view="yesterday">{% trans "Yesterday" %}</button>
41+
<button data-period="week" data-view="last">{% trans "Last Week" %}</button>
42+
<button data-period="month" data-view="last">{% trans "Last Month" %}</button>
43+
<button data-period="month" data-view="last" data-amount="3">{% trans "Last 3 Months" %}</button>
44+
<button data-period="month" data-view="last" data-amount="6">{% trans "Last 6 Months" %}</button>
45+
<button data-period="year" data-view="last">{% trans "Last Year" %}</button>
46+
</div>
47+
</div>
48+
<button class="arrow-btn" data-direction="prev">&laquo;</button>
49+
<button class="arrow-btn" data-direction="next">&raquo;</button>
50+
</div>
51+
52+
53+
<script>
54+
$(function () {
55+
initDatepicker({
56+
formId: '{{ datepicker_id }}',
57+
startFieldName: '{{ form.start.name }}',
58+
endFieldName: '{{ form.end.name }}'
59+
});
60+
});
61+
</script>

0 commit comments

Comments
 (0)