dashboard #1
@@ -244,7 +244,7 @@ export class GalleryViewComponent implements OnInit {
|
||||
|
||||
request.generateThumbnail = true;
|
||||
|
||||
this.plotService.splitQuery(request.query, splitByField).subscribe({
|
||||
this.plotService.splitQuery(request.config.query, splitByField).subscribe({
|
||||
next: function(valuesForSplitBy){
|
||||
console.log("valuesForSplitBy: " + JSON.stringify(valuesForSplitBy));
|
||||
that.splitByValuesQueue = valuesForSplitBy;
|
||||
@@ -269,7 +269,7 @@ export class GalleryViewComponent implements OnInit {
|
||||
const splitByValue = <string>this.splitByValuesQueue.pop();
|
||||
|
||||
let request = masterRequest.copy();
|
||||
request.query = "("+request.query+") and " + splitByField+"="+ splitByValue;
|
||||
request.config.query = "("+request.config.query+") and " + splitByField+"="+ splitByValue;
|
||||
|
||||
const expectedSequenceId = ++this.sequenceId;
|
||||
|
||||
|
||||
@@ -207,11 +207,24 @@ export class AutocompleteResult{
|
||||
|
||||
export class PlotRequest {
|
||||
constructor(
|
||||
public query : string,
|
||||
public height : number,
|
||||
public width : number,
|
||||
public thumbnailMaxWidth : number = 300,
|
||||
public thumbnailMaxHeight : number = 200,
|
||||
public keyOutside : boolean = false,
|
||||
public generateThumbnail : boolean,
|
||||
public submitterId: string,
|
||||
public config: PlotConfig
|
||||
){}
|
||||
|
||||
|
||||
copy(): PlotRequest {
|
||||
return JSON.parse(JSON.stringify(this));
|
||||
}
|
||||
}
|
||||
|
||||
export class PlotConfig {
|
||||
constructor( public query : string,
|
||||
public groupBy : Array<string>,
|
||||
public limitBy : string,
|
||||
public limit : number,
|
||||
@@ -219,16 +232,9 @@ export class PlotRequest {
|
||||
public y2:YAxisDefinition|undefined,
|
||||
public dateRange : string,
|
||||
public aggregates : Array<string>,
|
||||
public keyOutside : boolean = false,
|
||||
public generateThumbnail : boolean,
|
||||
public intervalUnit: string,
|
||||
public intervalValue: number,
|
||||
public submitterId: string,
|
||||
public renderBarChartTickLabels: boolean = false){}
|
||||
|
||||
copy(): PlotRequest {
|
||||
return JSON.parse(JSON.stringify(this));
|
||||
}
|
||||
public renderBarChartTickLabels: boolean = false,) {}
|
||||
}
|
||||
|
||||
export class YAxisDefinition {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { PlotService, PlotType, PlotRequest, PlotResponse, TagField, FilterDefaults, DataType, YAxisDefinition, AxesTypes } from '../plot.service';
|
||||
import { PlotService, PlotType, PlotRequest, PlotResponse, TagField, FilterDefaults, DataType, YAxisDefinition, AxesTypes, PlotConfig } from '../plot.service';
|
||||
import { UntypedFormControl, Validators } from '@angular/forms';
|
||||
import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar';
|
||||
import { LimitByComponent } from '../limit-by/limit-by.component';
|
||||
@@ -189,12 +189,8 @@ export class VisualizationPageComponent implements OnInit {
|
||||
const y2 = this.y2AxisDefinitionComponent ? this.y2AxisDefinitionComponent.getAxisDefinition() : undefined;
|
||||
const results = document.getElementById("results");
|
||||
|
||||
const request = new PlotRequest(
|
||||
const config = new PlotConfig(
|
||||
this.query.query,
|
||||
results != null ? results.offsetHeight-1: 1024,
|
||||
results != null ? results.offsetWidth-1 : 1024,
|
||||
300, // thumbnailMaxWidth
|
||||
200, // thumbnailMaxHeight
|
||||
this.groupBy.map(o => o.name),
|
||||
this.limitbycomponent.limitBy,
|
||||
this.limitbycomponent.limit,
|
||||
@@ -202,12 +198,20 @@ export class VisualizationPageComponent implements OnInit {
|
||||
y2,
|
||||
this.dateRangeAsString(), // dateRange
|
||||
aggregates, // aggregates
|
||||
false, // keyOutside
|
||||
this.enableGallery, // generateThumbnail
|
||||
this.intervalUnit,
|
||||
this.intervalValue,
|
||||
this.renderBarChartTickLabels,
|
||||
);
|
||||
|
||||
const request = new PlotRequest(
|
||||
results != null ? results.offsetHeight-1: 1024,
|
||||
results != null ? results.offsetWidth-1 : 1024,
|
||||
300, // thumbnailMaxWidth
|
||||
200, // thumbnailMaxHeight
|
||||
false, // keyOutside
|
||||
this.enableGallery, // generateThumbnail
|
||||
this.submitterId,
|
||||
this.renderBarChartTickLabels);
|
||||
config);
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,30 +13,31 @@ import org.lucares.pdb.plot.api.ParallelRequestsAggregate;
|
||||
import org.lucares.pdb.plot.api.PlotSettings;
|
||||
import org.lucares.pdb.plot.api.ScatterAggregateHandler;
|
||||
import org.lucares.pdb.plot.api.YAxisDefinition;
|
||||
import org.lucares.pdbui.domain.PlotConfig;
|
||||
import org.lucares.pdbui.domain.PlotRequest;
|
||||
|
||||
class PlotSettingsTransformer {
|
||||
static PlotSettings toSettings(final PlotRequest request) {
|
||||
|
||||
final PlotSettings result = new PlotSettings();
|
||||
|
||||
result.setQuery(request.getQuery());
|
||||
result.setGroupBy(request.getGroupBy());
|
||||
final PlotConfig config = request.getConfig();
|
||||
result.setQuery(config.getQuery());
|
||||
result.setGroupBy(config.getGroupBy());
|
||||
result.setHeight(request.getHeight());
|
||||
result.setWidth(request.getWidth());
|
||||
result.setLimit(request.getLimit());
|
||||
result.setLimitBy(request.getLimitBy());
|
||||
result.setDateRange(request.getDateRange());
|
||||
result.setLimit(config.getLimit());
|
||||
result.setLimitBy(config.getLimitBy());
|
||||
result.setDateRange(config.getDateRange());
|
||||
|
||||
result.setKeyOutside(request.isKeyOutside());
|
||||
result.setThumbnailMaxWidth(request.getThumbnailMaxWidth());
|
||||
result.setThumbnailMaxHeight(request.getThumbnailMaxHeight());
|
||||
result.setGenerateThumbnail(request.isGenerateThumbnail());
|
||||
result.setY1(request.getY1());
|
||||
result.setY2(request.getY2());
|
||||
result.setAggregates(toAggregateInternal(request.getY1(), request.getY2(), request.getAggregates()));
|
||||
result.setInterval(Interval.create(request.getIntervalUnit(), request.getIntervalValue(), result.dateRange()));
|
||||
result.setRenderBarChartTickLabels(request.isRenderBarChartTickLabels());
|
||||
result.setY1(config.getY1());
|
||||
result.setY2(config.getY2());
|
||||
result.setAggregates(toAggregateInternal(config.getY1(), config.getY2(), config.getAggregates()));
|
||||
result.setInterval(Interval.create(config.getIntervalUnit(), config.getIntervalValue(), result.dateRange()));
|
||||
result.setRenderBarChartTickLabels(config.isRenderBarChartTickLabels());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
124
pdb-ui/src/main/java/org/lucares/pdbui/domain/PlotConfig.java
Normal file
124
pdb-ui/src/main/java/org/lucares/pdbui/domain/PlotConfig.java
Normal file
@@ -0,0 +1,124 @@
|
||||
package org.lucares.pdbui.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lucares.pdb.plot.api.Aggregate;
|
||||
import org.lucares.pdb.plot.api.Limit;
|
||||
import org.lucares.pdb.plot.api.YAxisDefinition;
|
||||
|
||||
/**
|
||||
* The user defined settings of a plot. Contains everything the user cares
|
||||
* about, but nothing else. Contains: query, selected plot types, axis
|
||||
* definition, ... Does not contain: plot size, thumbnail size, job submitter
|
||||
* id, ...
|
||||
*/
|
||||
public class PlotConfig {
|
||||
|
||||
private String query;
|
||||
private List<String> groupBy;
|
||||
|
||||
private Limit limitBy = Limit.NO_LIMIT;
|
||||
|
||||
private int limit = Integer.MAX_VALUE;
|
||||
|
||||
private YAxisDefinition y1 = new YAxisDefinition();
|
||||
private YAxisDefinition y2 = new YAxisDefinition();
|
||||
|
||||
private String dateRange;
|
||||
|
||||
private List<Aggregate> aggregates = new ArrayList<>();
|
||||
|
||||
private String intervalUnit;
|
||||
private int intervalValue;
|
||||
|
||||
private boolean renderBarChartTickLabels;
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(final String query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public List<String> getGroupBy() {
|
||||
return groupBy;
|
||||
}
|
||||
|
||||
public void setGroupBy(final List<String> groupBy) {
|
||||
this.groupBy = groupBy;
|
||||
}
|
||||
|
||||
public Limit getLimitBy() {
|
||||
return limitBy;
|
||||
}
|
||||
|
||||
public void setLimitBy(final Limit limitBy) {
|
||||
this.limitBy = limitBy;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(final int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public String getDateRange() {
|
||||
return dateRange;
|
||||
}
|
||||
|
||||
public void setDateRange(final String dateRange) {
|
||||
this.dateRange = dateRange;
|
||||
}
|
||||
|
||||
public void setAggregate(final List<Aggregate> aggregates) {
|
||||
this.aggregates = aggregates;
|
||||
}
|
||||
|
||||
public List<Aggregate> getAggregates() {
|
||||
return aggregates;
|
||||
}
|
||||
|
||||
public YAxisDefinition getY1() {
|
||||
return y1;
|
||||
}
|
||||
|
||||
public void setY1(final YAxisDefinition y1) {
|
||||
this.y1 = y1;
|
||||
}
|
||||
|
||||
public YAxisDefinition getY2() {
|
||||
return y2;
|
||||
}
|
||||
|
||||
public void setY2(final YAxisDefinition y2) {
|
||||
this.y2 = y2;
|
||||
}
|
||||
|
||||
public String getIntervalUnit() {
|
||||
return intervalUnit;
|
||||
}
|
||||
|
||||
public void setIntervalUnit(final String intervalUnit) {
|
||||
this.intervalUnit = intervalUnit;
|
||||
}
|
||||
|
||||
public int getIntervalValue() {
|
||||
return intervalValue;
|
||||
}
|
||||
|
||||
public void setIntervalValue(final int intervalValue) {
|
||||
this.intervalValue = intervalValue;
|
||||
}
|
||||
|
||||
public boolean isRenderBarChartTickLabels() {
|
||||
return renderBarChartTickLabels;
|
||||
}
|
||||
|
||||
public void setRenderBarChartTickLabels(final boolean renderBarChartTickLabels) {
|
||||
this.renderBarChartTickLabels = renderBarChartTickLabels;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,6 @@
|
||||
package org.lucares.pdbui.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lucares.pdb.plot.api.Aggregate;
|
||||
import org.lucares.pdb.plot.api.Limit;
|
||||
import org.lucares.pdb.plot.api.YAxisDefinition;
|
||||
|
||||
public class PlotRequest {
|
||||
private String query;
|
||||
|
||||
private int height = 1000;
|
||||
|
||||
@@ -18,35 +10,18 @@ public class PlotRequest {
|
||||
|
||||
private int thumbnailMaxHeight = 0;
|
||||
|
||||
private List<String> groupBy;
|
||||
|
||||
private Limit limitBy = Limit.NO_LIMIT;
|
||||
|
||||
private int limit = Integer.MAX_VALUE;
|
||||
|
||||
private YAxisDefinition y1 = new YAxisDefinition();
|
||||
private YAxisDefinition y2 = new YAxisDefinition();
|
||||
|
||||
private String dateRange;
|
||||
|
||||
private List<Aggregate> aggregates = new ArrayList<>();
|
||||
|
||||
private boolean keyOutside;
|
||||
|
||||
private boolean generateThumbnail;
|
||||
private String intervalUnit;
|
||||
private int intervalValue;
|
||||
|
||||
private boolean renderBarChartTickLabels;
|
||||
|
||||
private boolean keyOutside;
|
||||
private String submitterId;
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
private PlotConfig config;
|
||||
|
||||
public PlotConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public void setQuery(final String query) {
|
||||
this.query = query;
|
||||
public void setConfig(final PlotConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
@@ -81,51 +56,6 @@ public class PlotRequest {
|
||||
this.thumbnailMaxHeight = thumbnailMaxHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return query + ":" + height + "x" + width;
|
||||
}
|
||||
|
||||
public List<String> getGroupBy() {
|
||||
return groupBy;
|
||||
}
|
||||
|
||||
public void setGroupBy(final List<String> groupBy) {
|
||||
this.groupBy = groupBy;
|
||||
}
|
||||
|
||||
public Limit getLimitBy() {
|
||||
return limitBy;
|
||||
}
|
||||
|
||||
public void setLimitBy(final Limit limitBy) {
|
||||
this.limitBy = limitBy;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(final int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public String getDateRange() {
|
||||
return dateRange;
|
||||
}
|
||||
|
||||
public void setDateRange(final String dateRange) {
|
||||
this.dateRange = dateRange;
|
||||
}
|
||||
|
||||
public void setAggregate(final List<Aggregate> aggregates) {
|
||||
this.aggregates = aggregates;
|
||||
}
|
||||
|
||||
public List<Aggregate> getAggregates() {
|
||||
return aggregates;
|
||||
}
|
||||
|
||||
public void setKeyOutside(final boolean keyOutside) {
|
||||
this.keyOutside = keyOutside;
|
||||
}
|
||||
@@ -142,46 +72,6 @@ public class PlotRequest {
|
||||
this.generateThumbnail = generateThumbnail;
|
||||
}
|
||||
|
||||
public YAxisDefinition getY1() {
|
||||
return y1;
|
||||
}
|
||||
|
||||
public void setY1(final YAxisDefinition y1) {
|
||||
this.y1 = y1;
|
||||
}
|
||||
|
||||
public YAxisDefinition getY2() {
|
||||
return y2;
|
||||
}
|
||||
|
||||
public void setY2(final YAxisDefinition y2) {
|
||||
this.y2 = y2;
|
||||
}
|
||||
|
||||
public String getIntervalUnit() {
|
||||
return intervalUnit;
|
||||
}
|
||||
|
||||
public void setIntervalUnit(final String intervalUnit) {
|
||||
this.intervalUnit = intervalUnit;
|
||||
}
|
||||
|
||||
public int getIntervalValue() {
|
||||
return intervalValue;
|
||||
}
|
||||
|
||||
public void setIntervalValue(final int intervalValue) {
|
||||
this.intervalValue = intervalValue;
|
||||
}
|
||||
|
||||
public boolean isRenderBarChartTickLabels() {
|
||||
return renderBarChartTickLabels;
|
||||
}
|
||||
|
||||
public void setRenderBarChartTickLabels(final boolean renderBarChartTickLabels) {
|
||||
this.renderBarChartTickLabels = renderBarChartTickLabels;
|
||||
}
|
||||
|
||||
public String getSubmitterId() {
|
||||
return submitterId;
|
||||
}
|
||||
@@ -190,4 +80,9 @@ public class PlotRequest {
|
||||
this.submitterId = submitterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (config != null ? config.getQuery() : "<no query>") + ":" + height + "x" + width;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user