adding a few filters (no doing anything yet)

This commit is contained in:
2019-10-09 19:02:34 +02:00
parent 1afcc7cf38
commit 2787b42c31
9 changed files with 154 additions and 7 deletions

View File

@@ -21,7 +21,8 @@ const routes: Routes = [
//{ enableTracing: true } // <-- debugging purposes only //{ enableTracing: true } // <-- debugging purposes only
) )
], ],
declarations: [VisualizationPageComponent], //declarations: [VisualizationPageComponent],
declarations: [],
exports: [RouterModule] exports: [RouterModule]
}) })
export class AppRoutingModule { } export class AppRoutingModule { }

View File

@@ -1,12 +1,17 @@
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { MainPageComponent } from './main-page/main-page.component'; import { MainPageComponent } from './main-page/main-page.component';
import { HelpPageComponent } from './help-page/help-page.component'; import { HelpPageComponent } from './help-page/help-page.component';
import { UploadPageComponent } from './upload-page/upload-page.component'; import { UploadPageComponent } from './upload-page/upload-page.component';
//import { VisualizationPageComponent } from './visualization-page/visualization-page.component'; import { VisualizationPageComponent } from './visualization-page/visualization-page.component';
import {MatSelectModule} from '@angular/material/select';
import {MatFormFieldModule, MatInputModule} from '@angular/material';
@NgModule({ @NgModule({
declarations: [ declarations: [
@@ -14,11 +19,14 @@ import { UploadPageComponent } from './upload-page/upload-page.component';
MainPageComponent, MainPageComponent,
HelpPageComponent, HelpPageComponent,
UploadPageComponent, UploadPageComponent,
//VisualizationPageComponent, VisualizationPageComponent,
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
AppRoutingModule AppRoutingModule,
MatSelectModule,MatFormFieldModule, MatInputModule,
BrowserAnimationsModule,
HttpClientModule
], ],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]

View File

@@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { PlotService } from './plot.service';
describe('PlotService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: PlotService = TestBed.get(PlotService);
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,63 @@
import { Injectable, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
@Injectable({
providedIn: 'root'
})
export class PlotService {
plotTypes: Array<PlotType>;
tagFields: Observable<TagField>;
constructor(private http: HttpClient) {
this.plotTypes = new Array<PlotType>();
this.plotTypes.push(new PlotType("Scatter"));
this.plotTypes.push(new PlotType("Cumulative Distribution"));
this.plotTypes.push(new PlotType("Parallel Requests"));
this.plotTypes.push(new PlotType("Parallel Requests"));
this.tagFields = new Array<TagField>();
}
ngOnInit() {
}
getPlotTypes(): Array<PlotType> {
return this.plotTypes;
}
getTagFields(): Observable<TagField> {
const that = this;
this.http.get('//localhost:8080/fields').subscribe(data => {
data.forEach(function(name) {
that.tagFields.push(new TagField(name));
});
});
return this.tagFields;
}
}
export class PlotType {
name: string;
constructor(name: string) {
this.name = name;
}
}
export class TagField {
name: string;
constructor(name: string) {
this.name = name;
}
}

View File

@@ -4,7 +4,47 @@
<div id="visualization"> <div id="visualization">
<div id="filters"> <div id="filters">
filters
<mat-form-field>
<mat-label>Type:</mat-label>
<mat-select [(value)]="selectedPlotType">
<mat-option *ngFor="let plotType of plotTypes" [value]="plotType.name">
{{plotType.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Combine with:</mat-label>
<mat-select [(value)]="selectedCombinePlotType">
<mat-option>-</mat-option>
<mat-option *ngFor="let plotType of combinePlotTypes" [value]="plotType.name">
{{plotType.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<textarea matInput placeholder="Query"></textarea>
</mat-form-field>
<mat-form-field>
<mat-label>Group By:</mat-label>
<mat-select multiple>
<mat-option *ngFor="let tagField of tagFields" [value]="tagField">{{tagField.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Split By:</mat-label>
<mat-select>
<mat-option *ngFor="let tagField of tagFields" [value]="tagField">{{tagField.name}}</mat-option>
</mat-select>
</mat-form-field>
</div> </div>
<div id="results"></div> <div id="results"></div>
</div> </div>

View File

@@ -32,6 +32,7 @@
#filters { #filters {
grid-area: filters; grid-area: filters;
background-color: #eee; background-color: #eee;
padding-left: 1em;
} }
#results { #results {

View File

@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { PlotService, PlotType } from '../plot.service';
@Component({ @Component({
selector: 'pdb-visualization-page', selector: 'pdb-visualization-page',
@@ -7,9 +8,25 @@ import { Component, OnInit } from '@angular/core';
}) })
export class VisualizationPageComponent implements OnInit { export class VisualizationPageComponent implements OnInit {
constructor() { } selectedPlotType: string;
plotTypes: Array<any>;
selectedCombinePlotType: string;
combinePlotTypes: Array<any>;
tagFields: Array<any>;
constructor(private plotService: PlotService) {
}
ngOnInit() { ngOnInit() {
this.plotTypes = this.plotService.getPlotTypes();
this.selectedPlotType = this.plotTypes[0].name;
this.combinePlotTypes = this.plotTypes;
this.tagFields = this.plotService.getTagFields();
} }
} }

View File

@@ -20,6 +20,9 @@ grey
$background-color: #CBD7F4; $background-color: #CBD7F4;
@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
body { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
font-size: 14px; font-size: 14px;

View File

@@ -44,6 +44,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.util.StreamUtils; import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@@ -60,6 +61,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Controller @Controller
@EnableAutoConfiguration @EnableAutoConfiguration
@CrossOrigin(origins = "http://localhost:4200")
public class PdbController implements HardcodedValues, PropertyKeys { public class PdbController implements HardcodedValues, PropertyKeys {
private static final Logger LOGGER = LoggerFactory.getLogger(PdbController.class); private static final Logger LOGGER = LoggerFactory.getLogger(PdbController.class);
@@ -231,7 +233,7 @@ public class PdbController implements HardcodedValues, PropertyKeys {
@RequestMapping(path = "/fields", // @RequestMapping(path = "/fields", //
method = RequestMethod.GET, // method = RequestMethod.GET, //
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, // //consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, //
produces = MediaType.APPLICATION_JSON_UTF8_VALUE // produces = MediaType.APPLICATION_JSON_UTF8_VALUE //
) )
@ResponseBody @ResponseBody