diff --git a/kdb-bot/src/bot_graphql/filter/auto_role_filter.py b/kdb-bot/src/bot_graphql/filter/auto_role_filter.py
index 20d9d886..6f17dd59 100644
--- a/kdb-bot/src/bot_graphql/filter/auto_role_filter.py
+++ b/kdb-bot/src/bot_graphql/filter/auto_role_filter.py
@@ -45,16 +45,19 @@ class AutoRoleFilter(FilterABC):
query = query.where(lambda x: x.id == self._id)
if self._channel_id is not None:
- query = query.where(lambda x: x.discord_channel_id == self._channel_id)
-
- if self._channel_name is not None and self._channel_id is not None:
query = query.where(
- lambda x: self._bot.get_channel(x.discord_channel_id).name == self._channel_name
- or self._channel_name in self._bot.get_channel(x.discord_channel_id).name
+ lambda x: x.discord_channel_id == self._channel_id or str(self._channel_id) in str(x.discord_channel_id)
+ )
+
+ if self._channel_name is not None:
+ query = query.where(
+ lambda x: x.discord_channel_name == self._channel_name or self._channel_name in x.discord_channel_name
)
if self._message_id is not None:
- query = query.where(lambda x: x.discord_message_id == self._message_id)
+ query = query.where(
+ lambda x: x.discord_message_id == self._message_id or str(self._message_id) in str(x.discord_message_id)
+ )
if self._server is not None:
servers = self._server.filter(query.select(lambda x: x.server)).select(lambda x: x.id)
diff --git a/kdb-web/package.json b/kdb-web/package.json
index 831fe41d..3f58bd6d 100644
--- a/kdb-web/package.json
+++ b/kdb-web/package.json
@@ -1,6 +1,6 @@
{
"name": "kdb-web",
- "version": "1.0.dev130",
+ "version": "1.0.dev134",
"scripts": {
"ng": "ng",
"update-version": "ts-node-esm update-version.ts",
diff --git a/kdb-web/src/app/models/data/auto_role.model.ts b/kdb-web/src/app/models/data/auto_role.model.ts
new file mode 100644
index 00000000..c94e042f
--- /dev/null
+++ b/kdb-web/src/app/models/data/auto_role.model.ts
@@ -0,0 +1,35 @@
+import { Data } from "./data.model";
+import { Server, ServerFilter } from "./server.model";
+
+export interface AutoRole extends Data {
+ id?: number;
+ channelId?: string;
+ channelName?: string;
+ messageId?: string;
+ server?: Server;
+
+ autoRoleRuleCount?: number;
+ autoRoleRules?: AutoRoleRule[];
+}
+
+export interface AutoRoleFilter {
+ id?: number;
+ channelId?: string;
+ channelName?: string;
+ messageId?: string;
+ server?: ServerFilter;
+}
+
+export interface AutoRoleRule extends Data {
+ id?: number;
+ emojiName?: string;
+ roleId?: string;
+ autoRole?: AutoRole;
+}
+
+export interface AutoRoleRuleFilter {
+ id?: number;
+ emojiName?: string;
+ roleId?: string;
+ autoRole?: AutoRoleFilter;
+}
diff --git a/kdb-web/src/app/models/graphql/queries.model.ts b/kdb-web/src/app/models/graphql/queries.model.ts
index 73baaf4a..42022afc 100644
--- a/kdb-web/src/app/models/graphql/queries.model.ts
+++ b/kdb-web/src/app/models/graphql/queries.model.ts
@@ -132,4 +132,20 @@ export class Queries {
}
}
`;
+
+ static autoRolesQuery = `
+ query AutoRoleQuery($filter: AutoRoleFilter, $page: Page, $sort: Sort) {
+ autoRoleCount
+ autoRoles(filter: $filter, page: $page, sort: $sort) {
+ id
+ channelId
+ channelName
+ messageId
+ autoRoleRuleCount
+
+ createdAt
+ modifiedAt
+ }
+ }
+ `;
}
diff --git a/kdb-web/src/app/models/graphql/query.model.ts b/kdb-web/src/app/models/graphql/query.model.ts
index ed6eb037..235ad780 100644
--- a/kdb-web/src/app/models/graphql/query.model.ts
+++ b/kdb-web/src/app/models/graphql/query.model.ts
@@ -1,5 +1,6 @@
import { Server } from "../data/server.model";
import { User } from "../data/user.model";
+import { AutoRole } from "../data/auto_role.model";
export interface Query {
serverCount: number;
@@ -16,3 +17,8 @@ export interface LevelListQuery {
levels: User[];
}
+export interface AutoRoleQuery {
+ autoRoleCount: number;
+ autoRoles: AutoRole[];
+}
+
diff --git a/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html b/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html
index 4aefe844..128fa909 100644
--- a/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html
+++ b/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html
@@ -21,7 +21,7 @@
icon="pi pi-user-plus" (click)="addUser(dt)" [disabled]="isEditingNew">
diff --git a/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.ts b/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.ts
index a9243563..b4ac6706 100644
--- a/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.ts
+++ b/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.ts
@@ -1,20 +1,20 @@
-import { Component, OnInit } from '@angular/core';
-import { catchError, debounceTime, last } from 'rxjs/operators';
-import { AuthRoles } from 'src/app/models/auth/auth-roles.enum';
-import { AuthUserDTO } from 'src/app/models/auth/auth-user.dto';
-import { AuthService } from 'src/app/services/auth/auth.service';
-import { ConfirmationDialogService } from 'src/app/services/confirmation-dialog/confirmation-dialog.service';
-import { SpinnerService } from 'src/app/services/spinner/spinner.service';
-import { ToastService } from 'src/app/services/toast/toast.service';
-import { Table } from 'primeng/table';
-import { ServiceErrorCode } from 'src/app/models/error/service-error-code.enum';
-import { RegisterErrorMessages } from 'src/app/models/auth/register-error-messages.enum';
-import { ErrorDTO } from 'src/app/models/error/error-dto';
-import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
-import { AuthUserSelectCriterion } from 'src/app/models/selection/auth-user/auth-user-select-criterion.dto';
-import { LazyLoadEvent } from 'primeng/api';
-import { throwError } from 'rxjs';
-import { TranslateService } from '@ngx-translate/core';
+import { Component, OnInit } from "@angular/core";
+import { catchError, debounceTime } from "rxjs/operators";
+import { AuthRoles } from "src/app/models/auth/auth-roles.enum";
+import { AuthUserDTO } from "src/app/models/auth/auth-user.dto";
+import { AuthService } from "src/app/services/auth/auth.service";
+import { ConfirmationDialogService } from "src/app/services/confirmation-dialog/confirmation-dialog.service";
+import { SpinnerService } from "src/app/services/spinner/spinner.service";
+import { ToastService } from "src/app/services/toast/toast.service";
+import { Table } from "primeng/table";
+import { ServiceErrorCode } from "src/app/models/error/service-error-code.enum";
+import { RegisterErrorMessages } from "src/app/models/auth/register-error-messages.enum";
+import { ErrorDTO } from "src/app/models/error/error-dto";
+import { FormBuilder, FormControl, FormGroup } from "@angular/forms";
+import { AuthUserSelectCriterion } from "src/app/models/selection/auth-user/auth-user-select-criterion.dto";
+import { LazyLoadEvent } from "primeng/api";
+import { throwError } from "rxjs";
+import { TranslateService } from "@ngx-translate/core";
@Component({
@@ -162,7 +162,7 @@ export class AuthUserComponent implements OnInit {
this.loadNextPage();
}
- resetFilters(table: Table) {
+ resetFilters() {
this.filterForm.reset();
}
@@ -309,7 +309,6 @@ export class AuthUserComponent implements OnInit {
addUser(table: Table) {
const newUser = JSON.parse(JSON.stringify(this.newUserTemplate));
newUser.id = Math.max.apply(Math, this.users.map(u => { return u.id ?? 0; })) + 1;
- console.log(newUser);
this.users.push(newUser);
this.triggerUserChangeDetection();
diff --git a/kdb-web/src/app/modules/view/server/auto-role/auto-role-routing.module.ts b/kdb-web/src/app/modules/view/server/auto-role/auto-role-routing.module.ts
new file mode 100644
index 00000000..fa90d850
--- /dev/null
+++ b/kdb-web/src/app/modules/view/server/auto-role/auto-role-routing.module.ts
@@ -0,0 +1,18 @@
+import { NgModule } from "@angular/core";
+import { RouterModule, Routes } from "@angular/router";
+import { AutoRolesComponent } from "./components/auto-roles/auto-roles.component";
+import { AutoRolesRulesComponent } from "./components/auto-roles-rules/auto-roles-rules.component";
+
+const routes: Routes = [
+
+ { path: "", component: AutoRolesComponent },
+ { path: ":autoRoleId/rules", component: AutoRolesRulesComponent }
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule]
+})
+export class AutoRoleRoutingModule {
+
+}
diff --git a/kdb-web/src/app/modules/view/server/auto-role/auto-role.module.ts b/kdb-web/src/app/modules/view/server/auto-role/auto-role.module.ts
new file mode 100644
index 00000000..6d5b3248
--- /dev/null
+++ b/kdb-web/src/app/modules/view/server/auto-role/auto-role.module.ts
@@ -0,0 +1,21 @@
+import { NgModule } from "@angular/core";
+import { CommonModule } from "@angular/common";
+
+import { AutoRoleRoutingModule } from "./auto-role-routing.module";
+import { AutoRolesComponent } from "./components/auto-roles/auto-roles.component";
+import { AutoRolesRulesComponent } from "./components/auto-roles-rules/auto-roles-rules.component";
+import { SharedModule } from "../../../shared/shared.module";
+
+
+@NgModule({
+ declarations: [
+ AutoRolesComponent,
+ AutoRolesRulesComponent
+ ],
+ imports: [
+ CommonModule,
+ AutoRoleRoutingModule,
+ SharedModule,
+ ]
+})
+export class AutoRoleModule { }
diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html
new file mode 100644
index 00000000..03f26bd4
--- /dev/null
+++ b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html
@@ -0,0 +1 @@
+
auto-roles-rules works!
diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.scss b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.spec.ts b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.spec.ts
new file mode 100644
index 00000000..33059010
--- /dev/null
+++ b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { AutoRolesRulesComponent } from './auto-roles-rules.component';
+
+describe('AutoRolesRulesComponent', () => {
+ let component: AutoRolesRulesComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ AutoRolesRulesComponent ]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(AutoRolesRulesComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts
new file mode 100644
index 00000000..2440f09d
--- /dev/null
+++ b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts
@@ -0,0 +1,10 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'app-auto-roles-rules',
+ templateUrl: './auto-roles-rules.component.html',
+ styleUrls: ['./auto-roles-rules.component.scss']
+})
+export class AutoRolesRulesComponent {
+
+}
diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html
new file mode 100644
index 00000000..ee1ac4af
--- /dev/null
+++ b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html
@@ -0,0 +1,219 @@
+
+ {{'view.server.auto_roles.header' | translate}}
+
+
+
+
+
+
+
+
+ {{auto_roles.length}} {{'view.server.auto_roles.of' | translate}}
+ {{dt.totalRecords}}
+
+ {{'view.server.auto_roles.auto_roles' | translate}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+ {{autoRole.id}}
+
+
+ {{autoRole.id}}
+
+
+ |
+
+
+
+
+ {{autoRole.channelId}}
+
+
+ {{autoRole.channelId}}
+
+
+ |
+
+
+
+
+ {{autoRole.channelName}}
+
+
+ {{autoRole.channelName}}
+
+
+ |
+
+
+
+
+ {{autoRole.messageId}}
+
+
+ {{autoRole.messageId}}
+
+
+ |
+
+
+
+
+ {{autoRole.autoRoleRuleCount}}
+
+
+ {{autoRole.autoRoleRuleCount}}
+
+
+ |
+
+
+
+
+ {{autoRole.createdAt | date:'dd.MM.yy HH:mm'}}
+
+
+ {{autoRole.createdAt | date:'dd.MM.yy HH:mm'}}
+
+
+ |
+
+
+
+
+ {{autoRole.modifiedAt | date:'dd.MM.yy HH:mm'}}
+
+
+ {{autoRole.modifiedAt | date:'dd.MM.yy HH:mm'}}
+
+
+ |
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ {{'view.server.auto_roles.no_entries_found' | translate}} |
+
+
+
+
+
+
+
+
+
diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.scss b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.spec.ts b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.spec.ts
new file mode 100644
index 00000000..88577828
--- /dev/null
+++ b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { AutoRolesComponent } from './auto-roles.component';
+
+describe('AutoRolesComponent', () => {
+ let component: AutoRolesComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ AutoRolesComponent ]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(AutoRolesComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.ts b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.ts
new file mode 100644
index 00000000..a995cd83
--- /dev/null
+++ b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.ts
@@ -0,0 +1,221 @@
+import { Component, OnInit } from "@angular/core";
+import { User } from "../../../../../../models/data/user.model";
+import { LazyLoadEvent } from "primeng/api";
+import { FormBuilder, FormControl, FormGroup } from "@angular/forms";
+import { Page } from "../../../../../../models/graphql/filter/page.model";
+import { Sort, SortDirection } from "../../../../../../models/graphql/filter/sort.model";
+import { AuthService } from "../../../../../../services/auth/auth.service";
+import { SpinnerService } from "../../../../../../services/spinner/spinner.service";
+import { ToastService } from "../../../../../../services/toast/toast.service";
+import { ConfirmationDialogService } from "../../../../../../services/confirmation-dialog/confirmation-dialog.service";
+import { TranslateService } from "@ngx-translate/core";
+import { DataService } from "../../../../../../services/data/data.service";
+import { SidebarService } from "../../../../../../services/sidebar/sidebar.service";
+import { ActivatedRoute } from "@angular/router";
+import { AutoRoleQuery } from "../../../../../../models/graphql/query.model";
+import { Queries } from "../../../../../../models/graphql/queries.model";
+import { catchError, debounceTime } from "rxjs/operators";
+import { Table } from "primeng/table";
+import { UpdateUserMutationResult } from "../../../../../../models/graphql/result.model";
+import { Mutations } from "../../../../../../models/graphql/mutations.model";
+import { throwError } from "rxjs";
+import { AutoRole, AutoRoleFilter } from "../../../../../../models/data/auto_role.model";
+
+@Component({
+ selector: "app-auto-roles",
+ templateUrl: "./auto-roles.component.html",
+ styleUrls: ["./auto-roles.component.scss"]
+})
+export class AutoRolesComponent implements OnInit {
+ auto_roles!: AutoRole[];
+ loading = true;
+
+ clonedUsers: { [s: string]: User; } = {};
+ isEditingNew: boolean = false;
+
+ newAutoRoleTemplate: AutoRole = {
+ id: 0,
+ createdAt: "",
+ modifiedAt: ""
+ };
+
+ filterForm!: FormGroup<{
+ id: FormControl,
+ channelId: FormControl,
+ channelName: FormControl,
+ messageId: FormControl,
+ }>;
+
+ filter: AutoRoleFilter = {};
+ page: Page = {
+ pageSize: undefined,
+ pageIndex: undefined
+ };
+ sort: Sort = {
+ sortColumn: undefined,
+ sortDirection: undefined
+ };
+
+ totalRecords!: number;
+
+ constructor(
+ private authService: AuthService,
+ private spinner: SpinnerService,
+ private toastService: ToastService,
+ private confirmDialog: ConfirmationDialogService,
+ private fb: FormBuilder,
+ private translate: TranslateService,
+ private data: DataService,
+ private sidebar: SidebarService,
+ private route: ActivatedRoute
+ ) {
+ }
+
+ ngOnInit(): void {
+ this.data.getServerFromRoute(this.route);
+
+ this.setFilterForm();
+ this.loadNextPage();
+ }
+
+ loadNextPage() {
+ this.loading = true;
+ this.data.query(Queries.autoRolesQuery, {
+ filter: this.filter, page: this.page, sort: this.sort
+ }
+ ).subscribe(data => {
+ this.totalRecords = data.autoRoleCount;
+ this.auto_roles = data.autoRoles;
+ this.spinner.hideSpinner();
+ this.loading = false;
+ });
+ }
+
+ setFilterForm() {
+ this.filterForm = this.fb.group({
+ id: new FormControl(null),
+ channelId: new FormControl(null),
+ channelName: new FormControl(null),
+ messageId: new FormControl(null),
+ });
+
+ this.filterForm.valueChanges.pipe(
+ debounceTime(600)
+ ).subscribe(changes => {
+ if (changes.id) {
+ this.filter.id = changes.id;
+ } else {
+ this.filter.id = undefined;
+ }
+
+ if (changes.channelId) {
+ this.filter.channelId = changes.channelId;
+ } else {
+ this.filter.channelId = undefined;
+ }
+
+ if (changes.channelName) {
+ this.filter.channelName = changes.channelName;
+ } else {
+ this.filter.channelName = undefined;
+ }
+
+ if (changes.messageId) {
+ this.filter.messageId = changes.messageId;
+ } else {
+ this.filter.messageId = undefined;
+ }
+
+ if (this.page.pageSize)
+ this.page.pageSize = 10;
+
+ if (this.page.pageIndex)
+ this.page.pageIndex = 0;
+
+ this.loadNextPage();
+ });
+ }
+
+ nextPage(event: LazyLoadEvent) {
+ this.page.pageSize = event.rows ?? 0;
+ if (event.first != null && event.rows != null)
+ this.page.pageIndex = event.first / event.rows;
+ this.sort.sortColumn = event.sortField ?? undefined;
+ this.sort.sortDirection = event.sortOrder === 1 ? SortDirection.ASC : event.sortOrder === -1 ? SortDirection.DESC : SortDirection.ASC;
+
+ this.loadNextPage();
+ }
+
+ resetFilters() {
+ this.filterForm.reset();
+ }
+
+ onRowEditInit(table: Table, user: User, index: number) {
+ this.clonedUsers[index] = { ...user };
+ }
+
+ onRowEditSave(table: Table, newUser: User, index: number) {
+ // const oldUser = this.clonedUsers[index];
+ // delete this.clonedUsers[index];
+
+ // if (JSON.stringify(oldUser) === JSON.stringify(newUser) && !this.isEditingNew) {
+ // console.log(1, oldUser, newUser, JSON.stringify(oldUser) === JSON.stringify(newUser), !this.isEditingNew);
+ // return;
+ // }
+
+ if (this.isEditingNew && JSON.stringify(newUser) === JSON.stringify(this.newAutoRoleTemplate)) {
+ this.isEditingNew = false;
+ this.auto_roles.splice(index, 1);
+ return;
+ }
+
+ if (!newUser.id || !newUser.xp && !newUser.level?.id) {
+ return;
+ }
+
+ this.spinner.showSpinner();
+ this.data.mutation(Mutations.updateUser, {
+ id: newUser.id,
+ xp: newUser.xp,
+ levelId: newUser.level?.id
+ }
+ ).pipe(catchError(err => {
+ this.spinner.hideSpinner();
+ this.toastService.error(this.translate.instant("view.server.members.message.user_change_failed"), this.translate.instant("view.server.members.message.user_change_failed_d", { name: newUser.name }));
+ return throwError(err);
+ })).subscribe(_ => {
+ this.spinner.hideSpinner();
+ this.toastService.success(this.translate.instant("view.server.members.message.user_changed"), this.translate.instant("view.server.members.message.user_changed_d", { name: newUser.name }));
+ this.loadNextPage();
+ });
+
+ }
+
+ onRowEditCancel(user: User, index: number) {
+ if (this.isEditingNew) {
+ this.auto_roles.splice(index, 1);
+ delete this.clonedUsers[index];
+ this.isEditingNew = false;
+ return;
+ }
+
+ this.auto_roles[index] = this.clonedUsers[index];
+ delete this.clonedUsers[index];
+ }
+
+ addUser(table: Table) {
+ const newAutoRole = JSON.parse(JSON.stringify(this.newAutoRoleTemplate));
+ newAutoRole.id = Math.max.apply(Math, this.auto_roles.map(u => {
+ return u.id ?? 0;
+ })) + 1;
+
+ this.auto_roles.push(newAutoRole);
+
+ table.initRowEdit(newAutoRole);
+
+ const index = this.auto_roles.findIndex(u => u.id == newAutoRole.id);
+ this.onRowEditInit(table, newAutoRole, index);
+
+ this.isEditingNew = true;
+ }
+}
diff --git a/kdb-web/src/app/modules/view/server/members/members.component.ts b/kdb-web/src/app/modules/view/server/members/members.component.ts
index bc98e1ee..51bf7cba 100644
--- a/kdb-web/src/app/modules/view/server/members/members.component.ts
+++ b/kdb-web/src/app/modules/view/server/members/members.component.ts
@@ -1,4 +1,4 @@
-import { Component } from "@angular/core";
+import { Component, OnInit } from "@angular/core";
import { FormBuilder, FormControl, FormGroup } from "@angular/forms";
import { AuthService } from "../../../../services/auth/auth.service";
import { SpinnerService } from "../../../../services/spinner/spinner.service";
@@ -25,13 +25,13 @@ import { ActivatedRoute } from "@angular/router";
templateUrl: "./members.component.html",
styleUrls: ["./members.component.scss"]
})
-export class MembersComponent {
+export class MembersComponent implements OnInit {
members!: User[];
// levelsFilter!: MenuItem[];
levels!: MenuItem[];
leftServerOptions = [
- {label: this.translate.instant('common.bool_as_string.true'), value: false},
- {label: this.translate.instant('common.bool_as_string.false'), value: true},
+ { label: this.translate.instant("common.bool_as_string.true"), value: false },
+ { label: this.translate.instant("common.bool_as_string.false"), value: true }
];
loading = true;
@@ -132,7 +132,7 @@ export class MembersComponent {
discordId: new FormControl(null),
name: [""],
leftServer: new FormControl(null),
- level: new FormControl(null),
+ level: new FormControl(null)
});
this.filterForm.valueChanges.pipe(
diff --git a/kdb-web/src/app/modules/view/server/server-routing.module.ts b/kdb-web/src/app/modules/view/server/server-routing.module.ts
index d4de8413..b390b0b8 100644
--- a/kdb-web/src/app/modules/view/server/server-routing.module.ts
+++ b/kdb-web/src/app/modules/view/server/server-routing.module.ts
@@ -8,6 +8,7 @@ const routes: Routes = [
{ path: '', component: ServerDashboardComponent },
{ path: 'members', component: MembersComponent },
{ path: 'members/:memberId', component: ProfileComponent },
+ { path: 'auto-roles', loadChildren: () => import('./auto-role/auto-role.module').then(m => m.AutoRoleModule)},
];
@NgModule({
diff --git a/kdb-web/src/app/services/sidebar/sidebar.service.ts b/kdb-web/src/app/services/sidebar/sidebar.service.ts
index 5a7a23a6..601a8ad0 100644
--- a/kdb-web/src/app/services/sidebar/sidebar.service.ts
+++ b/kdb-web/src/app/services/sidebar/sidebar.service.ts
@@ -8,6 +8,7 @@ import { NavigationEnd, Router } from "@angular/router";
import { ThemeService } from "../theme/theme.service";
import { Server } from "../../models/data/server.model";
import { UserDTO } from "../../models/auth/auth-user.dto";
+import { AutoRole } from "../../models/data/auto_role.model";
@Injectable({
providedIn: "root"
@@ -17,11 +18,14 @@ export class SidebarService {
isSidebarOpen: boolean = true;
menuItems$ = new BehaviorSubject