add dashboard

This commit is contained in:
2018-04-27 19:36:31 +02:00
parent 38ffff38de
commit 913057c6df
11 changed files with 304 additions and 60 deletions

View File

@@ -101,7 +101,11 @@ public class PdbController implements HardcodedValues {
final String imageUrl = WEB_IMAGE_OUTPUT_PATH + "/" + result.getImageName();
LOGGER.trace("image url: {}", imageUrl);
return new PlotResponse(DataSeries.toMap(result.getDataSeries()), imageUrl);
final String thumbnailUrl = result.getThumbnailPath() != null
? WEB_IMAGE_OUTPUT_PATH + "/" + result.getThumbnailName()
: imageUrl;
return new PlotResponse(DataSeries.toMap(result.getDataSeries()), imageUrl, thumbnailUrl);
} catch (final NoDataPointsException e) {
throw new NotFoundException(e);
} finally {
@@ -127,8 +131,8 @@ public class PdbController implements HardcodedValues {
@RequestParam(name = "plotType", defaultValue = "SCATTER") final PlotType plotType,
@RequestParam(name = "aggregate", defaultValue = "NONE") final Aggregate aggregate,
@RequestParam(name = "keyOutside", defaultValue = "false") final boolean keyOutside,
@RequestParam(name = "height", defaultValue = "1080") final int height,
@RequestParam(name = "width", defaultValue = "1920") final int hidth) {
@RequestParam(name = "width", defaultValue = "1920") final int hidth,
@RequestParam(name = "height", defaultValue = "1080") final int height) {
return (final OutputStream outputStream) -> {
if (StringUtils.isBlank(query)) {

View File

@@ -24,6 +24,8 @@ class PlotSettingsTransformer {
result.setPlotType(request.getPlotType());
result.setAggregate(toAggregateInternal(request.getAggregate()));
result.setKeyOutside(request.isKeyOutside());
result.setThumbnailMaxWidth(request.getThumbnailMaxWidth());
result.setThumbnailMaxHeight(request.getThumbnailMaxHeight());
return result;
}

View File

@@ -13,6 +13,10 @@ public class PlotRequest {
private int width = 1000;
private int thumbnailMaxWidth = 0;
private int thumbnailMaxHeight = 0;
private List<String> groupBy;
private Limit limitBy = Limit.NO_LIMIT;
@@ -24,9 +28,9 @@ public class PlotRequest {
private String dateFrom;
private String dateRange;
private PlotType plotType = PlotType.SCATTER;
private Aggregate aggregate = Aggregate.NONE;
private boolean keyOutside;
@@ -55,6 +59,22 @@ public class PlotRequest {
this.height = height;
}
public int getThumbnailMaxWidth() {
return thumbnailMaxWidth;
}
public void setThumbnailMaxWidth(final int thumbnailMaxWidth) {
this.thumbnailMaxWidth = thumbnailMaxWidth;
}
public int getThumbnailMaxHeight() {
return thumbnailMaxHeight;
}
public void setThumbnailMaxHeight(final int thumbnailMaxHeight) {
this.thumbnailMaxHeight = thumbnailMaxHeight;
}
@Override
public String toString() {
return query + ":" + height + "x" + width;
@@ -110,27 +130,27 @@ public class PlotRequest {
public void setAxisScale(final AxisScale yAxis) {
this.yAxis = yAxis;
}
public PlotType getPlotType() {
return plotType;
}
public void setPlotType(PlotType plotType) {
public void setPlotType(final PlotType plotType) {
this.plotType = plotType;
}
public void setAggregate(Aggregate aggregate) {
public void setAggregate(final Aggregate aggregate) {
this.aggregate = aggregate;
}
public Aggregate getAggregate() {
return aggregate;
}
public void setKeyOutside(boolean keyOutside) {
public void setKeyOutside(final boolean keyOutside) {
this.keyOutside = keyOutside;
}
public boolean isKeyOutside() {
return keyOutside;
}

View File

@@ -5,10 +5,12 @@ import java.util.Map;
public class PlotResponse {
private String imageUrl = "";
private Map<String, Integer> dataSeries;
private final String thumbnailUrl;
public PlotResponse(final Map<String, Integer> dataSeries, final String imageUrl) {
public PlotResponse(final Map<String, Integer> dataSeries, final String imageUrl, final String thumbnailUrl) {
this.dataSeries = dataSeries;
this.imageUrl = imageUrl;
this.thumbnailUrl = thumbnailUrl;
}
public String getImageUrl() {
@@ -19,6 +21,10 @@ public class PlotResponse {
this.imageUrl = imageUrl;
}
public String getThumbnailUrl() {
return thumbnailUrl;
}
public Map<String, Integer> getDataSeries() {
return dataSeries;
}
@@ -29,6 +35,6 @@ public class PlotResponse {
@Override
public String toString() {
return imageUrl + " " + dataSeries;
return imageUrl + " " + dataSeries + " " + thumbnailUrl;
}
}