diff options
Diffstat (limited to 'frontend/src/app/_elements/form-dataset')
3 files changed, 52 insertions, 6 deletions
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 7c7eb0d3..953daa0c 100644 --- a/frontend/src/app/_elements/form-dataset/form-dataset.component.css +++ b/frontend/src/app/_elements/form-dataset/form-dataset.component.css @@ -4,12 +4,24 @@ position: relative; } -.bottomBar { - width: 50%; +.topBar { + width: 100%; margin: 1rem; align-items: flex-start; } +.topBar label{ + font-size: 30px; +} +.topBar mat-form-field{ + width: 250px; +} + +.toptop{ + margin-left: 1.5%; + width: 50%; +} + .fileButton{ margin-top: 10px; } 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 5c2b29ba..281f9c05 100644 --- a/frontend/src/app/_elements/form-dataset/form-dataset.component.html +++ b/frontend/src/app/_elements/form-dataset/form-dataset.component.html @@ -1,12 +1,12 @@ <div class="folderBox" *ngIf="dataset"> <div class="row" style="margin-right: 0;"> - <div class="bottomBar"> - <div class="row"> + <div class="topBar"> + <div class="row toptop"> <div class="col-sm mb-3"> <div class="fileButton"> - <button type="button" mat-raised-button (click)="fileInput.click()">Choose File</button> - <label>{{filename}}</label> + <button type="button" mat-raised-button (click)="fileInput.click()">Dodaj izvor podataka</button> + </div> </div> @@ -35,6 +35,13 @@ </mat-select> </mat-form-field> </div> + <div class="col-sm"> + + </div> + </div> + <div class="row" *ngIf="firstInput"> + <label class=" mt-5">{{filename}}</label> + </div> </div> </div> diff --git a/frontend/src/app/_elements/form-dataset/form-dataset.component.ts b/frontend/src/app/_elements/form-dataset/form-dataset.component.ts index 62afaa47..1eed2cdc 100644 --- a/frontend/src/app/_elements/form-dataset/form-dataset.component.ts +++ b/frontend/src/app/_elements/form-dataset/form-dataset.component.ts @@ -41,6 +41,10 @@ export class FormDatasetComponent { //@ViewChild('fileImportInput', { static: false }) fileImportInput: any; cemu je ovo sluzilo? + clear(){ + this.tableData.hasInput = false; + } + changeListener($event: any): void { this.files = $event.srcElement.files; if (this.files.length == 0 || this.files[0] == null) { @@ -55,8 +59,12 @@ export class FormDatasetComponent { this.update(); } + firstInput = false; + update() { + this.firstInput = true + if (this.files.length < 1) return; @@ -82,6 +90,25 @@ export class FormDatasetComponent { this.dataset.name = this.filename.slice(0, this.filename.length - 4); } + loadExisting(){ + this.firstInput = false; + + this.tableData.hasInput = true; + this.tableData.loaded = false; + + this.datasetsService.getDatasetFile(this.dataset.fileId).subscribe((file: string | undefined) => { + if (file) { + this.tableData.loaded = true; + this.tableData.numRows = this.dataset.rowCount; + this.tableData.numCols = this.dataset.columnInfo.length; + this.tableData.data = this.csv.csvToArray(file, (this.dataset.delimiter == "razmak") ? " " : (this.dataset.delimiter == "") ? "," : this.dataset.delimiter); + + } + }); + + + } + /*exportAsXLSX():void { this.excelService.exportAsExcelFile(this.data, 'sample'); }*/ |