From 40e3ac187ee54349c9841743f7c5080d60cf1e75 Mon Sep 17 00:00:00 2001 From: Bastian Wagner Date: Tue, 17 Feb 2026 15:38:38 +0100 Subject: [PATCH] queryparams aus url --- client/package.json | 1 + client/proxy.remote.conf.json | 15 ++++------ .../dashboard/dashboard.component.html | 2 +- client/src/app/modules/keys/keys.component.ts | 28 +++++++++++++++++-- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/client/package.json b/client/package.json index bd8cdda..01ab1a6 100644 --- a/client/package.json +++ b/client/package.json @@ -4,6 +4,7 @@ "scripts": { "ng": "ng", "start": "ng serve", + "start:remote": "ng serve --configuration remote", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "jest", diff --git a/client/proxy.remote.conf.json b/client/proxy.remote.conf.json index 2af846a..cc2c188 100644 --- a/client/proxy.remote.conf.json +++ b/client/proxy.remote.conf.json @@ -1,11 +1,8 @@ { - "/api": { - "target": "http://keyvaultpro.de:3701", - "secure": false, - "logLevel": "debug", - "changeOrigin": true, - "pathRewrite": { - "^/api": "" - } - } + "/api": { + "target": "https://keyvaultpro.de", + "secure": true, + "changeOrigin": true, + "logLevel": "debug" + } } \ No newline at end of file diff --git a/client/src/app/modules/dashboard/dashboard.component.html b/client/src/app/modules/dashboard/dashboard.component.html index 0028544..bd910db 100644 --- a/client/src/app/modules/dashboard/dashboard.component.html +++ b/client/src/app/modules/dashboard/dashboard.component.html @@ -59,7 +59,7 @@

Derzeit ausgegebene Schlüssel

- + diff --git a/client/src/app/modules/keys/keys.component.ts b/client/src/app/modules/keys/keys.component.ts index 9f851e9..08f66ab 100644 --- a/client/src/app/modules/keys/keys.component.ts +++ b/client/src/app/modules/keys/keys.component.ts @@ -1,7 +1,7 @@ import { Component, inject } from '@angular/core'; import { AG_GRID_LOCALE_DE } from '@ag-grid-community/locale'; import { AgGridAngular } from 'ag-grid-angular'; -import { GridOptions,GridApi, GridReadyEvent, CellEditingStoppedEvent, ICellEditorParams } from 'ag-grid-community'; +import { GridOptions,GridApi, GridReadyEvent, CellEditingStoppedEvent, ICellEditorParams, FilterActionParams, FilterAction } from 'ag-grid-community'; import { DatePipe } from '@angular/common'; import { ApiService } from '../../shared/api.service'; import { IKey } from '../../model/interface/key.interface'; @@ -18,11 +18,13 @@ import { ICylinder } from '../../model/interface/cylinder.interface'; import { LostKeysComponent } from './components/lost-keys/lost-keys.component'; import { MatTooltipModule } from '@angular/material/tooltip'; import { SelectKeyCylinderComponent } from './create/select-key-cylinder/select-key-cylinder.component'; +import { ActivatedRoute, Route } from '@angular/router'; +import { ModuleRegistry } from 'ag-grid-community'; @Component({ selector: 'app-keys', imports: [AgGridAngular, MatButtonModule, MatDialogModule, MatIconModule, MatTooltipModule], - providers: [DatePipe], + providers: [DatePipe, ModuleRegistry], templateUrl: './keys.component.html', styleUrl: './keys.component.scss' }) @@ -31,6 +33,7 @@ export class KeysComponent { private datePipe = inject(DatePipe); private toast: HotToastService = inject(HotToastService); private dialog: MatDialog = inject(MatDialog); + private route: ActivatedRoute = inject(ActivatedRoute) cylinders: any[] = []; @@ -83,7 +86,7 @@ export class KeysComponent { , cellRenderer: (data: any) => data.value ? this.datePipe.transform(new Date(data.value)) : '-' , tooltipValueGetter: (data: any) => this.datePipe.transform(new Date(data.value), 'medium') }, - { colId: 'handedOut', field: 'handedOut' , headerName: 'Ausgegeben', width: 100, editable: false, filter: false, headerTooltip: 'Ausgegeben' }, + { colId: 'handedOut', field: 'handedOut' , headerName: 'Ausgegeben', width: 100, editable: false, filter: true, headerTooltip: 'Ausgegeben' }, { colId: 'actions' , headerName: 'Aktionen' @@ -100,6 +103,7 @@ export class KeysComponent { pagination: true, } + deleteKey(id: string) { this.api.deleteKey(id).subscribe() } @@ -112,6 +116,8 @@ export class KeysComponent { this.api.getCylinders().subscribe({ next: n => { this.cylinders = n; + + this.setFilterToParams(); }, error: () => { this.cylinders = []; @@ -119,6 +125,22 @@ export class KeysComponent { }) } + private setFilterToParams() { + console.log(this.route.snapshot.queryParams); + const params = this.route.snapshot.queryParams; + + if (Object.keys(params).includes('handedOut')) { + this.gridApi.setFilterModel({ + handedOut: { + filterType: 'text', + type: params['handedOut'] + } + }) + } + + + } + loadKeys() { this.gridApi.setGridOption("loading", true); this.api.getKeys().subscribe({