diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9661b1d..33bdb19 100644 --- a/src/app/app.module.ts +++ b/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, diff --git a/src/app/entities/search/ReportSearchFilter.ts b/src/app/entities/search/ReportSearchFilter.ts new file mode 100644 index 0000000..96f41e3 --- /dev/null +++ b/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; + } +} diff --git a/src/app/pages/internal-components/search-filters/FilterMatChipReportId.ts b/src/app/pages/internal-components/search-filters/FilterMatChipReportId.ts new file mode 100644 index 0000000..33c260b --- /dev/null +++ b/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: ` +
+ ReportId: {{reportId}} + + +
` +}) +export class FilterMatChipReportId { + + @Input("filter") + filter: ReportSearchFilter|undefined; +} diff --git a/src/app/pages/reports-page/ReportSearchTable.ts b/src/app/pages/reports-page/ReportSearchTable.ts index 4409b40..d66024b 100644 --- a/src/app/pages/reports-page/ReportSearchTable.ts +++ b/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 Обновить + + @@ -52,6 +56,13 @@ import {AuthDialogRequest} from "../internal-components/dialogs/AuthDialogReques + + + +
ID {{row.id}} + + + Кто пожаловался {{row.a_nickname}} @@ -127,7 +138,7 @@ import {AuthDialogRequest} from "../internal-components/dialogs/AuthDialogReques ` }) export class ReportSearchTable extends AbstractSearchTable{ - 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