refactor: Spaltennamen-Injektion durch Environment-Variablen ersetzt

This commit is contained in:
Developer 02 2024-07-22 18:17:49 +02:00
parent 3cbd0523eb
commit 2212ebfc45
8 changed files with 24 additions and 18 deletions

View File

@ -2,10 +2,11 @@ import { Component, Inject } from '@angular/core';
import { BaseTableComponent } from '../base-table/base-table.component';
import { DirGroupService } from '../../../services/dir-group.service';
import { DirGroup } from '../../../models/user-management.api.models';
import { GuiColumn, GuiGridModule } from '@generic-ui/ngx-grid';
import { GuiGridModule } from '@generic-ui/ngx-grid';
import { ColorModeService } from '../../../services/color-mode.service';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { env } from '../../../../environments/environment';
@Component({
standalone: true,
@ -15,7 +16,7 @@ import { FormsModule } from '@angular/forms';
styleUrl: './dir-group-table.component.css'
})
export class DirGroupTableComponent extends BaseTableComponent<DirGroup, DirGroupService> {
constructor(service: DirGroupService, @Inject('DIR_GROUP_TABLE_COLUMNS') columns: Array<GuiColumn>, cModeService: ColorModeService) {
super(service, columns, cModeService)
constructor(service: DirGroupService, cModeService: ColorModeService) {
super(service, env.columnNames.dirGroup, cModeService)
}
}

View File

@ -6,6 +6,7 @@ import { GuiGridModule, GuiColumn } from '@generic-ui/ngx-grid';
import { ColorModeService } from '../../../services/color-mode.service';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { env } from '../../../../environments/environment';
@Component({
standalone: true,
@ -15,8 +16,8 @@ import { FormsModule } from '@angular/forms';
styleUrl: './dir-user-table.component.css'
})
export class DirUserTableComponent extends BaseTableComponent<DirUser, DirUserService> {
constructor(service: DirUserService, @Inject('DIR_USER_TABLE_COLUMNS') columns: Array<GuiColumn>, cModeService: ColorModeService) {
super(service, columns, cModeService)
constructor(service: DirUserService, cModeService: ColorModeService) {
super(service, env.columnNames.dirUser, cModeService)
}
fetchDataByGroupName(groupName: string): void {

View File

@ -6,6 +6,7 @@ import { BaseTableComponent } from '../base-table/base-table.component';
import { ColorModeService } from '../../../services/color-mode.service';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { env } from '../../../../environments/environment';
@Component({
standalone: true,
@ -16,7 +17,7 @@ import { FormsModule } from '@angular/forms';
})
export class GroupTableComponent extends BaseTableComponent<Group, GroupService> {
constructor(
service: GroupService, @Inject('GROUP_COMPLETE_TABLE_COLUMNS') columns: Array<GuiColumn>, cModeService: ColorModeService) {
super(service, columns, cModeService)
service: GroupService, cModeService: ColorModeService) {
super(service, env.columnNames.group.complete, cModeService)
}
}

View File

@ -6,6 +6,7 @@ import { BaseTableComponent } from '../base-table/base-table.component';
import { ColorModeService } from '../../../services/color-mode.service';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { env } from '../../../../environments/environment';
@Component({
standalone: true,
@ -15,8 +16,8 @@ import { FormsModule } from '@angular/forms';
styleUrl: './group-user-table.component.css'
})
export class GroupUserTableComponent extends BaseTableComponent<GroupOfUser, GroupOfUserService> {
constructor(service: GroupOfUserService, @Inject('GROUP_USER_TABLE_COLUMNS') columns: Array<GuiColumn>, cModeService: ColorModeService) {
super(service, columns, cModeService)
constructor(service: GroupOfUserService, cModeService: ColorModeService) {
super(service, env.columnNames.groupOfUser, cModeService)
this.initData = () => this.fetchDataWith(true,true);
this.loading = false;
}

View File

@ -1,11 +1,12 @@
import { Component, Inject } from '@angular/core';
import { Component } from '@angular/core';
import { Module } from '../../../models/user-management.api.models';
import { GuiGridModule, GuiColumn } from '@generic-ui/ngx-grid';
import { GuiGridModule } from '@generic-ui/ngx-grid';
import { BaseTableComponent } from '../base-table/base-table.component';
import { ModuleService } from '../../../services/module.service'
import { ColorModeService } from '../../../services/color-mode.service';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { env } from '../../../../environments/environment';
@Component({
standalone: true,
@ -16,7 +17,7 @@ import { FormsModule } from '@angular/forms';
})
export class ModuleTableComponent extends BaseTableComponent<Module, ModuleService> {
constructor(
service: ModuleService, @Inject('MODULE_TABLE_COLUMNS') columns: Array<GuiColumn>, cModeService: ColorModeService) {
super(service, columns, cModeService)
service: ModuleService, cModeService: ColorModeService) {
super(service, env.columnNames.module, cModeService)
}
}

View File

@ -6,6 +6,7 @@ import { GuiGridModule, GuiColumn } from '@generic-ui/ngx-grid';
import { ColorModeService } from '../../../services/color-mode.service';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { env } from '../../../../environments/environment';
@Component({
standalone: true,
@ -16,8 +17,8 @@ import { FormsModule } from '@angular/forms';
})
export class UserRepTableComponent extends BaseTableComponent<UserRep, UserRepService> {
constructor(service: UserRepService, @Inject('USER_REP_TABLE_COLUMNS') columns: Array<GuiColumn>, cModeService: ColorModeService) {
super(service, columns, cModeService)
constructor(service: UserRepService, cModeService: ColorModeService) {
super(service, env.columnNames.userRep, cModeService)
this.loading = false
}

View File

@ -8,6 +8,7 @@ import { BaseTableComponent } from '../base-table/base-table.component';
import { ColorModeService } from '../../../services/color-mode.service'
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { env } from '../../../../environments/environment';
@Component({
standalone: true,
@ -24,9 +25,8 @@ export class UserTableComponent extends BaseTableComponent<User, UserService> {
constructor(mosService: ModuleOfUserService,
gosService: GroupOfUserService,
service: UserService,
@Inject('USER_TABLE_COLUMNS') columns: Array<GuiColumn>,
cModeService: ColorModeService) {
super(service, columns, cModeService)
super(service, env.columnNames.user, cModeService)
this.mosService = mosService;
this.gosService = gosService;
}

View File

@ -22,7 +22,7 @@ export class NavMenuComponent {
isExpanded = false;
constructor(public dialog: MatDialog, private authService: AuthenticationService) {
this.authService.isAuthenticated().then(console.log).catch(console.log)
this.authService.isAuthenticated().then().catch()
}
get isDarkTheme(): boolean {