add date range filter
This commit is contained in:
@@ -94,10 +94,10 @@ public class PdbController implements HardcodedValues, CollectionUtils {
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE //
|
||||
)
|
||||
@ResponseBody
|
||||
List<String> fields(@RequestParam(name = "query") final String query) {
|
||||
List<String> fields() {
|
||||
|
||||
try {
|
||||
final List<String> fields = db.getDb().getFields(query);
|
||||
final List<String> fields = db.getDb().getFields();
|
||||
|
||||
return fields;
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ class PlotSettingsTransformer {
|
||||
result.setWidth(request.getWidth());
|
||||
result.setLimit(request.getLimit());
|
||||
result.setLimitBy(toLimit(request.getLimitBy()));
|
||||
result.setDateFrom(request.getDateFrom());
|
||||
result.setDateTo(request.getDateTo());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,10 @@ public class PlotRequest {
|
||||
|
||||
private int limit = Integer.MAX_VALUE;
|
||||
|
||||
private String dateFrom;
|
||||
|
||||
private String dateTo;
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
@@ -65,4 +69,20 @@ public class PlotRequest {
|
||||
public void setLimit(final int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public String getDateFrom() {
|
||||
return dateFrom;
|
||||
}
|
||||
|
||||
public void setDateFrom(final String dateFrom) {
|
||||
this.dateFrom = dateFrom;
|
||||
}
|
||||
|
||||
public String getDateTo() {
|
||||
return dateTo;
|
||||
}
|
||||
|
||||
public void setDateTo(final String dateTo) {
|
||||
this.dateTo = dateTo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,10 +45,14 @@ html, body {
|
||||
background-color: #AAA;
|
||||
}
|
||||
|
||||
#search-bar .autocomplete, #search-bar .autocomplete ul {
|
||||
#search-bar .autocomplete {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#search-bar #search-input {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#filter-bar {
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,13 @@
|
||||
<option value="FEWEST_VALUES">fewest values</option>
|
||||
</select>
|
||||
<input type="number" id="search-limit-value" name="search-limit-value" min="1" max="1000000" value="10" style="display: none;"/>
|
||||
|
||||
<label>From Date:</label>
|
||||
<input id="search-date-from" type="date">
|
||||
|
||||
<label>To Date:</label>
|
||||
<input id="search-date-to" type="date">
|
||||
|
||||
<button id="search-submit"><i class="fa fa-area-chart"> Plot</i></button>
|
||||
</div>
|
||||
<div id="result-view">
|
||||
|
||||
@@ -3,12 +3,12 @@ $(document).ready(function(){
|
||||
|
||||
$('#search-submit').click(plot);
|
||||
|
||||
renderFields();
|
||||
renderGroupBy();
|
||||
|
||||
$('#search-limit-by').change(function () {
|
||||
var optionSelected = $(this).find("option:selected");
|
||||
var valueSelected = optionSelected.val();
|
||||
console.log(valueSelected);
|
||||
|
||||
if (valueSelected == "NO_LIMIT"){
|
||||
$('#search-limit-value').hide();
|
||||
}else{
|
||||
@@ -23,6 +23,9 @@ $(document).ready(function(){
|
||||
var caretIndex = document.getElementById('search-input').selectionStart;
|
||||
return 'caretIndex=' + caretIndex + '&query';
|
||||
},
|
||||
_Pre: function() {
|
||||
return encodeURI(this.Input.value);
|
||||
},
|
||||
_Post: function(response) {
|
||||
var result = [];
|
||||
var responseObject = JSON.parse(response);
|
||||
@@ -40,10 +43,9 @@ $(document).ready(function(){
|
||||
});
|
||||
});
|
||||
|
||||
function renderFields()
|
||||
function renderGroupBy()
|
||||
{
|
||||
var request = {};
|
||||
request['query'] = $('#search-input').val();
|
||||
|
||||
var success = function(response){
|
||||
|
||||
@@ -85,6 +87,8 @@ function plot(event){
|
||||
request['groupBy'] = $('#search-group-by').val();
|
||||
request['limitBy'] = $('#search-limit-by').val();
|
||||
request['limit'] = parseInt($('#search-limit-value').val());
|
||||
request['dateFrom'] = $('#search-date-from').val();
|
||||
request['dateTo'] = $('#search-date-to').val();
|
||||
|
||||
|
||||
var success = function(response){
|
||||
|
||||
Reference in New Issue
Block a user