feat: RefreshService zu UserAssignmentComponent hinzugefügt und integriert.

This commit is contained in:
Developer 02 2024-07-24 17:48:29 +02:00
parent f625edfab0
commit 277472636a
4 changed files with 29 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import { Component, ViewChild } from '@angular/core';
import { AfterViewInit, Component, ViewChild } from '@angular/core';
import { GroupTableComponent } from '../../components/tables/group-table/group-table.component';
import { RefreshService } from '../../services/refresh.service';
@ -9,7 +9,7 @@ import { RefreshService } from '../../services/refresh.service';
templateUrl: './group.component.html',
styleUrl: './group.component.css'
})
export class GroupComponent {
export class GroupComponent implements AfterViewInit {
constructor(private refreshService: RefreshService) { }
ngAfterViewInit(): void {

View File

@ -1 +1 @@
<app-module-table></app-module-table>
<app-module-table #moduleTable></app-module-table>

View File

@ -1,5 +1,6 @@
import { Component } from '@angular/core';
import { AfterViewInit, Component, ViewChild } from '@angular/core';
import { ModuleTableComponent } from '../../components/tables/module-table/module-table.component';
import { RefreshService } from '../../services/refresh.service';
@Component({
standalone: true,
@ -8,6 +9,15 @@ import { ModuleTableComponent } from '../../components/tables/module-table/modul
templateUrl: './module.component.html',
styleUrl: './module.component.css'
})
export class ModuleComponent {
export class ModuleComponent implements AfterViewInit {
constructor(private refreshService: RefreshService) { }
}
ngAfterViewInit(): void {
this.refreshService.removeAll()
this.refreshService.add(() => {
this.moduleTable.fetchData();
});
}
@ViewChild("moduleTable") moduleTable!: ModuleTableComponent;
}

View File

@ -6,6 +6,7 @@ import { ModuleTableComponent } from '../tables/module-table/module-table.compon
import { GroupTableComponent } from '../tables/group-table/group-table.component';
import { User } from '../../models/user-management.api.models';
import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
import { RefreshService } from '../../services/refresh.service';
@Component({
standalone: true,
@ -44,11 +45,20 @@ export class UserAssignmentComponent implements OnInit, AfterViewInit {
mode: GuiRowSelectionMode.MULTIPLE
}
private anySelected: boolean = false;
constructor(private refreshService: RefreshService) { }
ngOnInit(): void { }
ngAfterViewInit(): void {
//this.unassignedUsers.loading = false;
//this.assignedUsers.loading = false;
this.refreshService.removeAll()
this.refreshService.add(() => {
this.modules.fetchData();
this.groups.fetchData();
if(this.anySelected)
this.updateUserTables();
});
}
createAssignDragMethod(target: string): (event: DragEvent) => void {
@ -130,8 +140,8 @@ export class UserAssignmentComponent implements OnInit, AfterViewInit {
}
updateUserTables() {
this.anySelected = true;
this.unselectUserTables()
switch (this.target) {
case Target.Module:
this.assignedUsers.fetchDataByModuleId(this.targetId);