Compare commits
	
		
			2 Commits
		
	
	
		
			79837afdfb
			...
			4266db7e35
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 4266db7e35 | |||
| 667b9fa87e | 
@@ -1,16 +0,0 @@
 | 
				
			|||||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
 | 
					 | 
				
			||||||
# For additional information regarding the format and rule options, please see:
 | 
					 | 
				
			||||||
# https://github.com/browserslist/browserslist#queries
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# For the full list of supported browsers by the Angular framework, please see:
 | 
					 | 
				
			||||||
# https://angular.io/guide/browser-support
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# You can see what browsers were selected by your queries by running:
 | 
					 | 
				
			||||||
#   npx browserslist
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
last 1 Chrome version
 | 
					 | 
				
			||||||
last 1 Firefox version
 | 
					 | 
				
			||||||
last 2 Edge major versions
 | 
					 | 
				
			||||||
last 2 Safari major versions
 | 
					 | 
				
			||||||
last 2 iOS major versions
 | 
					 | 
				
			||||||
Firefox ESR
 | 
					 | 
				
			||||||
							
								
								
									
										41199
									
								
								kdb-web/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										41199
									
								
								kdb-web/package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    "name": "kdb-web",
 | 
					    "name": "kdb-web",
 | 
				
			||||||
    "version": "0.3.dev162",
 | 
					    "version": "0.3.dev162-2",
 | 
				
			||||||
    "scripts": {
 | 
					    "scripts": {
 | 
				
			||||||
        "ng": "ng",
 | 
					        "ng": "ng",
 | 
				
			||||||
        "update-version": "ts-node-esm update-version.ts",
 | 
					        "update-version": "ts-node-esm update-version.ts",
 | 
				
			||||||
@@ -16,29 +16,29 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "private": true,
 | 
					    "private": true,
 | 
				
			||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
        "@angular/animations": "^14.0.0",
 | 
					        "@angular/animations": "^15.1.4",
 | 
				
			||||||
        "@angular/common": "^14.0.0",
 | 
					        "@angular/common": "^15.1.4",
 | 
				
			||||||
        "@angular/compiler": "^14.0.0",
 | 
					        "@angular/compiler": "^15.1.4",
 | 
				
			||||||
        "@angular/core": "^14.0.0",
 | 
					        "@angular/core": "^15.1.4",
 | 
				
			||||||
        "@angular/forms": "^14.0.0",
 | 
					        "@angular/forms": "^15.1.4",
 | 
				
			||||||
        "@angular/platform-browser": "^14.0.0",
 | 
					        "@angular/platform-browser": "^15.1.4",
 | 
				
			||||||
        "@angular/platform-browser-dynamic": "^14.0.0",
 | 
					        "@angular/platform-browser-dynamic": "^15.1.4",
 | 
				
			||||||
        "@angular/router": "^14.0.0",
 | 
					        "@angular/router": "^15.1.4",
 | 
				
			||||||
        "@auth0/angular-jwt": "^5.1.0",
 | 
					        "@auth0/angular-jwt": "^5.1.0",
 | 
				
			||||||
        "@microsoft/signalr": "^6.0.9",
 | 
					        "@microsoft/signalr": "^6.0.9",
 | 
				
			||||||
        "@ngx-translate/core": "^14.0.0",
 | 
					        "@ngx-translate/core": "^14.0.0",
 | 
				
			||||||
        "@ngx-translate/http-loader": "^7.0.0",
 | 
					        "@ngx-translate/http-loader": "^7.0.0",
 | 
				
			||||||
        "@types/socket.io-client": "^3.0.0",
 | 
					        "@types/socket.io-client": "^3.0.0",
 | 
				
			||||||
        "primeicons": "^6.0.1",
 | 
					        "primeicons": "^6.0.1",
 | 
				
			||||||
        "primeng": "^14.1.2",
 | 
					        "primeng": "^15.2.0",
 | 
				
			||||||
        "rxjs": "~7.5.0",
 | 
					        "rxjs": "~7.5.0",
 | 
				
			||||||
        "socket.io-client": "^4.5.3",
 | 
					        "socket.io-client": "^4.5.3",
 | 
				
			||||||
        "zone.js": "~0.11.4"
 | 
					        "zone.js": "~0.11.4"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "devDependencies": {
 | 
					    "devDependencies": {
 | 
				
			||||||
        "@angular-devkit/build-angular": "^14.0.0",
 | 
					        "@angular-devkit/build-angular": "^15.1.5",
 | 
				
			||||||
        "@angular/cli": "~14.0.0",
 | 
					        "@angular/cli": "~15.1.5",
 | 
				
			||||||
        "@angular/compiler-cli": "^14.0.0",
 | 
					        "@angular/compiler-cli": "^15.1.4",
 | 
				
			||||||
        "@types/jasmine": "~4.0.0",
 | 
					        "@types/jasmine": "~4.0.0",
 | 
				
			||||||
        "@types/node": "^18.11.9",
 | 
					        "@types/node": "^18.11.9",
 | 
				
			||||||
        "jasmine-core": "~4.1.0",
 | 
					        "jasmine-core": "~4.1.0",
 | 
				
			||||||
@@ -48,6 +48,6 @@
 | 
				
			|||||||
        "karma-jasmine": "~5.0.0",
 | 
					        "karma-jasmine": "~5.0.0",
 | 
				
			||||||
        "karma-jasmine-html-reporter": "~1.7.0",
 | 
					        "karma-jasmine-html-reporter": "~1.7.0",
 | 
				
			||||||
        "tslib": "^2.4.1",
 | 
					        "tslib": "^2.4.1",
 | 
				
			||||||
        "typescript": "~4.7.2"
 | 
					        "typescript": "~4.9.5"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { HttpClient } from '@angular/common/http';
 | 
					import { HttpClient, HttpClientModule } from '@angular/common/http';
 | 
				
			||||||
import { APP_INITIALIZER, ErrorHandler, NgModule } from '@angular/core';
 | 
					import { APP_INITIALIZER, ErrorHandler, NgModule } from '@angular/core';
 | 
				
			||||||
import { BrowserModule } from '@angular/platform-browser';
 | 
					import { BrowserModule } from '@angular/platform-browser';
 | 
				
			||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 | 
					import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 | 
				
			||||||
@@ -47,7 +47,8 @@ import { SettingsService } from './services/settings/settings.service';
 | 
				
			|||||||
        useFactory: HttpLoaderFactory,
 | 
					        useFactory: HttpLoaderFactory,
 | 
				
			||||||
        deps: [HttpClient]
 | 
					        deps: [HttpClient]
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    }),
 | 
				
			||||||
 | 
					    HttpClientModule
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  providers: [
 | 
					  providers: [
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ export class SidebarComponent implements OnInit {
 | 
				
			|||||||
  isSidebarOpen: boolean = true;
 | 
					  isSidebarOpen: boolean = true;
 | 
				
			||||||
  menuItems!: MenuItem[];
 | 
					  menuItems!: MenuItem[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private serverId!: number;
 | 
					  private serverId?: number;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    private authService: AuthService,
 | 
					    private authService: AuthService,
 | 
				
			||||||
@@ -40,7 +40,7 @@ export class SidebarComponent implements OnInit {
 | 
				
			|||||||
        return;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.serverId = server.serverId;
 | 
					      this.serverId = server.id;
 | 
				
			||||||
      this.setMenu();
 | 
					      this.setMenu();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								kdb-web/src/app/models/data/data.model.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								kdb-web/src/app/models/data/data.model.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					export interface Data {
 | 
				
			||||||
 | 
					  createdAt: string;
 | 
				
			||||||
 | 
					  modifiedAt: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										16
									
								
								kdb-web/src/app/models/data/server.model.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								kdb-web/src/app/models/data/server.model.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					import { Data } from "./data.model";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface Server extends Data {
 | 
				
			||||||
 | 
					  id?: number;
 | 
				
			||||||
 | 
					  discordId?: number;
 | 
				
			||||||
 | 
					  name?: string;
 | 
				
			||||||
 | 
					  iconURL?: string;
 | 
				
			||||||
 | 
					  autoRoleCount?: number;
 | 
				
			||||||
 | 
					  autoRoles?: [];
 | 
				
			||||||
 | 
					  clientCount?: number;
 | 
				
			||||||
 | 
					  clients?: [];
 | 
				
			||||||
 | 
					  levelCount?: number;
 | 
				
			||||||
 | 
					  levels?: [];
 | 
				
			||||||
 | 
					  userCount?: number;
 | 
				
			||||||
 | 
					  users?: [];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
export interface ServerDTO {
 | 
					 | 
				
			||||||
    serverId: number;
 | 
					 | 
				
			||||||
    discordId: number;
 | 
					 | 
				
			||||||
    name: string;
 | 
					 | 
				
			||||||
    memberCount: number;
 | 
					 | 
				
			||||||
    iconURL: string | null;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
import { AuthUserDTO } from "../../auth/auth-user.dto";
 | 
					 | 
				
			||||||
import { ServerDTO } from "../../discord/server.dto";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface GetFilteredServersResultDTO {
 | 
					 | 
				
			||||||
    servers: ServerDTO[];
 | 
					 | 
				
			||||||
    totalCount: number;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
import { SelectCriterion } from "../select-criterion.model";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface ServerSelectCriterion extends SelectCriterion {
 | 
					 | 
				
			||||||
    name: string | null;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -38,7 +38,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        <div class="data">
 | 
					                        <div class="data">
 | 
				
			||||||
                            <i class="pi pi-users"></i>
 | 
					                            <i class="pi pi-users"></i>
 | 
				
			||||||
                            {{server.memberCount}}
 | 
					                            {{server.userCount}}
 | 
				
			||||||
                            {{'view.dashboard.server.member_count' | translate}}
 | 
					                            {{'view.dashboard.server.member_count' | translate}}
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
@@ -47,4 +47,4 @@
 | 
				
			|||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,15 @@
 | 
				
			|||||||
import { Component, OnInit } from '@angular/core';
 | 
					import { Component, OnInit } from "@angular/core";
 | 
				
			||||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
 | 
					import { FormBuilder, FormControl, FormGroup } from "@angular/forms";
 | 
				
			||||||
import { Router } from '@angular/router';
 | 
					import { Router } from "@angular/router";
 | 
				
			||||||
import { TranslateService } from '@ngx-translate/core';
 | 
					import { TranslateService } from "@ngx-translate/core";
 | 
				
			||||||
import { LazyLoadEvent } from 'primeng/api';
 | 
					import { LazyLoadEvent } from "primeng/api";
 | 
				
			||||||
import { catchError, debounceTime, throwError } from 'rxjs';
 | 
					import { debounceTime } from "rxjs";
 | 
				
			||||||
import { ServerDTO } from 'src/app/models/discord/server.dto';
 | 
					import { ConfirmationDialogService } from "src/app/services/confirmation-dialog/confirmation-dialog.service";
 | 
				
			||||||
import { ServerSelectCriterion } from 'src/app/models/selection/server/server-select-criterion.dto';
 | 
					import { DataService } from "src/app/services/data/data.service";
 | 
				
			||||||
import { ConfirmationDialogService } from 'src/app/services/confirmation-dialog/confirmation-dialog.service';
 | 
					import { ServerService } from "src/app/services/data/server.service";
 | 
				
			||||||
import { DataService } from 'src/app/services/data/data.service';
 | 
					import { SpinnerService } from "src/app/services/spinner/spinner.service";
 | 
				
			||||||
import { ServerService } from 'src/app/services/data/server.service';
 | 
					import { ToastService } from "src/app/services/toast/toast.service";
 | 
				
			||||||
import { SpinnerService } from 'src/app/services/spinner/spinner.service';
 | 
					import { Server } from "../../../../../models/data/server.model";
 | 
				
			||||||
import { ToastService } from 'src/app/services/toast/toast.service';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component({
 | 
					@Component({
 | 
				
			||||||
  selector: 'app-dashboard',
 | 
					  selector: 'app-dashboard',
 | 
				
			||||||
@@ -19,15 +18,8 @@ import { ToastService } from 'src/app/services/toast/toast.service';
 | 
				
			|||||||
})
 | 
					})
 | 
				
			||||||
export class DashboardComponent implements OnInit {
 | 
					export class DashboardComponent implements OnInit {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  servers: ServerDTO[] = [];
 | 
					  servers: Server[] = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  searchCriterions: ServerSelectCriterion = {
 | 
					 | 
				
			||||||
    name: null,
 | 
					 | 
				
			||||||
    pageIndex: 0,
 | 
					 | 
				
			||||||
    pageSize: 10,
 | 
					 | 
				
			||||||
    sortColumn: null,
 | 
					 | 
				
			||||||
    sortDirection: null
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
  totalRecords!: number;
 | 
					  totalRecords!: number;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -46,10 +38,11 @@ export class DashboardComponent implements OnInit {
 | 
				
			|||||||
    private serverService: ServerService
 | 
					    private serverService: ServerService
 | 
				
			||||||
  ) { }
 | 
					  ) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit(): void {
 | 
					  async ngOnInit(): Promise<void> {
 | 
				
			||||||
    this.spinnerService.showSpinner();
 | 
					    this.spinnerService.showSpinner();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.setFilterForm();
 | 
					    this.setFilterForm();
 | 
				
			||||||
    this.loadNextPage();
 | 
					    await this.loadNextPage();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setFilterForm() {
 | 
					  setFilterForm() {
 | 
				
			||||||
@@ -59,46 +52,46 @@ export class DashboardComponent implements OnInit {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    this.filterForm.valueChanges.pipe(
 | 
					    this.filterForm.valueChanges.pipe(
 | 
				
			||||||
      debounceTime(600)
 | 
					      debounceTime(600)
 | 
				
			||||||
    ).subscribe(changes => {
 | 
					    ).subscribe(async changes => {
 | 
				
			||||||
      if (changes.name) {
 | 
					      // if (changes.name) {
 | 
				
			||||||
        this.searchCriterions.name = changes.name;
 | 
					      //   this.searchCriterions.name = changes.name;
 | 
				
			||||||
      } else {
 | 
					      // } else {
 | 
				
			||||||
        this.searchCriterions.name = null;
 | 
					      //   this.searchCriterions.name = null;
 | 
				
			||||||
      }
 | 
					      // }
 | 
				
			||||||
 | 
					      //
 | 
				
			||||||
 | 
					      // if (this.searchCriterions.pageSize)
 | 
				
			||||||
 | 
					      //   this.searchCriterions.pageSize = 10;
 | 
				
			||||||
 | 
					      //
 | 
				
			||||||
 | 
					      // if (this.searchCriterions.pageSize)
 | 
				
			||||||
 | 
					      //   this.searchCriterions.pageIndex = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (this.searchCriterions.pageSize)
 | 
					      await this.loadNextPage();
 | 
				
			||||||
        this.searchCriterions.pageSize = 10;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (this.searchCriterions.pageSize)
 | 
					 | 
				
			||||||
        this.searchCriterions.pageIndex = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.loadNextPage();
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  loadNextPage() {
 | 
					  async loadNextPage() {
 | 
				
			||||||
    this.spinnerService.showSpinner();
 | 
					    this.spinnerService.showSpinner();
 | 
				
			||||||
    this.data.getFilteredServers(this.searchCriterions).pipe(catchError(err => {
 | 
					    // this.data.getFilteredServers(this.searchCriterions).pipe(catchError(err => {
 | 
				
			||||||
      this.spinnerService.hideSpinner();
 | 
					    //   this.spinnerService.hideSpinner();
 | 
				
			||||||
      return throwError(() => err);
 | 
					    //   return throwError(() => err);
 | 
				
			||||||
    })).subscribe(list => {
 | 
					    // })).subscribe(list => {
 | 
				
			||||||
      this.totalRecords = list.totalCount;
 | 
					    //   this.totalRecords = list.totalCount;
 | 
				
			||||||
      this.servers = list.servers;
 | 
					    //   this.servers = list.servers;
 | 
				
			||||||
      this.spinnerService.hideSpinner();
 | 
					    //   this.spinnerService.hideSpinner();
 | 
				
			||||||
    });
 | 
					    // });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  nextPage(event: LazyLoadEvent) {
 | 
					  nextPage(event: LazyLoadEvent) {
 | 
				
			||||||
    this.searchCriterions.pageSize = event.rows ?? 0;
 | 
					    // this.searchCriterions.pageSize = event.rows ?? 0;
 | 
				
			||||||
    if (event.first != null && event.rows != null)
 | 
					    // if (event.first != null && event.rows != null)
 | 
				
			||||||
      this.searchCriterions.pageIndex = event.first / event.rows;
 | 
					    //   this.searchCriterions.pageIndex = event.first / event.rows;
 | 
				
			||||||
    this.searchCriterions.sortColumn = event.sortField ?? null;
 | 
					    // this.searchCriterions.sortColumn = event.sortField ?? null;
 | 
				
			||||||
    this.searchCriterions.sortDirection = event.sortOrder === 1 ? 'asc' : event.sortOrder === -1 ? 'desc' : 'asc';
 | 
					    // this.searchCriterions.sortDirection = event.sortOrder === 1 ? 'asc' : event.sortOrder === -1 ? 'desc' : 'asc';
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
    if (event.filters) {
 | 
					    // if (event.filters) {
 | 
				
			||||||
      // + "" => convert to string
 | 
					    //   // + "" => convert to string
 | 
				
			||||||
      this.searchCriterions.name = event.filters['name'] ? event.filters['name'] + "" : null;
 | 
					    //   this.searchCriterions.name = event.filters['name'] ? event.filters['name'] + "" : null;
 | 
				
			||||||
    }
 | 
					    // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.loadNextPage();
 | 
					    this.loadNextPage();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -107,7 +100,7 @@ export class DashboardComponent implements OnInit {
 | 
				
			|||||||
    this.filterForm.reset();
 | 
					    this.filterForm.reset();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  selectServer(server: ServerDTO) {
 | 
					  selectServer(server: Server) {
 | 
				
			||||||
    this.serverService.server$.next(server);
 | 
					    this.serverService.server$.next(server);
 | 
				
			||||||
    this.router.navigate(['/server']);
 | 
					    this.router.navigate(['/server']);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        <div class="data">
 | 
					                        <div class="data">
 | 
				
			||||||
                            <i class="pi pi-users"></i>
 | 
					                            <i class="pi pi-users"></i>
 | 
				
			||||||
                            {{server.memberCount}}
 | 
					                            {{server.userCount}}
 | 
				
			||||||
                            {{'view.dashboard.server.member_count' | translate}}
 | 
					                            {{'view.dashboard.server.member_count' | translate}}
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
@@ -33,4 +33,4 @@
 | 
				
			|||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,9 @@
 | 
				
			|||||||
import { Component, OnInit } from '@angular/core';
 | 
					import { Component, OnInit } from "@angular/core";
 | 
				
			||||||
import { ActivatedRoute, Router } from '@angular/router';
 | 
					import { ActivatedRoute, Router } from "@angular/router";
 | 
				
			||||||
import { ServerDTO } from 'src/app/models/discord/server.dto';
 | 
					import { Server } from "src/app/models/data/server.model";
 | 
				
			||||||
import { DataService } from 'src/app/services/data/data.service';
 | 
					import { DataService } from "src/app/services/data/data.service";
 | 
				
			||||||
import { ServerService } from 'src/app/services/data/server.service';
 | 
					import { ServerService } from "src/app/services/data/server.service";
 | 
				
			||||||
import { SpinnerService } from 'src/app/services/spinner/spinner.service';
 | 
					import { SpinnerService } from "src/app/services/spinner/spinner.service";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component({
 | 
					@Component({
 | 
				
			||||||
  selector: 'app-server-dashboard',
 | 
					  selector: 'app-server-dashboard',
 | 
				
			||||||
@@ -13,7 +13,7 @@ import { SpinnerService } from 'src/app/services/spinner/spinner.service';
 | 
				
			|||||||
export class ServerDashboardComponent implements OnInit {
 | 
					export class ServerDashboardComponent implements OnInit {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  id!: number;
 | 
					  id!: number;
 | 
				
			||||||
  server!: ServerDTO;
 | 
					  server!: Server;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    private route: ActivatedRoute,
 | 
					    private route: ActivatedRoute,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -217,7 +217,7 @@ export class AuthService {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getDecodedToken(): { [key: string]: any } {
 | 
					  getDecodedToken(): { [key: string]: any } | null{
 | 
				
			||||||
    return this.jwtHelper.decodeToken(this.getToken().token);
 | 
					    return this.jwtHelper.decodeToken(this.getToken().token);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -288,10 +288,11 @@ export class AuthService {
 | 
				
			|||||||
      return false;
 | 
					      return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const token = this.getDecodedToken();
 | 
					    const token = this.getDecodedToken();
 | 
				
			||||||
 | 
					    if (!token) return false;
 | 
				
			||||||
    return AuthRoles[token['role']] === AuthRoles[role];
 | 
					    return AuthRoles[token['role']] === AuthRoles[role];
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getEMailFromDecodedToken(token: { [key: string]: any }): string | null {
 | 
					  getEMailFromDecodedToken(token: { [key: string]: any } | null): string | null {
 | 
				
			||||||
    if (!token) {
 | 
					    if (!token) {
 | 
				
			||||||
      return null;
 | 
					      return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,53 +1,28 @@
 | 
				
			|||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
 | 
					import { HttpClient } from "@angular/common/http";
 | 
				
			||||||
import { Injectable } from '@angular/core';
 | 
					import { Injectable } from "@angular/core";
 | 
				
			||||||
import { Observable } from 'rxjs';
 | 
					import { SettingsService } from "../settings/settings.service";
 | 
				
			||||||
import { ServerDTO } from 'src/app/models/discord/server.dto';
 | 
					 | 
				
			||||||
import { GetFilteredServersResultDTO } from 'src/app/models/selection/server/get-filtered-servers-result.dto';
 | 
					 | 
				
			||||||
import { ServerSelectCriterion } from 'src/app/models/selection/server/server-select-criterion.dto';
 | 
					 | 
				
			||||||
import { SettingsService } from '../settings/settings.service';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable({
 | 
					@Injectable({
 | 
				
			||||||
  providedIn: 'root'
 | 
					  providedIn: 'root'
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
export class DataService {
 | 
					export class DataService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // serverQuery = this.apollo.watchQuery({
 | 
				
			||||||
 | 
					  //     query: gql`
 | 
				
			||||||
 | 
					  //       {
 | 
				
			||||||
 | 
					  //         serverCount
 | 
				
			||||||
 | 
					  //         servers {
 | 
				
			||||||
 | 
					  //           id
 | 
				
			||||||
 | 
					  //           name
 | 
				
			||||||
 | 
					  //         }
 | 
				
			||||||
 | 
					  //       }
 | 
				
			||||||
 | 
					  //     `
 | 
				
			||||||
 | 
					  //   });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    private appsettings: SettingsService,
 | 
					    private appsettings: SettingsService,
 | 
				
			||||||
    private http: HttpClient,
 | 
					    private http: HttpClient
 | 
				
			||||||
  ) { }
 | 
					  ) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /* data requests */
 | 
					 | 
				
			||||||
  getAllServers(): Observable<Array<ServerDTO>> {
 | 
					 | 
				
			||||||
    return this.http.get<Array<ServerDTO>>(`${this.appsettings.getApiURL()}/api/discord/server/servers`, {
 | 
					 | 
				
			||||||
      headers: new HttpHeaders({
 | 
					 | 
				
			||||||
        'Content-Type': 'application/json'
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  getAllServersByUser(): Observable<Array<ServerDTO>> {
 | 
					 | 
				
			||||||
    return this.http.get<Array<ServerDTO>>(`${this.appsettings.getApiURL()}/api/discord/server/servers-by-user`, {
 | 
					 | 
				
			||||||
      headers: new HttpHeaders({
 | 
					 | 
				
			||||||
        'Content-Type': 'application/json'
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  getFilteredServers(selectCriterions: ServerSelectCriterion): Observable<GetFilteredServersResultDTO> {
 | 
					 | 
				
			||||||
    return this.http.post<GetFilteredServersResultDTO>(`${this.appsettings.getApiURL()}/api/discord/server/get/filtered`, selectCriterions, {
 | 
					 | 
				
			||||||
      headers: new HttpHeaders({
 | 
					 | 
				
			||||||
        'Content-Type': 'application/json'
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  getServerByID(id: number): Observable<ServerDTO> {
 | 
					 | 
				
			||||||
    return this.http.get<ServerDTO>(`${this.appsettings.getApiURL()}/api/discord/server/get/${id}`, {
 | 
					 | 
				
			||||||
      headers: new HttpHeaders({
 | 
					 | 
				
			||||||
        'Content-Type': 'application/json'
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,14 @@
 | 
				
			|||||||
import { Injectable } from '@angular/core';
 | 
					import { Injectable } from "@angular/core";
 | 
				
			||||||
import { BehaviorSubject, Subject } from 'rxjs';
 | 
					import { BehaviorSubject } from "rxjs";
 | 
				
			||||||
import { ServerDTO } from 'src/app/models/discord/server.dto';
 | 
					import { Server } from "src/app/models/data/server.model";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable({
 | 
					@Injectable({
 | 
				
			||||||
  providedIn: 'root'
 | 
					  providedIn: 'root'
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
export class ServerService {
 | 
					export class ServerService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private server!: ServerDTO;
 | 
					  private server!: Server;
 | 
				
			||||||
  server$ = new BehaviorSubject<ServerDTO | null>(null);
 | 
					  server$ = new BehaviorSubject<Server | null>(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor() {
 | 
					  constructor() {
 | 
				
			||||||
    this.server$.subscribe(server => {
 | 
					    this.server$.subscribe(server => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
    "WebVersion": {
 | 
					    "WebVersion": {
 | 
				
			||||||
        "Major": "0",
 | 
					        "Major": "0",
 | 
				
			||||||
        "Minor": "3",
 | 
					        "Minor": "3",
 | 
				
			||||||
        "Micro": "dev162"
 | 
					        "Micro": "dev162-2"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "Themes": [
 | 
					    "Themes": [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,20 +7,8 @@ import {
 | 
				
			|||||||
  platformBrowserDynamicTesting
 | 
					  platformBrowserDynamicTesting
 | 
				
			||||||
} from '@angular/platform-browser-dynamic/testing';
 | 
					} from '@angular/platform-browser-dynamic/testing';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
declare const require: {
 | 
					 | 
				
			||||||
  context(path: string, deep?: boolean, filter?: RegExp): {
 | 
					 | 
				
			||||||
    <T>(id: string): T;
 | 
					 | 
				
			||||||
    keys(): string[];
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// First, initialize the Angular testing environment.
 | 
					// First, initialize the Angular testing environment.
 | 
				
			||||||
getTestBed().initTestEnvironment(
 | 
					getTestBed().initTestEnvironment(
 | 
				
			||||||
  BrowserDynamicTestingModule,
 | 
					  BrowserDynamicTestingModule,
 | 
				
			||||||
  platformBrowserDynamicTesting(),
 | 
					  platformBrowserDynamicTesting(),
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					 | 
				
			||||||
// Then we find all the tests.
 | 
					 | 
				
			||||||
const context = require.context('./', true, /\.spec\.ts$/);
 | 
					 | 
				
			||||||
// And load the modules.
 | 
					 | 
				
			||||||
context.keys().forEach(context);
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,3 @@
 | 
				
			|||||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "ts-node": {
 | 
					  "ts-node": {
 | 
				
			||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
@@ -21,12 +20,15 @@
 | 
				
			|||||||
    "experimentalDecorators": true,
 | 
					    "experimentalDecorators": true,
 | 
				
			||||||
    "moduleResolution": "node",
 | 
					    "moduleResolution": "node",
 | 
				
			||||||
    "importHelpers": true,
 | 
					    "importHelpers": true,
 | 
				
			||||||
    "target": "es2020",
 | 
					    "target": "ES2022",
 | 
				
			||||||
    "module": "es2020",
 | 
					    "module": "es2020",
 | 
				
			||||||
    "lib": [
 | 
					    "lib": [
 | 
				
			||||||
      "es2020",
 | 
					      "es2020",
 | 
				
			||||||
      "dom"
 | 
					      "dom",
 | 
				
			||||||
    ]
 | 
					      "esnext.asynciterable"
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    "allowSyntheticDefaultImports": true,
 | 
				
			||||||
 | 
					    "useDefineForClassFields": false
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "angularCompilerOptions": {
 | 
					  "angularCompilerOptions": {
 | 
				
			||||||
    "enableI18nLegacyMessageIdFormat": false,
 | 
					    "enableI18nLegacyMessageIdFormat": false,
 | 
				
			||||||
@@ -34,4 +36,4 @@
 | 
				
			|||||||
    "strictInputAccessModifiers": true,
 | 
					    "strictInputAccessModifiers": true,
 | 
				
			||||||
    "strictTemplates": true
 | 
					    "strictTemplates": true
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user