From 296f29cf82d82ad78943d8a7de9a7cee0254a4e4 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 6 Nov 2024 10:52:19 +0100 Subject: [PATCH] =?UTF-8?q?refactor:=20redundante=20Funktion=20entfernen?= =?UTF-8?q?=20und=20Logik=20zur=20Verarbeitung=20ausgew=C3=A4hlter=20Zeile?= =?UTF-8?q?n=20in=20UserRepresentationComponent=20konsolidieren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user-representation.component.ts | 35 ++++++++----------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.ts b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.ts index 03e6e5f..3ae9689 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.ts +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.ts @@ -59,31 +59,24 @@ export class UserRepresentationComponent extends BasePageComponent implements Af @ViewChild("repGroups") repGroups!: GroupTableComponent; @ViewChild("userReps") userReps!: UserRepTableComponent; - userGroupOnSelectedRows = (rows: GuiSelectedRow[], isUser: boolean = true) => { + userOnSelectedRows = (rows: GuiSelectedRow[]) => { if (rows.length > 0) { - if (isUser) { - this.useRepLabel = `Vertretungen von ${rows[0].source?.username}` - this.users.safelyUnselectAll(); - this.userReps.fetchData(rows[0].source?.id) - this.slGroupId = undefined; - this.slUserId = rows[0].source?.id - } - else { - this.useRepLabel = `Vertretungen von ${rows[0].source?.name}` - this.groups.safelyUnselectAll(); - this.userReps.fetchData(undefined, rows[0].source?.id) - this.slUserId = undefined; - this.slGroupId = rows[0].source?.id - } + this.useRepLabel = `Vertretungen von ${rows[0].source?.username}` + this.users.safelyUnselectAll(); + this.userReps.fetchData(rows[0].source?.id) + this.slGroupId = undefined; + this.slUserId = rows[0].source?.id } } - userOnSelectedRows = (rows: GuiSelectedRow[]) => { - this.userGroupOnSelectedRows(rows, true); - } - groupOnSelectedRows = (rows: GuiSelectedRow[]) => { - this.userGroupOnSelectedRows(rows, false); + if (rows.length > 0) { + this.useRepLabel = `Vertretungen von ${rows[0].source?.name}` + this.groups.safelyUnselectAll(); + this.userReps.fetchData(undefined, rows[0].source?.id) + this.slUserId = undefined; + this.slGroupId = rows[0].source?.id + } } repUserOnSelectedRows = (rows: GuiSelectedRow[]) => { @@ -213,4 +206,4 @@ export class UserRepresentationComponent extends BasePageComponent implements Af this.slUserRepId = rows[0].source?.id; } } -} \ No newline at end of file +}