Compare commits
8 Commits
bf2356e10a
...
1b2e3b8abd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b2e3b8abd | ||
|
|
5a7eb504a9 | ||
|
|
21ab7b5f32 | ||
|
|
4f4b9711c7 | ||
|
|
fe6d8618ce | ||
|
|
277472636a | ||
|
|
f625edfab0 | ||
|
|
f9f02dfcf8 |
@@ -1 +1,18 @@
|
||||
<app-group-table></app-group-table>
|
||||
<div class="container-fluid text-center">
|
||||
<div class="row m-0 p-0">
|
||||
<div class="col-6">
|
||||
<mat-tab-group>
|
||||
<mat-tab label="Gruppen">
|
||||
<app-group-table #groupTable [onSelectedRows]="groupsOnSelectedRows"></app-group-table>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<mat-tab-group>
|
||||
<mat-tab label="Benutzer">
|
||||
<app-user-table #userTable [initData]="initWithoutData"></app-user-table>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,13 +1,39 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { AfterViewInit, Component, ViewChild } from '@angular/core';
|
||||
import { GroupTableComponent } from '../../components/tables/group-table/group-table.component';
|
||||
import { UserTableComponent } from '../../components/tables/user-table/user-table.component';
|
||||
import { RefreshService } from '../../services/refresh.service';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { GuiSelectedRow } from '@generic-ui/ngx-grid';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [GroupTableComponent],
|
||||
imports: [GroupTableComponent, UserTableComponent, MatTabsModule],
|
||||
selector: 'app-group',
|
||||
templateUrl: './group.component.html',
|
||||
styleUrl: './group.component.css'
|
||||
})
|
||||
export class GroupComponent {
|
||||
export class GroupComponent implements AfterViewInit {
|
||||
initWithoutData = () => { }
|
||||
private sGroupId = null;
|
||||
constructor(private refreshService: RefreshService) { }
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.refreshService.removeAll()
|
||||
this.refreshService.add(() => {
|
||||
this.groupTable.fetchData();
|
||||
if(this.sGroupId)
|
||||
this.userTable.fetchDataByGroupId(this.sGroupId);
|
||||
});
|
||||
}
|
||||
|
||||
@ViewChild("groupTable") groupTable!: GroupTableComponent;
|
||||
@ViewChild("userTable") userTable!: UserTableComponent;
|
||||
|
||||
groupsOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||
if(rows.length > 0){
|
||||
this.sGroupId = rows[0].source.id;
|
||||
if(this.sGroupId)
|
||||
this.userTable.fetchDataByGroupId(this.sGroupId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
<app-module-table></app-module-table>
|
||||
<app-module-table #moduleTable></app-module-table>
|
||||
@@ -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;
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import { ColorModeService } from '../../../services/color-mode.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { env } from '../../../../environments/environment';
|
||||
import { GroupService } from '../../../services/group.service';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
@@ -16,7 +18,18 @@ import { env } from '../../../../environments/environment';
|
||||
styleUrl: './dir-group-table.component.css'
|
||||
})
|
||||
export class DirGroupTableComponent extends BaseTableComponent<DirGroup, DirGroupService> {
|
||||
constructor(service: DirGroupService, cModeService: ColorModeService) {
|
||||
constructor(service: DirGroupService, cModeService: ColorModeService, private gService: GroupService) {
|
||||
super(service, env.columnNames.dirGroup, cModeService)
|
||||
}
|
||||
|
||||
override fetchData(): void {
|
||||
this.service.getAll().subscribe({
|
||||
next: async (response) => {
|
||||
const group_names = (await firstValueFrom(this.gService.getAll())).map(g => g.name);
|
||||
this.source = response.filter(dGroup => dGroup.samaccountname?.length && !group_names.includes(dGroup.samaccountname[0]));
|
||||
this.loading = false;
|
||||
},
|
||||
error: (error) => { }
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import { ColorModeService } from '../../../services/color-mode.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { env } from '../../../../environments/environment';
|
||||
import { UserService } from '../../../services/user.service';
|
||||
import { firstValueFrom } from 'rxjs/internal/firstValueFrom';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
@@ -16,14 +18,18 @@ import { env } from '../../../../environments/environment';
|
||||
styleUrl: './dir-user-table.component.css'
|
||||
})
|
||||
export class DirUserTableComponent extends BaseTableComponent<DirUser, DirUserService> {
|
||||
constructor(service: DirUserService, cModeService: ColorModeService) {
|
||||
constructor(service: DirUserService, cModeService: ColorModeService, private uService: UserService) {
|
||||
super(service, env.columnNames.dirUser, cModeService)
|
||||
}
|
||||
|
||||
fetchDataByGroupName(groupName: string): void {
|
||||
this.service.getAll(groupName).subscribe({
|
||||
next: (response: any) => {
|
||||
this.source = response;
|
||||
next: async (response: DirUser[]) => {
|
||||
|
||||
const usernames = (await firstValueFrom(this.uService.getAll())).map(u => u.username)
|
||||
console.log(usernames)
|
||||
console.log(response)
|
||||
this.source = response.filter(user => user.samaccountname?.length && !usernames.includes(user.samaccountname[0]));
|
||||
this.loading = false;
|
||||
},
|
||||
error: (error: any) => { }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, Inject, ViewChild } from '@angular/core';
|
||||
import { AfterViewInit, Component, Inject, ViewChild } from '@angular/core';
|
||||
import { GuiColumn, GuiSelectedRow } from '@generic-ui/ngx-grid/gui/grid/src/core/api/gui.grid.public-api';
|
||||
import { UserTableComponent } from '../tables/user-table/user-table.component';
|
||||
import { UserRepTableComponent } from '../tables/user-rep-table/user-rep-table.component';
|
||||
@@ -7,6 +7,7 @@ import { UserRepService } from '../../services/user-representation.service';
|
||||
import Swal from 'sweetalert2';
|
||||
import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
|
||||
import { env } from '../../../environments/environment';
|
||||
import { RefreshService } from '../../services/refresh.service';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
@@ -15,7 +16,7 @@ import { env } from '../../../environments/environment';
|
||||
templateUrl: './user-representation.component.html',
|
||||
styleUrl: './user-representation.component.css'
|
||||
})
|
||||
export class UserRepresentationComponent {
|
||||
export class UserRepresentationComponent implements AfterViewInit {
|
||||
|
||||
useRepLabel: string = "";
|
||||
groupRepCols: Array<GuiColumn>;
|
||||
@@ -25,16 +26,25 @@ export class UserRepresentationComponent {
|
||||
slRepGroupId: null | number = null;
|
||||
slRightGroupId: null | number = null;
|
||||
slUserRepId: null | number = null;
|
||||
userRepService: UserRepService
|
||||
|
||||
initWithoutData = () => { }
|
||||
|
||||
constructor(userRepService: UserRepService) {
|
||||
constructor(private userRepService: UserRepService, private refreshService: RefreshService) {
|
||||
this.groupRepCols = env.columnNames.group.representative;
|
||||
this.groupRightColumns = env.columnNames.group.right;
|
||||
this.userRepService = userRepService;
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.refreshService.removeAll();
|
||||
this.refreshService.add(() => {
|
||||
this.users.fetchData();
|
||||
this.repUsers.fetchData();
|
||||
this.repGroups.fetchData();
|
||||
this.rightGroups.fetchData();
|
||||
})
|
||||
}
|
||||
|
||||
@ViewChild("users") users!: UserTableComponent;
|
||||
@ViewChild("repUsers") repUsers!: UserTableComponent;
|
||||
@ViewChild("repGroups") repGroups!: GroupTableComponent;
|
||||
@@ -96,11 +106,10 @@ export class UserRepresentationComponent {
|
||||
this.userReps.fetchData(this.slUserId)
|
||||
},
|
||||
error: (error) => {
|
||||
const errorMessage = error?.error || "Es ist ein unerwarteter Fehler aufgetreten.";
|
||||
Swal.fire({
|
||||
icon: "error",
|
||||
title: "Oops...",
|
||||
text: `${errorMessage}\nBitte versuchen Sie es später noch einmal.`,
|
||||
text: `Bitte versuchen Sie es später noch einmal.`,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { AfterViewInit, Component, ViewChild } from '@angular/core';
|
||||
import { GuiCellEdit } from '@generic-ui/ngx-grid';
|
||||
import { UserTableComponent } from '../tables/user-table/user-table.component';
|
||||
import { RefreshService } from '../../services/refresh.service';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
@@ -9,8 +10,7 @@ import { UserTableComponent } from '../tables/user-table/user-table.component';
|
||||
templateUrl: './user.component.html',
|
||||
styleUrl: './user.component.css'
|
||||
})
|
||||
export class UserComponent {
|
||||
|
||||
export class UserComponent implements AfterViewInit {
|
||||
cellEditing: GuiCellEdit = {
|
||||
enabled: true,
|
||||
rowEdit: (value: any, item: any, index: number) => {
|
||||
@@ -21,7 +21,14 @@ export class UserComponent {
|
||||
}
|
||||
}
|
||||
|
||||
constructor(private refreshService: RefreshService) { }
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.refreshService.removeAll()
|
||||
this.refreshService.add(() => {
|
||||
this.userTable.fetchData();
|
||||
});
|
||||
}
|
||||
|
||||
@ViewChild("userTable") userTable!: UserTableComponent
|
||||
}
|
||||
Reference in New Issue
Block a user