Преглед на файлове

table pagination

master
Florian Eisenmenger преди 2 години
родител
ревизия
17eef87fde
променени са 6 файла, в които са добавени 77 реда и са изтрити 8 реда
  1. +3
    -0
      README.md
  2. +41
    -0
      matsen-tool/openapi.yaml
  3. +0
    -1
      matsen-tool/src/app/core/api/v1/.openapi-generator/FILES
  4. +21
    -4
      matsen-tool/src/app/core/api/v1/api/partner.service.ts
  5. +5
    -0
      matsen-tool/src/app/partners/partners.component.html
  6. +7
    -3
      matsen-tool/src/app/partners/partners.component.ts

+ 3
- 0
README.md Целия файл

@@ -38,6 +38,9 @@
- Wenn es nicht geht: brew install java - Wenn es nicht geht: brew install java
- sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk - sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
- java -version) - java -version)
- ACHTUNG: In Datei src/app/core/api/v1/model/partnerJsonId.ts diese zwei Zeilen löschen:
- readonly id?: string;
- readonly type?: string;


## Module anlegen ## Module anlegen
- cd app - cd app


+ 41
- 0
matsen-tool/openapi.yaml Целия файл

@@ -420,6 +420,47 @@ paths:
style: form style: form
explode: false explode: false
allowReserved: false allowReserved: false
-
name: 'order[name]'
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
enum:
- asc
- desc
style: form
explode: false
allowReserved: false
-
name: type
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: 'type[]'
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: array
items:
type: string
style: form
explode: true
allowReserved: false
deprecated: false deprecated: false
post: post:
operationId: api_partners_post operationId: api_partners_post


+ 0
- 1
matsen-tool/src/app/core/api/v1/.openapi-generator/FILES Целия файл

@@ -1,5 +1,4 @@
.gitignore .gitignore
.openapi-generator-ignore
README.md README.md
api.module.ts api.module.ts
api/api.ts api/api.ts


+ 21
- 4
matsen-tool/src/app/core/api/v1/api/partner.service.ts Целия файл

@@ -103,19 +103,36 @@ export class PartnerService {
* Retrieves the collection of Partner resources. * Retrieves the collection of Partner resources.
* Retrieves the collection of Partner resources. * Retrieves the collection of Partner resources.
* @param page The collection page number * @param page The collection page number
* @param orderName
* @param type
* @param type2
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress. * @param reportProgress flag to report request and response progress.
*/ */
public partnersGetCollection(page?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<ApiPartnersGetCollection200Response>;
public partnersGetCollection(page?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpResponse<ApiPartnersGetCollection200Response>>;
public partnersGetCollection(page?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpEvent<ApiPartnersGetCollection200Response>>;
public partnersGetCollection(page?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<any> {
public partnersGetCollection(page?: number, orderName?: 'asc' | 'desc', type?: string, type2?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<ApiPartnersGetCollection200Response>;
public partnersGetCollection(page?: number, orderName?: 'asc' | 'desc', type?: string, type2?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpResponse<ApiPartnersGetCollection200Response>>;
public partnersGetCollection(page?: number, orderName?: 'asc' | 'desc', type?: string, type2?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpEvent<ApiPartnersGetCollection200Response>>;
public partnersGetCollection(page?: number, orderName?: 'asc' | 'desc', type?: string, type2?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<any> {


let localVarQueryParameters = new HttpParams({encoder: this.encoder}); let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (page !== undefined && page !== null) { if (page !== undefined && page !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>page, 'page'); <any>page, 'page');
} }
if (orderName !== undefined && orderName !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>orderName, 'order[name]');
}
if (type !== undefined && type !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>type, 'type');
}
if (type2) {
type2.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'type[]');
})
}


let localVarHeaders = this.defaultHeaders; let localVarHeaders = this.defaultHeaders;




+ 5
- 0
matsen-tool/src/app/partners/partners.component.html Целия файл

@@ -35,3 +35,8 @@
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table> </table>

<mat-paginator [pageSizeOptions]="[5, 10, 20]"
showFirstLastButtons
aria-label="Select page of periodic elements">
</mat-paginator>

+ 7
- 3
matsen-tool/src/app/partners/partners.component.ts Целия файл

@@ -1,20 +1,22 @@
import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
import {AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core';
import {MatSort, Sort, MatSortModule} from "@angular/material/sort"; import {MatSort, Sort, MatSortModule} from "@angular/material/sort";
import {LiveAnnouncer} from "@angular/cdk/a11y"; import {LiveAnnouncer} from "@angular/cdk/a11y";
import {MatTableDataSource, MatTableModule} from "@angular/material/table"; import {MatTableDataSource, MatTableModule} from "@angular/material/table";
import {ActivatedRoute, RouterLink, RouterLinkActive} from "@angular/router"; import {ActivatedRoute, RouterLink, RouterLinkActive} from "@angular/router";
import {Subscription} from "rxjs"; import {Subscription} from "rxjs";
import {PartnerJsonld, PartnerService} from "@app/core/api/v1"; import {PartnerJsonld, PartnerService} from "@app/core/api/v1";
import {MatPaginator, MatPaginatorIntl, MatPaginatorModule} from "@angular/material/paginator";


@Component({ @Component({
selector: 'app-partners', selector: 'app-partners',
templateUrl: './partners.component.html', templateUrl: './partners.component.html',
styleUrl: './partners.component.scss', styleUrl: './partners.component.scss',
standalone: true, standalone: true,
imports: [MatTableModule, MatSortModule, RouterLink, RouterLinkActive],
imports: [MatTableModule, MatSortModule, MatPaginatorModule, RouterLink, RouterLinkActive],
}) })
export class PartnersComponent implements OnInit, AfterViewInit { export class PartnersComponent implements OnInit, AfterViewInit {
@ViewChild(MatSort) sort; @ViewChild(MatSort) sort;
@ViewChild(MatPaginator) paginator: MatPaginator;


protected partnersSub: Subscription; protected partnersSub: Subscription;
protected partners: Array<PartnerJsonld> = []; protected partners: Array<PartnerJsonld> = [];
@@ -29,6 +31,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {
private partnerService: PartnerService private partnerService: PartnerService
) { ) {
this.sort = new MatSort(); this.sort = new MatSort();
this.paginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);


this.partnersSub = new Subscription(); this.partnersSub = new Subscription();
this.partners = []; this.partners = [];
@@ -38,7 +41,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {
this.dataType = this.route.snapshot.data['dataType']; this.dataType = this.route.snapshot.data['dataType'];
console.log('Data Type:', this.dataType); console.log('Data Type:', this.dataType);


this.partnersSub = this.partnerService.partnersGetCollection().subscribe(
this.partnersSub = this.partnerService.partnersGetCollection(1, "asc", this.dataType).subscribe(
data => { data => {
this.partners = data["hydra:member"]; this.partners = data["hydra:member"];


@@ -51,6 +54,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {


ngAfterViewInit() { ngAfterViewInit() {
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;
this.dataSource.paginator = this.paginator;
} }


/** Announce the change in sort state for assistive technology. */ /** Announce the change in sort state for assistive technology. */


Зареждане…
Отказ
Запис