aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/form-dataset
diff options
context:
space:
mode:
authorTAMARA JERINIC <tamara.jerinic@gmail.com>2022-05-16 00:54:40 +0200
committerTAMARA JERINIC <tamara.jerinic@gmail.com>2022-05-16 00:54:40 +0200
commitc544d2a84b4bd922bcd4be9fd789035e1d5d9dcc (patch)
tree87e70c0df40154048bcdf09f7f819df474a41fde /frontend/src/app/_elements/form-dataset
parentdac8e0f3a723a43013d6412def50ca04e7976b1f (diff)
parentcc4e071ce18834d3bd4cd8ae123afab3ea5832b7 (diff)
Merge branch 'redesign' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into redesign
Diffstat (limited to 'frontend/src/app/_elements/form-dataset')
-rw-r--r--frontend/src/app/_elements/form-dataset/form-dataset.component.css4
-rw-r--r--frontend/src/app/_elements/form-dataset/form-dataset.component.html11
-rw-r--r--frontend/src/app/_elements/form-dataset/form-dataset.component.ts32
3 files changed, 40 insertions, 7 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 079711d0..99ed5d40 100644
--- a/frontend/src/app/_elements/form-dataset/form-dataset.component.css
+++ b/frontend/src/app/_elements/form-dataset/form-dataset.component.css
@@ -63,4 +63,8 @@
.file-container input{
border-radius: 5px;
left: 0%;
+}
+
+.naslov{
+ font-size: 30px;
} \ No newline at end of file
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 b96276bd..9f8e9e6f 100644
--- a/frontend/src/app/_elements/form-dataset/form-dataset.component.html
+++ b/frontend/src/app/_elements/form-dataset/form-dataset.component.html
@@ -1,6 +1,5 @@
<div class="folderBox" *ngIf="dataset">
-
-
+
<div class="topBar">
<div class="kolona mb-3">
<div class="fileButton">
@@ -35,7 +34,7 @@
</div>
<div class="row" *ngIf="firstInput">
- <label class=" mt-5">{{filename}}</label>
+ <label class="naslov mt-2">{{filename}}</label>
</div>
@@ -43,10 +42,16 @@
<div class="file-container" [ngClass]="{'dottedClass': !tableData.hasInput}">
<i class="material-icons-outlined icon-display" [ngClass]="{'hidden': tableData.hasInput}">file_upload</i>
+
<input class="file" id="file-upload" (change)="changeListener($event)" #fileInput type="file" accept=".csv">
<div class="mt-5 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}}</div>
+ <button mat-button (click)="goForward()"><mat-icon>keyboard_arrow_right</mat-icon></button>
+ </div>
<app-datatable [tableData]="tableData"></app-datatable>
</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 94ef9905..79fbe2c9 100644
--- a/frontend/src/app/_elements/form-dataset/form-dataset.component.ts
+++ b/frontend/src/app/_elements/form-dataset/form-dataset.component.ts
@@ -24,6 +24,9 @@ export class FormDatasetComponent {
files: File[] = [];
rowsNumber: number = 0;
colsNumber: number = 0;
+ begin:number=0;
+ end:number=10;
+ existingFlag:boolean=false;
@Input() dataset: Dataset; //dodaj ! potencijalno
@@ -40,7 +43,21 @@ export class FormDatasetComponent {
}
//@ViewChild('fileImportInput', { static: false }) fileImportInput: any; cemu je ovo sluzilo?
+ resetPagging(){
+ this.begin=0;
+ }
+ goBack(){
+ if(this.begin-10<=0)
+ this.begin=0;
+ else
+ this.begin-=10;
+ this.loadExisting();
+ }
+ goForward(){
+ this.begin+=10;
+ this.loadExisting();
+ }
clear(){
this.tableData.hasInput = false;
}
@@ -56,6 +73,7 @@ export class FormDatasetComponent {
this.filename = this.files[0].name;
this.tableData.loaded = false;
+ this.existingFlag=false;
this.update();
}
@@ -64,7 +82,6 @@ export class FormDatasetComponent {
update() {
this.firstInput = true
-
if (this.files.length < 1)
return;
@@ -91,20 +108,27 @@ export class FormDatasetComponent {
}
loadExisting(){
+ this.existingFlag=true;
this.firstInput = false;
this.tableData.hasInput = true;
this.tableData.loaded = false;
-
- this.datasetsService.getDatasetFile(this.dataset.fileId).subscribe((file: string | undefined) => {
+ this.datasetsService.getDatasetHeader(this.dataset.fileId).subscribe((header: string | undefined)=>{
+
+ this.datasetsService.getDatasetFilePaging(this.dataset.fileId,this.begin,this.end).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 == "novi red") ? "\t" : this.dataset.delimiter);
+ this.tableData.data = this.csv.csvToArray(header+'\n'+file, (this.dataset.delimiter == "razmak") ? " " : (this.dataset.delimiter == "novi red") ? "\t" : this.dataset.delimiter);
}
+ else{
+ this.begin-=10;
+ this.loadExisting();
+ }
});
+ });
}