diff options
Diffstat (limited to 'frontend/src/app/_elements/column-table')
-rw-r--r-- | frontend/src/app/_elements/column-table/column-table.component.html | 4 | ||||
-rw-r--r-- | frontend/src/app/_elements/column-table/column-table.component.ts | 66 |
2 files changed, 48 insertions, 22 deletions
diff --git a/frontend/src/app/_elements/column-table/column-table.component.html b/frontend/src/app/_elements/column-table/column-table.component.html index 8a4164f1..31c32dfd 100644 --- a/frontend/src/app/_elements/column-table/column-table.component.html +++ b/frontend/src/app/_elements/column-table/column-table.component.html @@ -45,10 +45,10 @@ </tbody> </table> <div class="mb-3"> - <button mat-button (click)="goBack()"><mat-icon>keyboard_arrow_left</mat-icon></button> + <button mat-button (click)="goBack()"><mat-icon>keyboard_arrow_left</mat-icon></button> <div style="display: inline;">{{(this.begin/10)+1}}...{{getPage()}}</div> <button mat-button (click)="goForward()"><mat-icon>keyboard_arrow_right</mat-icon></button> - + </div> </div> 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 ed2f0380..9fdb6936 100644 --- a/frontend/src/app/_elements/column-table/column-table.component.ts +++ b/frontend/src/app/_elements/column-table/column-table.component.ts @@ -14,6 +14,7 @@ import { AlertDialogComponent } from 'src/app/_modals/alert-dialog/alert-dialog. import Shared from 'src/app/Shared'; import { PieChartComponent } from '../_charts/pie-chart/pie-chart.component'; import { BoxPlotComponent } from '../_charts/box-plot/box-plot.component'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-column-table', @@ -41,14 +42,12 @@ export class ColumnTableComponent implements AfterViewInit { columnsChecked: boolean[] = []; //niz svih kolona loaded: boolean = false; - begin:number=0; step:number=10; - constructor(private datasetService: DatasetsService, private experimentService: ExperimentsService, public csvParseService: CsvParseService, public dialog: MatDialog) { - //ovo mi nece trebati jer primam dataset iz druge komponente + constructor(private datasetService: DatasetsService, private experimentService: ExperimentsService, public csvParseService: CsvParseService, public dialog: MatDialog, private route: ActivatedRoute) { } resetPagging(){ this.begin=0; @@ -107,22 +106,51 @@ export class ColumnTableComponent implements AfterViewInit { loadDataset(dataset: Dataset) { console.log("LOADED DATASET"); - this.dataset = dataset; - this.setColumnTypeInitial(); - - this.dataset.columnInfo.forEach(column => { - this.columnsChecked.push(true); - }); - - this.resetInputColumns(); - this.resetOutputColumn(); - this.resetColumnEncodings(Encoding.Label); - this.setDeleteRowsForMissingValTreatment(); - this.nullValOption = []; - this.dataset.columnInfo.forEach(colInfo => { - this.nullValOption.push(`Obriši redove (${colInfo.numNulls})`); - }); + if (this.route.snapshot.paramMap.get("id") == null) { + this.dataset = dataset; + this.setColumnTypeInitial(); + + this.columnsChecked = []; + this.dataset.columnInfo.forEach(column => { + this.columnsChecked.push(true); + }); + + this.resetInputColumns(); + this.resetOutputColumn(); + this.resetColumnEncodings(Encoding.Label); + this.setDeleteRowsForMissingValTreatment(); + + this.nullValOption = []; + this.dataset.columnInfo.forEach(colInfo => { + this.nullValOption.push(`Obriši redove (${colInfo.numNulls})`); + }); + } + else { + this.dataset = dataset; + this.columnsChecked = []; + this.dataset.columnInfo.forEach(column => { + if (this.experiment.inputColumns.find(x => x == column.columnName) != undefined) + this.columnsChecked.push(true); + else + this.columnsChecked.push(false); + }); + this.nullValOption = []; + for (let i = 0; i < this.dataset!.columnInfo.length; i++) { + let nullValRep = this.experiment.nullValuesReplacers.find(x => x.column == this.dataset!.columnInfo[i].columnName); + if (nullValRep != undefined) { + if (nullValRep.option == NullValueOptions.DeleteRows) + this.nullValOption.push(`Obriši redove (${this.dataset.columnInfo[i].numNulls})`); + else if (nullValRep.option == NullValueOptions.DeleteColumns) + this.nullValOption.push(`Obriši kolonu`); + else { + this.nullValOption.push(`Popuni sa ${nullValRep.value}`); + } + } + else + this.nullValOption.push(`Obriši redove (${this.dataset.columnInfo[i].numNulls})`); + } + } this.resetPagging(); this.loadData(); this.loaded = true; @@ -141,8 +169,6 @@ export class ColumnTableComponent implements AfterViewInit { } ngAfterViewInit(): void { - console.log(this.dataset?.columnInfo); - } setColumnTypeInitial() { |