diff options
| author | Danijel Anđelković <adanijel99@gmail.com> | 2022-05-20 04:01:38 +0200 | 
|---|---|---|
| committer | Danijel Anđelković <adanijel99@gmail.com> | 2022-05-20 04:01:38 +0200 | 
| commit | 9930bdb624f9511e9f4ead7abd435d25fbdcac4a (patch) | |
| tree | a1f2071655b4bd2d78f46c7bb0424a08985664b8 /frontend/src/app/_elements | |
| parent | 447dbf0fe8cdb02bf5e8fb41540eac79329b3013 (diff) | |
| parent | b18a4134048bac5df33d100cd09087566a6e5a8d (diff) | |
Merge branch 'redesign' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into redesign
Diffstat (limited to 'frontend/src/app/_elements')
7 files changed, 74 insertions, 35 deletions
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 9a8cbeee..a9057695 100644 --- a/frontend/src/app/_elements/column-table/column-table.component.ts +++ b/frontend/src/app/_elements/column-table/column-table.component.ts @@ -114,20 +114,11 @@ export class ColumnTableComponent implements AfterViewInit {          else            this.columnsChecked.push(false);        }); -      this.nullValOption = []; +      //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})`); +        //let nullValRep = this.experiment.nullValuesReplacers.find(x => x.column == this.dataset!.columnInfo[i].columnName); +        let nullValRep = this.experiment.nullValuesReplacers[i]; +        this.nullValOption[i] = (nullValRep.option == NullValueOptions.DeleteRows) ? `Obriši redove (${this.dataset.columnInfo[i].numNulls})` : ((nullValRep.option == NullValueOptions.DeleteColumns) ? `Isključi kolonu` : `Popuni sa ${nullValRep.value}`);        }      }      this.resetPagging(); @@ -164,17 +155,19 @@ export class ColumnTableComponent implements AfterViewInit {      }    }    resetOutputColumn() { -    if (this.experiment.inputColumns.length > 0) +    if (this.experiment.inputColumns.length > 0) {        this.experiment.outputColumn = this.experiment.inputColumns[0]; +      this.changeProblemType(); +    }      else        this.experiment.outputColumn = '-';    }    setDeleteRowsForMissingValTreatment() { -    if (this.experiment != undefined) { +    if (this.experiment != undefined && this.dataset != undefined) {        this.experiment.nullValues = NullValueOptions.DeleteRows;        this.experiment.nullValuesReplacers = []; -      for (let i = 0; i < this.experiment.inputColumns.length; i++) { +      for (let i = 0; i < this.dataset?.columnInfo.length; i++) {          this.experiment.nullValuesReplacers.push({            column: this.experiment.inputColumns[i],            option: NullValueOptions.DeleteRows, @@ -204,13 +197,17 @@ export class ColumnTableComponent implements AfterViewInit {          }          if (this.experiment.inputColumns.length == 1)            this.experiment.outputColumn = this.experiment.inputColumns[0]; + +        let index = this.dataset?.columnInfo.findIndex(x => x.columnName == columnName)!; +        this.nullValOption[index] = (this.experiment.nullValuesReplacers[index].option == NullValueOptions.DeleteRows) ? "Obriši redove (" + this.dataset?.columnInfo[index].numNulls + ")" : "Popuni sa " + this.experiment.nullValuesReplacers[index].value;        }        else {          this.experiment.inputColumns = this.experiment.inputColumns.filter(x => x != columnName);          //console.log("Input columns: ", this.experiment.inputColumns);          //TODO: da se zatamni kolona koja je unchecked          //this.experiment.encodings = this.experiment.encodings.filter(x => x.columnName != columnName); samo na kraju iz enkodinga skloni necekirane -        this.experiment.nullValuesReplacers = this.experiment.nullValuesReplacers.filter(x => x.column != columnName); +        let index = this.dataset?.columnInfo.findIndex(x => x.columnName == columnName)!; +        this.nullValOption[index] = "Isključi kolonu";          if (columnName == this.experiment.outputColumn) {            if (this.experiment.inputColumns.length > 0)              this.experiment.outputColumn = this.experiment.inputColumns[0]; @@ -224,11 +221,12 @@ export class ColumnTableComponent implements AfterViewInit {    outputColumnChanged() {      let outputColReplacer = this.experiment.nullValuesReplacers.find(x => x.column == this.experiment.outputColumn); -    let index = this.experiment.nullValuesReplacers.findIndex(x => x.column == this.experiment.outputColumn); +    //let index = this.experiment.nullValuesReplacers.findIndex(x => x.column == this.experiment.outputColumn);      if (outputColReplacer != undefined) {        outputColReplacer.option = NullValueOptions.DeleteRows;        let numOfRowsToDelete = (this.dataset!.columnInfo.filter(x => x.columnName == this.experiment.outputColumn)[0]).numNulls; +      let index = this.dataset!.columnInfo.findIndex(x => x.columnName == this.experiment.outputColumn);        this.nullValOption[index] = "Obriši redove (" + numOfRowsToDelete + ")";      } @@ -237,15 +235,21 @@ export class ColumnTableComponent implements AfterViewInit {    changeProblemType() {      if (this.experiment != undefined && this.dataset != undefined) { +      //console.log(this.experiment.outputColumn);        let i = this.dataset.columnInfo.findIndex(x => x.columnName == this.experiment!.outputColumn);        if (i == -1 || this.experiment.columnTypes[i] == ColumnType.numerical) { +        //console.log("USAO U REGRESIONI");          this.experiment.type = ProblemType.Regression;        }        else { -        if (this.dataset.columnInfo[i].uniqueValues!.length == 2) +        if (this.dataset.columnInfo[i].uniqueValues!.length == 2) { +          //console.log("USAO U BINARY");            this.experiment.type = ProblemType.BinaryClassification; -        else +        } +        else { +          //console.log("USAO U multi");            this.experiment.type = ProblemType.MultiClassification; +        }        }        this.columnTableChangeDetected();      } @@ -285,7 +289,16 @@ export class ColumnTableComponent implements AfterViewInit {      if (this.experiment != undefined && this.dataset != undefined) {        if (selectedMissingValuesOption == NullValueOptions.DeleteColumns) { -        this.experiment.nullValues = NullValueOptions.DeleteColumns; +        for (let i = 0; i < this.dataset.columnInfo.length; i++) { +          if (this.dataset.columnInfo[i].numNulls > 0 && this.dataset.columnInfo[i].columnName != this.experiment.outputColumn) { +            this.experiment.inputColumns = this.experiment.inputColumns.filter(x => x != this.dataset!.columnInfo[i].columnName); +            this.columnsChecked[i] = false; +            console.log(this.dataset!.columnInfo[i].columnName); + +            this.nullValOption[i] = "Isključi kolonu"; +          } +        } +        /*this.experiment.nullValues = NullValueOptions.DeleteColumns;          let outputColReplacer = this.experiment.nullValuesReplacers.find(x => x.column == this.experiment.outputColumn); @@ -297,16 +310,18 @@ export class ColumnTableComponent implements AfterViewInit {                option: NullValueOptions.DeleteColumns,                value: ""              }); -            this.nullValOption[i] = "Obriši kolonu"; +            let colIndex = this.dataset.columnInfo.findIndex(x => x.columnName == this.experiment.inputColumns[i]); +            this.nullValOption[colIndex] = "Isključi kolonu";            }            else {              if (outputColReplacer != undefined) {                this.experiment.nullValuesReplacers.push(outputColReplacer);                let numOfRowsToDelete = (this.dataset.columnInfo.filter(x => x.columnName == this.experiment!.inputColumns[i])[0]).numNulls; -              this.nullValOption[i] = (outputColReplacer.option == NullValueOptions.DeleteRows) ? "Obriši redove (" + numOfRowsToDelete + ")" : "Popuni sa " + outputColReplacer.value + ""; +              let colIndex = this.dataset.columnInfo.findIndex(x => x.columnName == this.experiment.inputColumns[i]); +              this.nullValOption[colIndex] = (outputColReplacer.option == NullValueOptions.DeleteRows) ? "Obriši redove (" + numOfRowsToDelete + ")" : "Popuni sa " + outputColReplacer.value + "";              }            } -        } +        }*/          //obrisi kolone koje sadrze nedostajuce vrednosti iz input kolona           /*for (let i = 0; i < this.dataset.columnInfo.length; i++) {            if (this.dataset.columnInfo[i].numNulls > 0) { @@ -326,7 +341,8 @@ export class ColumnTableComponent implements AfterViewInit {              value: ""            });            let numOfRowsToDelete = (this.dataset.columnInfo.filter(x => x.columnName == this.experiment!.inputColumns[i])[0]).numNulls; -          this.nullValOption[i] = "Obriši redove (" + numOfRowsToDelete + ")"; +          let colIndex = this.dataset.columnInfo.findIndex(x => x.columnName == this.experiment.inputColumns[i]); +          this.nullValOption[colIndex] = "Obriši redove (" + numOfRowsToDelete + ")";          }        }        this.columnTableChangeDetected(); @@ -369,7 +385,16 @@ export class ColumnTableComponent implements AfterViewInit {    MissValsDeleteClicked(event: Event, replacementType: NullValueOptions, index: number) {      if (this.experiment != undefined && this.dataset != undefined) { -      let columnName = (<HTMLInputElement>event.currentTarget).value; + +        this.experiment.nullValuesReplacers[index].option = NullValueOptions.DeleteRows; +        this.experiment.nullValuesReplacers[index].value = ""; + +        this.nullValOption[index] = "Obriši redove (" + this.dataset.columnInfo[index].numNulls + ")"; + +        this.columnTableChangeDetected(); +    } + +      /*let columnName = (<HTMLInputElement>event.currentTarget).value;        let arrayElement = this.experiment.nullValuesReplacers.filter(x => x.column == columnName)[0];        if (arrayElement == undefined) { @@ -385,14 +410,21 @@ export class ColumnTableComponent implements AfterViewInit {        }        let numOfRowsToDelete = (this.dataset.columnInfo.filter(x => x.columnName == this.experiment!.inputColumns[index])[0]).numNulls; -      this.nullValOption[index] = (replacementType == NullValueOptions.DeleteColumns) ? "Obriši kolonu" : "Obriši redove (" + numOfRowsToDelete + ")"; +      this.nullValOption[index] = (replacementType == NullValueOptions.DeleteColumns) ? "Isključi kolonu" : "Obriši redove (" + numOfRowsToDelete + ")";        this.columnTableChangeDetected(); -    } +    }*/    }    MissValsReplaceClicked(event: Event, columnName: string, index: number) {      if (this.experiment != undefined) { -      let fillValue = (<HTMLInputElement>event.currentTarget).value; +      this.experiment.nullValuesReplacers[index].option = NullValueOptions.Replace; +      let value = (<HTMLInputElement>event.currentTarget).value; +      this.experiment.nullValuesReplacers[index].value = value; +      this.nullValOption[index] = "Popuni sa " + value; + +      this.columnTableChangeDetected(); + +      /*let fillValue = (<HTMLInputElement>event.currentTarget).value;        let arrayElement = this.experiment.nullValuesReplacers.filter(x => x.column == columnName)[0];        if (arrayElement == undefined) { @@ -408,7 +440,7 @@ export class ColumnTableComponent implements AfterViewInit {        }        this.nullValOption[index] = "Popuni sa: " + fillValue; -      this.columnTableChangeDetected(); +      this.columnTableChangeDetected();*/      }    }    getValue(columnName: string): string { diff --git a/frontend/src/app/_elements/datatable/datatable.component.css b/frontend/src/app/_elements/datatable/datatable.component.css index e69de29b..4e0a3737 100644 --- a/frontend/src/app/_elements/datatable/datatable.component.css +++ b/frontend/src/app/_elements/datatable/datatable.component.css @@ -0,0 +1,4 @@ +.proba { +    max-width: 1620px; +     +}
\ No newline at end of file diff --git a/frontend/src/app/_elements/folder/folder.component.css b/frontend/src/app/_elements/folder/folder.component.css index 97c13299..682fc645 100644 --- a/frontend/src/app/_elements/folder/folder.component.css +++ b/frontend/src/app/_elements/folder/folder.component.css @@ -1,5 +1,6 @@  #folder {      width: 100%; +      }  #tabs { diff --git a/frontend/src/app/_elements/folder/folder.component.html b/frontend/src/app/_elements/folder/folder.component.html index 7c42b1db..a557edde 100644 --- a/frontend/src/app/_elements/folder/folder.component.html +++ b/frontend/src/app/_elements/folder/folder.component.html @@ -116,9 +116,10 @@                      </div>                  </div> -                <div class="list-add" [ngSwitch]="type"> -                    <button mat-raised-button *ngSwitchCase="FolderType.Dataset" (click)="selectNewFile()">Dodaj {{privacy == Privacy.Public ? 'javni ' : ' '}}izvor podataka</button> -                    <button mat-raised-button *ngSwitchCase="FolderType.Model" (click)="selectNewFile()">Dodaj {{privacy == Privacy.Public ? 'javnu ' : ' '}}konfiguraciju neuronske mreže</button> +                <div class="list-add" [ngSwitch]="type" *ngIf="privacy != Privacy.Public" > +                    <!-- {{privacy == Privacy.Public ? 'javni ' : ' '}} --> +                    <button mat-raised-button *ngSwitchCase="FolderType.Dataset" (click)="selectNewFile()">Dodaj izvor podataka</button> +                    <button mat-raised-button *ngSwitchCase="FolderType.Model" (click)="selectNewFile()">Dodaj konfiguraciju neuronske mreže</button>                      <button mat-raised-button *ngSwitchCase="FolderType.Experiment" routerLink="/experiment">Dodaj eksperiment</button>                  </div>              </div> diff --git a/frontend/src/app/_elements/folder/folder.component.ts b/frontend/src/app/_elements/folder/folder.component.ts index ed38bbd6..93e8ba98 100644 --- a/frontend/src/app/_elements/folder/folder.component.ts +++ b/frontend/src/app/_elements/folder/folder.component.ts @@ -467,6 +467,7 @@ export class FolderComponent implements AfterViewInit {      setTimeout(() => {        if (tab == TabType.NewFile) {          this.selectNewFile(); +        this.selectedFile=undefined!;        }        this.listView = this.getListView(tab); diff --git a/frontend/src/app/_elements/form-dataset/form-dataset.component.css b/frontend/src/app/_elements/form-dataset/form-dataset.component.css index 99ed5d40..43accd6d 100644 --- a/frontend/src/app/_elements/form-dataset/form-dataset.component.css +++ b/frontend/src/app/_elements/form-dataset/form-dataset.component.css @@ -7,7 +7,7 @@  .topBar {      display: table;      width: 100%; -    height: 100px; +    height: 80px;      margin-left: 1.5%;       margin-top: 1.5% ;  } diff --git a/frontend/src/app/_elements/form-dataset/form-dataset.component.html b/frontend/src/app/_elements/form-dataset/form-dataset.component.html index 024f58e8..6194a1a8 100644 --- a/frontend/src/app/_elements/form-dataset/form-dataset.component.html +++ b/frontend/src/app/_elements/form-dataset/form-dataset.component.html @@ -40,7 +40,7 @@              <input class="file" id="file-upload" (change)="changeListener($event)" (valueChange)="dataset.isPreProcess = false; editEvent.emit()" #fileInput type="file" accept=".csv"> -            <div class="mt-5 datatable"> +            <div class="datatable">                  <div [ngClass]="{'hidden': (!existingFlag)}" class="text-center">                      <button mat-button (click)="goBack()"><mat-icon>keyboard_arrow_left</mat-icon></button>                      <div style="display: inline;">{{(this.begin/10)+1}}...{{getPage()}}</div>  | 
