Add Layer by hand, pagination fix

This commit is contained in:
2023-01-06 12:15:43 +01:00
parent 42006caaf2
commit acc2c67688
6 changed files with 12 additions and 14 deletions

View File

@@ -45,8 +45,6 @@
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let item; columns: displayedColumns;"></mat-row> <mat-row *matRowDef="let item; columns: displayedColumns;"></mat-row>
</mat-table> </mat-table>
<mat-paginator #paginator [pageSize]="50" [pageSizeOptions]="[5, 10, 20]">
</mat-paginator>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</form> </form>

View File

@@ -24,7 +24,6 @@ export class LayerDetailComponent implements OnInit {
displayedColumns = ['code', 'value']; displayedColumns = ['code', 'value'];
dataSource!: MatTableDataSource<Record>; dataSource!: MatTableDataSource<Record>;
@ViewChild(MatPaginator) paginator!: MatPaginator;
@ViewChild(MatSort) sort!: MatSort; @ViewChild(MatSort) sort!: MatSort;
constructor( constructor(
@@ -41,7 +40,6 @@ export class LayerDetailComponent implements OnInit {
this.form = Layer.getForm(this.fb$); this.form = Layer.getForm(this.fb$);
this.document = await this.load(); this.document = await this.load();
this.dataSource = new MatTableDataSource<Record>(this.document.records); this.dataSource = new MatTableDataSource<Record>(this.document.records);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;
this.document.fillForm(this.form); this.document.fillForm(this.form);
this.form.disable(); this.form.disable();

View File

@@ -71,8 +71,6 @@
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let item; columns: displayedColumns;"></mat-row> <mat-row *matRowDef="let item; columns: displayedColumns;"></mat-row>
</mat-table> </mat-table>
<mat-paginator #paginator [pageSize]="50" [pageSizeOptions]="[5, 10, 20]">
</mat-paginator>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</form> </form>

View File

@@ -24,7 +24,6 @@ export class LayerEditComponent implements OnInit {
displayedColumns = ['code', 'value', 'desc1']; displayedColumns = ['code', 'value', 'desc1'];
dataSource!: MatTableDataSource<Record>; dataSource!: MatTableDataSource<Record>;
@ViewChild(MatPaginator) paginator!: MatPaginator;
@ViewChild(MatSort) sort!: MatSort; @ViewChild(MatSort) sort!: MatSort;
constructor( constructor(
@@ -57,7 +56,6 @@ export class LayerEditComponent implements OnInit {
const file = input.files[0]; const file = input.files[0];
this.document.records = await Layer.parseFile(file, this.http$); this.document.records = await Layer.parseFile(file, this.http$);
this.dataSource = new MatTableDataSource(this.document.records); this.dataSource = new MatTableDataSource(this.document.records);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;
} }
trackByUid(index: number, item: Record) { trackByUid(index: number, item: Record) {
@@ -68,7 +66,6 @@ export class LayerEditComponent implements OnInit {
this.document = await Layer.parseGoogleSheet(id, this.http$); this.document = await Layer.parseGoogleSheet(id, this.http$);
this.document.fillForm(this.form); this.document.fillForm(this.form);
this.dataSource = new MatTableDataSource(this.document.records); this.dataSource = new MatTableDataSource(this.document.records);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;
} }
} }

View File

@@ -2,11 +2,9 @@
<div class="list-header"> <div class="list-header">
<mat-grid-list cols="10" rowHeight="60"> <mat-grid-list cols="10" rowHeight="60">
<mat-grid-tile> <mat-grid-tile>
<!--
<button mat-button routerLink="Edit/new"> <button mat-button routerLink="Edit/new">
Dodaj Dodaj
</button> </button>
-->
</mat-grid-tile> </mat-grid-tile>
<mat-grid-tile [colspan]="8"> <mat-grid-tile [colspan]="8">
<mat-form-field class="searchListInput"> <mat-form-field class="searchListInput">
@@ -38,8 +36,8 @@
<mat-row *matRowDef="let item; columns: displayedColumns;" [routerLink]="['Detail/', item.id]"></mat-row> <mat-row *matRowDef="let item; columns: displayedColumns;" [routerLink]="['Detail/', item.id]"></mat-row>
</mat-table> </mat-table>
<mat-paginator #paginator <mat-paginator #paginator
[pageSize]="10" [pageSize]="500"
[pageSizeOptions]="[5, 10, 20]"> [pageSizeOptions]="[500, 1000, 2500, 10000]">
</mat-paginator> </mat-paginator>
</div> </div>

View File

@@ -85,8 +85,17 @@ namespace WebAPI.Controllers
public IActionResult ParseGoogleSheet(string sheetId) public IActionResult ParseGoogleSheet(string sheetId)
{ {
string sheetName = "KOSZTY";
Layer layer = new Layer();
layer.Source = "GoogleSheet";
layer.Number = db.Layers.Count() + 1;
var parser = new googleSheetParser(googleSheetValues); var parser = new googleSheetParser(googleSheetValues);
return Ok(parser.parse(sheetId)); dynamic parsedSheet = parser.parse(sheetId);
layer.Records = parsedSheet.records;
layer.Name = $"W{layer.Number}-I-{sheetName}-{parsedSheet.date}-{DateTime.Now.ToString("yyyyMMddHHmm")}";
return Ok(layer);
} }
[HttpPost] [HttpPost]
[DisableRequestSizeLimit] [DisableRequestSizeLimit]