replace startDate + dateRange with start and end date
The new datetimepicker can be used to specify date ranges. We no longer need to define a start date and a range. This simplifies the code for zooming and shifting considerably.
This commit is contained in:
@@ -150,8 +150,7 @@ public class PdbController implements HardcodedValues, PropertyKeys {
|
||||
@RequestParam(name = "groupBy[]", defaultValue = "") final List<String> aGroupBy,
|
||||
@RequestParam(name = "limitBy.number", defaultValue = "10") final int limit,
|
||||
@RequestParam(name = "limitBy.selected", defaultValue = "NO_LIMIT") final Limit limitBy,
|
||||
@RequestParam(name = "dateFrom", defaultValue = "") final String dateFrom,
|
||||
@RequestParam(name = "dateRange", defaultValue = "1 week") final String dateRange,
|
||||
@RequestParam(name = "dateRange") final String dateRange,
|
||||
@RequestParam(name = "axisScale", defaultValue = "LINEAR") final AxisScale axisScale,
|
||||
@RequestParam(name = "aggregate", defaultValue = "NONE") final Aggregate aggregate,
|
||||
@RequestParam(name = "keyOutside", defaultValue = "false") final boolean keyOutside,
|
||||
@@ -163,6 +162,10 @@ public class PdbController implements HardcodedValues, PropertyKeys {
|
||||
throw new BadRequest("The query must not be empty!");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(dateRange)) {
|
||||
throw new BadRequest("The parameter 'dateRange' must be set.");
|
||||
}
|
||||
|
||||
final PlotSettings plotSettings = new PlotSettings();
|
||||
plotSettings.setQuery(query);
|
||||
plotSettings.setGroupBy(aGroupBy);
|
||||
@@ -170,7 +173,6 @@ public class PdbController implements HardcodedValues, PropertyKeys {
|
||||
plotSettings.setWidth(hidth);
|
||||
plotSettings.setLimit(limit);
|
||||
plotSettings.setLimitBy(limitBy);
|
||||
plotSettings.setDateFrom(dateFrom);
|
||||
plotSettings.setDateRange(dateRange);
|
||||
plotSettings.setYAxisScale(axisScale);
|
||||
plotSettings.setAggregate(PlotSettingsTransformer.toAggregateInternal(aggregate));
|
||||
|
||||
@@ -21,7 +21,6 @@ class PlotSettingsTransformer {
|
||||
result.setWidth(request.getWidth());
|
||||
result.setLimit(request.getLimit());
|
||||
result.setLimitBy(request.getLimitBy());
|
||||
result.setDateFrom(request.getDateFrom());
|
||||
result.setDateRange(request.getDateRange());
|
||||
result.setYAxisScale(request.getAxisScale());
|
||||
result.setAggregate(toAggregateInternal(request.getAggregate()));
|
||||
|
||||
@@ -24,8 +24,6 @@ public class PlotRequest {
|
||||
|
||||
private int limit = Integer.MAX_VALUE;
|
||||
|
||||
private String dateFrom;
|
||||
|
||||
private String dateRange;
|
||||
|
||||
private Aggregate aggregate = Aggregate.NONE;
|
||||
@@ -107,22 +105,11 @@ public class PlotRequest {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public String getDateFrom() {
|
||||
return dateFrom;
|
||||
}
|
||||
|
||||
public void setDateFrom(final String dateFrom) {
|
||||
this.dateFrom = dateFrom;
|
||||
}
|
||||
|
||||
public String getDateRange() {
|
||||
return dateRange;
|
||||
}
|
||||
|
||||
public void setDateRange(final String dateRange) {
|
||||
if (!dateRange.matches("\\d+ (second|minute|hour|day|week|month)s?")) {
|
||||
throw new IllegalArgumentException(dateRange + " is not a valid range");
|
||||
}
|
||||
this.dateRange = dateRange;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user