From e67d39d44bdb7d582964cbd643098b38dddd9c94 Mon Sep 17 00:00:00 2001 From: Sonja Galovic Date: Wed, 18 May 2022 21:55:36 +0200 Subject: Radjeno na otvaranju prediktora na eksperiment strani njegovim izborom u kolekciji. Dodata ruta i fja - poziv beku za prediktor. --- .../app/_pages/experiment/experiment.component.ts | 44 ++++++++++++++++------ 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'frontend/src/app/_pages/experiment/experiment.component.ts') diff --git a/frontend/src/app/_pages/experiment/experiment.component.ts b/frontend/src/app/_pages/experiment/experiment.component.ts index 312b1af1..2d4c138d 100644 --- a/frontend/src/app/_pages/experiment/experiment.component.ts +++ b/frontend/src/app/_pages/experiment/experiment.component.ts @@ -14,6 +14,7 @@ import { SignalRService } from 'src/app/_services/signal-r.service'; import { MetricViewComponent } from 'src/app/_elements/metric-view/metric-view.component'; import { ActivatedRoute, Router } from '@angular/router'; import { DatasetsService } from 'src/app/_services/datasets.service'; +import { PredictorsService } from 'src/app/_services/predictors.service'; @Component({ selector: 'app-experiment', @@ -39,24 +40,45 @@ export class ExperimentComponent implements AfterViewInit, OnInit { step3: boolean = false; step4: boolean = false; - constructor(private experimentsService: ExperimentsService, private modelsService: ModelsService, private datasetsService: DatasetsService, private signalRService: SignalRService, private route: ActivatedRoute) { + constructor(private experimentsService: ExperimentsService, private modelsService: ModelsService, private datasetsService: DatasetsService, private predictorsService: PredictorsService, private signalRService: SignalRService, private route: ActivatedRoute) { this.experiment = new Experiment("exp1"); } ngOnInit(): void { this.route.queryParams.subscribe(params => { + let experimentId = this.route.snapshot.paramMap.get("id"); - if (experimentId == null) - return; - this.experimentsService.getExperimentById(experimentId).subscribe((response) => { - this.experiment = response; - this.datasetsService.getDatasetById(this.experiment.datasetId).subscribe((response: Dataset) => { - this.dataset = response; - - this.folderDataset.forExperiment = this.experiment; - this.folderDataset.selectFile(this.dataset); + let predictorId = this.route.snapshot.paramMap.get("predictorId"); + + if (predictorId != null && experimentId != null) { + this.experimentsService.getExperimentById(experimentId).subscribe((response) => { + this.experiment = response; + this.datasetsService.getDatasetById(this.experiment.datasetId).subscribe((response: Dataset) => { + this.dataset = response; + this.folderDataset.forExperiment = this.experiment; + this.folderDataset.selectFile(this.dataset); //sad 3. i 4. korak da se ucitaju + + this.predictorsService.getPredictor(predictorId!).subscribe((response) => { + let predictor = response; + this.modelsService.getModelById(predictor.modelId).subscribe((response) => { + //imamo model + this.folderModel.formModel.newModel = response; + }); + }); + }); }); - }); + } + else if (predictorId == null && experimentId != null) { + this.experimentsService.getExperimentById(experimentId).subscribe((response) => { + this.experiment = response; + this.datasetsService.getDatasetById(this.experiment.datasetId).subscribe((response: Dataset) => { + this.dataset = response; + this.folderDataset.forExperiment = this.experiment; + this.folderDataset.selectFile(this.dataset); + }); + }); + } + }); } -- cgit v1.2.3 From ef1e5b2a2cdd5680be8d9d1cea92c97c05da826d Mon Sep 17 00:00:00 2001 From: Sonja Galovic Date: Wed, 18 May 2022 23:42:15 +0200 Subject: Pristup eksperiment strani izabranim prediktorom. Preostalo testirati sa back-om. --- frontend/src/app/_elements/folder/folder.component.html | 2 +- frontend/src/app/_elements/folder/folder.component.ts | 10 ++++------ frontend/src/app/_pages/experiment/experiment.component.ts | 8 +++++--- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'frontend/src/app/_pages/experiment/experiment.component.ts') diff --git a/frontend/src/app/_elements/folder/folder.component.html b/frontend/src/app/_elements/folder/folder.component.html index da04b219..f7320264 100644 --- a/frontend/src/app/_elements/folder/folder.component.html +++ b/frontend/src/app/_elements/folder/folder.component.html @@ -87,7 +87,7 @@
-
+
diff --git a/frontend/src/app/_elements/folder/folder.component.ts b/frontend/src/app/_elements/folder/folder.component.ts index 262b3b7d..159bf959 100644 --- a/frontend/src/app/_elements/folder/folder.component.ts +++ b/frontend/src/app/_elements/folder/folder.component.ts @@ -106,7 +106,7 @@ export class FolderComponent implements AfterViewInit { this.selectedFile = file; this.fileToDisplay = file; if (this.type == FolderType.Experiment && file) { - this.router.navigate(['/experiment/', file._id]); + this.router.navigate(['/experiment/' + file._id]); } this.newFileSelected = false; this.listView = false; @@ -117,12 +117,10 @@ export class FolderComponent implements AfterViewInit { if (this.type == FolderType.Dataset) this.formDataset.loadExisting(); } - /* - goToExperimentPage(file: FolderFile) { - console.log(file); - //this.router.navigate(['/experiment/', this.experiment._id]); + + goToExperimentPageWithPredictor(file: FolderFile, predictor: Predictor) { + this.router.navigate(['/experiment/' + file._id + "/" + predictor._id]); } - */ createNewFile() { if (this.type == FolderType.Dataset) { diff --git a/frontend/src/app/_pages/experiment/experiment.component.ts b/frontend/src/app/_pages/experiment/experiment.component.ts index 2d4c138d..22894131 100644 --- a/frontend/src/app/_pages/experiment/experiment.component.ts +++ b/frontend/src/app/_pages/experiment/experiment.component.ts @@ -58,13 +58,15 @@ export class ExperimentComponent implements AfterViewInit, OnInit { this.folderDataset.forExperiment = this.experiment; this.folderDataset.selectFile(this.dataset); //sad 3. i 4. korak da se ucitaju - this.predictorsService.getPredictor(predictorId!).subscribe((response) => { + //this.predictorsService.getPredictor(predictorId!).subscribe((response) => { let predictor = response; - this.modelsService.getModelById(predictor.modelId).subscribe((response) => { + //this.modelsService.getModelById(predictor.modelId).subscribe((response) => { + this.modelsService.getModelById("62853d70696d62ceeb8db7cd").subscribe((response) => { //imamo model this.folderModel.formModel.newModel = response; + //this.metricView.update(predictor.metrics); }); - }); + //}); }); }); } -- cgit v1.2.3 From 84e02f0e7d895fe265be46e2f120076f92e3113f Mon Sep 17 00:00:00 2001 From: Sonja Galovic Date: Thu, 19 May 2022 14:01:06 +0200 Subject: Ispravljen bag kod steppera (nije se ucitavao 3. korak kad se udje na exp iz kolekcije) i bag za updatePieChart pri ucitavanju eskperiment strane. --- frontend/src/app/_elements/column-table/column-table.component.ts | 4 +--- frontend/src/app/_pages/experiment/experiment.component.ts | 2 +- frontend/src/app/app-routing.module.ts | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'frontend/src/app/_pages/experiment/experiment.component.ts') diff --git a/frontend/src/app/_elements/column-table/column-table.component.ts b/frontend/src/app/_elements/column-table/column-table.component.ts index ad78feaf..27bb608f 100644 --- a/frontend/src/app/_elements/column-table/column-table.component.ts +++ b/frontend/src/app/_elements/column-table/column-table.component.ts @@ -131,6 +131,7 @@ export class ColumnTableComponent implements AfterViewInit { } else { this.dataset = dataset; + this.experimentChanged.emit(); this.columnsChecked = []; this.dataset.columnInfo.forEach(column => { if (this.experiment.inputColumns.find(x => x == column.columnName) != undefined) @@ -157,9 +158,6 @@ export class ColumnTableComponent implements AfterViewInit { this.resetPagging(); this.loadData(); this.loaded = true; - - this.updateCharts(); - this.updatePieChart(); } loadData(){ diff --git a/frontend/src/app/_pages/experiment/experiment.component.ts b/frontend/src/app/_pages/experiment/experiment.component.ts index 22894131..6c8e96b3 100644 --- a/frontend/src/app/_pages/experiment/experiment.component.ts +++ b/frontend/src/app/_pages/experiment/experiment.component.ts @@ -57,7 +57,7 @@ export class ExperimentComponent implements AfterViewInit, OnInit { this.dataset = response; this.folderDataset.forExperiment = this.experiment; this.folderDataset.selectFile(this.dataset); //sad 3. i 4. korak da se ucitaju - + //this.predictorsService.getPredictor(predictorId!).subscribe((response) => { let predictor = response; //this.modelsService.getModelById(predictor.modelId).subscribe((response) => { diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 8c60a666..56442842 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -18,7 +18,8 @@ const routes: Routes = [ { path: 'archive', component: ArchiveComponent, data: { title: 'Arhiva' } }, { path: 'profile', component: ProfileComponent, canActivate: [AuthGuardService], data: { title: 'Profil' } }, { path: 'playground', component: PlaygroundComponent, data: { title: 'Zabava' } }, - { path: 'test', component: TestComponent, data: { title: 'Test' } } + { path: 'test', component: TestComponent, data: { title: 'Test' } }, + { path: '**', redirectTo: '' } ]; @NgModule({ -- cgit v1.2.3