Browse Source

report features

master
gsd 2 months ago
parent
commit
0cbd9a8582
  1. 2
      src/app/app.module.ts
  2. 35
      src/app/entities/search/ReportSearchFilter.ts
  3. 22
      src/app/pages/internal-components/search-filters/FilterMatChipReportId.ts
  4. 15
      src/app/pages/reports-page/ReportSearchTable.ts

2
src/app/app.module.ts

@ -89,6 +89,7 @@ import {UsertimeGraphComponent} from "./pages/internal-components/usertime.graph
import {VipGraphComponents} from "./pages/internal-components/vip.graph.components";
import {ConnectionsGraphComponent} from "./pages/internal-components/connections.graph.component";
import {DoxingGraphComponent} from "./pages/internal-components/doxing.graph.component";
import {FilterMatChipReportId} from "./pages/internal-components/search-filters/FilterMatChipReportId";
registerLocaleData(localeRu, "ru")
@ -123,6 +124,7 @@ registerLocaleData(localeRu, "ru")
FilterMatChipActiveBan,
FilterMatChipAdmins,
FilterMatChipKillFeed,
FilterMatChipReportId,
//dialogs
BanViewDialog,
NewsViewDialog,

35
src/app/entities/search/ReportSearchFilter.ts

@ -0,0 +1,35 @@
import {SearchFilter} from "./SearchFilter";
import {MatPaginator} from "@angular/material/paginator";
import {ParamMap} from "@angular/router";
export class ReportSearchFilter extends SearchFilter {
ids: number[]|null = [];
override createQuery(paginator: MatPaginator | undefined): { [p: string]: any } {
let q:{[param: string]: any} = super.createQuery(paginator);
q["ids"] = this.ids?this.ids.join(","):null;
return q;
}
override fromQuery(param: ParamMap, paginator: MatPaginator | undefined) {
try {if (param.get("ids")) { // @ts-ignore
this.ids = param.get("ids")?.split(",");}}catch (e) {}
super.fromQuery(param, paginator);
}
addReportIdToSearch(id: number) {
if (this.ids == null)
this.ids = [];
if (this.ids.indexOf(id) == -1)
this.ids.push(id)
this.updated = true;
}
removeReportIdFromSearch(id: number) {
if (this.ids == null) return;
this.ids = this.ids.filter(v => v !== id);
this.updated = true;
}
}

22
src/app/pages/internal-components/search-filters/FilterMatChipReportId.ts

@ -0,0 +1,22 @@
import {Component, Input} from "@angular/core";
import {ReportSearchFilter} from "../../../entities/search/ReportSearchFilter";
@Component({
selector: "app-filter-mat-chip-reportid",
template: `
<div *ngIf="filter && filter.ids != null">
<mat-chip
*ngFor="let reportId of filter.ids"
(removed)="filter.removeReportIdFromSearch(reportId)"
>ReportId: {{reportId}}
<button matChipRemove>
<mat-icon>cancel</mat-icon>
</button>
</mat-chip>
</div>`
})
export class FilterMatChipReportId {
@Input("filter")
filter: ReportSearchFilter|undefined;
}

15
src/app/pages/reports-page/ReportSearchTable.ts

@ -14,6 +14,7 @@ import {Report} from "../../entities/Report";
import {DefaultValues} from "../../utils/DefaultValues";
import {MatDialog} from "@angular/material/dialog";
import {AuthDialogRequest} from "../internal-components/dialogs/AuthDialogRequest";
import {ReportSearchFilter} from "../../entities/search/ReportSearchFilter";
@Component({
selector: 'app-report-search-table',
@ -30,6 +31,9 @@ import {AuthDialogRequest} from "../internal-components/dialogs/AuthDialogReques
</mat-menu>
<mat-chip *ngIf="filter.updated" (click)="updateData()">Обновить</mat-chip>
<app-filter-mat-chip-reportid
[filter]="filter">
</app-filter-mat-chip-reportid>
<app-filter-mat-chip-account
[filter]="filter">
</app-filter-mat-chip-account>
@ -52,6 +56,13 @@ import {AuthDialogRequest} from "../internal-components/dialogs/AuthDialogReques
</div>
</div>
<table mat-table [dataSource]="dataSource" style="width: 100%">
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef>ID</th>
<td mat-cell *matCellDef="let row" [matMenuTriggerFor]="row.id?rMenu:null"> {{row.id}}
<mat-menu #rMenu>
<button mat-menu-item (click)="filter.addReportIdToSearch(row.id)">Добавить в поиск</button>
</mat-menu></td>
</ng-container>
<ng-container matColumnDef="author">
<th mat-header-cell *matHeaderCellDef> Кто пожаловался </th>
<td mat-cell *matCellDef="let row" [matMenuTriggerFor]="row.a_nickname?aMenu:null"> {{row.a_nickname}}
@ -127,7 +138,7 @@ import {AuthDialogRequest} from "../internal-components/dialogs/AuthDialogReques
`
})
export class ReportSearchTable extends AbstractSearchTable<ReportSearchTable, any>{
displayedColumns: string[] = [
displayedColumns: string[] = ['id',
'author', 'author_kd',
'reported', 'reported_kd',
'reasons', 'date','actions','server', 'online'];
@ -140,7 +151,7 @@ export class ReportSearchTable extends AbstractSearchTable<ReportSearchTable, an
private http: HttpClient,
private dialog: MatDialog) {
super(authService, serverService, playerService, route, router);
super.filter = new SearchFilter();//todo replace
super.filter = new ReportSearchFilter();//todo replace
}
private getStat() {

Loading…
Cancel
Save