add job service to be able to cancel plot requests
This commit is contained in:
@@ -54,6 +54,10 @@ export class VisualizationPageComponent implements OnInit {
|
||||
intervalValue = 1;
|
||||
renderBarChartTickLabels = false;
|
||||
|
||||
submitterId = crypto.randomUUID();
|
||||
|
||||
plotJobActive = false;
|
||||
|
||||
constructor(private plotService: PlotService, private snackBar: MatSnackBar) {
|
||||
}
|
||||
|
||||
@@ -103,10 +107,9 @@ export class VisualizationPageComponent implements OnInit {
|
||||
|
||||
gallery(){
|
||||
if (this.splitBy != null){
|
||||
const that = this;
|
||||
this.plotView.imageUrl = '';
|
||||
that.plotView.stats = null;
|
||||
that.galleryView.show=true;
|
||||
this.plotView.stats = null;
|
||||
this.galleryView.show=true;
|
||||
const request = this.createPlotRequest();
|
||||
this.galleryView.renderGallery(request, this.splitBy.name);
|
||||
} else {
|
||||
@@ -116,8 +119,8 @@ export class VisualizationPageComponent implements OnInit {
|
||||
|
||||
getAxes() : AxesTypes {
|
||||
|
||||
var x = new Array<DataType>();
|
||||
var y = new Array<DataType>();
|
||||
const x = new Array<DataType>();
|
||||
const y = new Array<DataType>();
|
||||
|
||||
for(var i = 0; i < this.selectedPlotType.length; i++){
|
||||
var plotType = this.selectedPlotType[i];
|
||||
@@ -131,12 +134,25 @@ export class VisualizationPageComponent implements OnInit {
|
||||
|
||||
return new AxesTypes(x,y);
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.plotService.abort(this.submitterId).subscribe({
|
||||
complete: () => {
|
||||
this.plotView.imageUrl = '';
|
||||
this.plotView.stats = null;
|
||||
this.plotJobActive = false;
|
||||
this.showError("Job aborted");
|
||||
document.dispatchEvent(new Event("invadersPause", {}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
plot(){
|
||||
const that = this;
|
||||
|
||||
that.plotView.imageUrl = '';
|
||||
that.plotView.stats = null;
|
||||
this.plotJobActive = true;
|
||||
this.plotView.axes = this.getAxes();
|
||||
console.log(JSON.stringify(this.getAxes()));
|
||||
that.galleryView.show=false;
|
||||
@@ -148,11 +164,14 @@ export class VisualizationPageComponent implements OnInit {
|
||||
next: (plotResponse: PlotResponse) => {
|
||||
this.plotView.imageUrl = "http://"+window.location.hostname+':'+window.location.port+'/'+plotResponse.imageUrl;
|
||||
this.plotView.stats = plotResponse.stats;
|
||||
this.plotJobActive = false;
|
||||
document.dispatchEvent(new Event("invadersPause", {}));
|
||||
},
|
||||
error: (error:any) => {
|
||||
console.log(JSON.stringify(error));
|
||||
this.plotView.imageUrl = '';
|
||||
this.plotView.stats = null;
|
||||
this.plotJobActive = false;
|
||||
this.showError(error.error.message);
|
||||
document.dispatchEvent(new Event("invadersPause", {}));
|
||||
}
|
||||
@@ -184,6 +203,7 @@ export class VisualizationPageComponent implements OnInit {
|
||||
this.enableGallery, // generateThumbnail
|
||||
this.intervalUnit,
|
||||
this.intervalValue,
|
||||
this.submitterId,
|
||||
this.renderBarChartTickLabels);
|
||||
return request;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user