Skip to content

Commit 7821e5d

Browse files
committed
Merge pull request #831 from apinf/feature/676-reset-all-filter
'Reset all' in 'Filter' not working, closes #676
2 parents 1751651 + 6dffb99 commit 7821e5d

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

client/views/dashboard/charts/charts.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ Template.chartsLayout.created = function () {
176176
var overviewChart = dc.barChart("#overview-chart");
177177
var moveChart = dc.barChart("#move-chart");
178178

179-
180179
overviewChart
181180
.height(80)
182181
.dimension(timeStampDimension)

client/views/dashboard/charts/filter/filter.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ <h3 class="box-title">{{_ "filterData_Title"}}</h3>
77
<div class="box-body">
88
<form id="filteringForm">
99
{{_ "filterData_Month"}}
10-
<select name="month" >
10+
<select id="filter-month" name="month" >
1111
<option value="00">-</option>
1212
<option value="01">{{_ "filterData_January"}}</option>
1313
<option value="02">{{_ "filterData_February"}}</option>
@@ -23,19 +23,19 @@ <h3 class="box-title">{{_ "filterData_Title"}}</h3>
2323
<option value="12">{{_ "filterData_December"}}</option>
2424
</select>
2525
{{_ "filterData_Year"}}
26-
<select name="year">
26+
<select id="filter-year" name="year">
2727
<option value="0000">-</option>
2828
<option value="2014">2014</option>
2929
<option value="2015">2015</option>
3030
<option value="2016">2016</option>
3131
</select>
3232
{{_ "filterData_Limit"}}
33-
<input name="limit" type="text" value="10000" />
33+
<input id="filter-limit" name="limit" type="text" value="10000" />
3434

3535
<span class="dc-data-count dc-chart" id="row-selection" style="margin:0">
3636
<span class="filter-count">_</span> {{_ "filterData_SelectedOf"}} <span class="total-count">_</span> {{_ "filterData_Records"}}
3737
<span>
38-
<a href='javascript:dc.filterAll();dc.redrawAll();'>{{_ "filterData_Reset"}}</a>
38+
<a id="filter-reset" href="#">{{_ "filterData_Reset"}}</a>
3939
</span>
4040
</span>
4141
<span id="loadingState">

client/views/dashboard/charts/filter/filter.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,39 @@ Template.chartsLayout.events({
3636

3737
instance.getDashboardData(input)
3838

39+
},
40+
"click #filter-reset": function(event, template){
41+
// appending loading state
42+
$('#loadingState').html("Loading...");
43+
44+
// gets current month and year -> providing them for initial query
45+
var currentYearAndMonth = moment().format("YYYY-MM");
46+
47+
// sets default items amount to be returned
48+
var initialLimit = 10000;
49+
50+
// Initialize filter values
51+
$('#filter-month').val(undefined);
52+
$('#filter-year').val(undefined);
53+
$('#filter-limit').val( initialLimit.toString() );
54+
55+
// sets query for elastic search
56+
var input = {
57+
index : "api-umbrella-logs-v1-"+currentYearAndMonth,
58+
type : "log",
59+
limit : initialLimit,
60+
fields: [
61+
'request_at',
62+
'request_ip_country',
63+
'request_ip',
64+
'response_time',
65+
'request_path',
66+
'request_ip_location.lon',
67+
'request_ip_location.lat'
68+
]
69+
};
70+
71+
// get data
72+
template.getDashboardData(input);
3973
}
4074
});

0 commit comments

Comments
 (0)