mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00
Fix reloading table data
This commit is contained in:
parent
4888717c09
commit
42e0c015e8
2 changed files with 16 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { NgClass, NgIf } from '@angular/common'
|
import { CommonModule, NgClass } from '@angular/common'
|
||||||
import { Component, OnInit, inject, output, viewChild } from '@angular/core'
|
import { Component, OnInit, inject, output, viewChild } from '@angular/core'
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||||
import { Notifier, ServerService } from '@app/core'
|
import { Notifier, ServerService } from '@app/core'
|
||||||
|
@ -16,7 +16,7 @@ import { REGISTRATION_MODERATION_RESPONSE_VALIDATOR } from './process-registrati
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-process-registration-modal',
|
selector: 'my-process-registration-modal',
|
||||||
templateUrl: './process-registration-modal.component.html',
|
templateUrl: './process-registration-modal.component.html',
|
||||||
imports: [ NgIf, GlobalIconComponent, FormsModule, ReactiveFormsModule, NgClass, PeertubeCheckboxComponent, AlertComponent ]
|
imports: [ CommonModule, GlobalIconComponent, FormsModule, ReactiveFormsModule, PeertubeCheckboxComponent, AlertComponent ]
|
||||||
})
|
})
|
||||||
export class ProcessRegistrationModalComponent extends FormReactive implements OnInit {
|
export class ProcessRegistrationModalComponent extends FormReactive implements OnInit {
|
||||||
protected formReactiveService = inject(FormReactiveService)
|
protected formReactiveService = inject(FormReactiveService)
|
||||||
|
|
|
@ -45,6 +45,8 @@ export type TableQueryParams = {
|
||||||
sortOrder?: number
|
sortOrder?: number
|
||||||
sortField?: string
|
sortField?: string
|
||||||
search?: string
|
search?: string
|
||||||
|
|
||||||
|
state?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TableColumnInfo<ColumnName> = {
|
export type TableColumnInfo<ColumnName> = {
|
||||||
|
@ -250,7 +252,7 @@ export class TableComponent<Data, ColumnName = string, QueryParams extends Table
|
||||||
if (sort) this.sort = sort
|
if (sort) this.sort = sort
|
||||||
|
|
||||||
this.resetPagination()
|
this.resetPagination()
|
||||||
this.updateUrl()
|
this.updateUrl({ reset: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
private resetPagination () {
|
private resetPagination () {
|
||||||
|
@ -379,7 +381,11 @@ export class TableComponent<Data, ColumnName = string, QueryParams extends Table
|
||||||
this.loadData()
|
this.loadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateUrl () {
|
private updateUrl (options: {
|
||||||
|
reset?: boolean
|
||||||
|
} = {}) {
|
||||||
|
const { reset = false } = options
|
||||||
|
|
||||||
const newParams: TableQueryParams = {
|
const newParams: TableQueryParams = {
|
||||||
...this.route.snapshot.queryParams,
|
...this.route.snapshot.queryParams,
|
||||||
...this.customUpdateUrl()(),
|
...this.customUpdateUrl()(),
|
||||||
|
@ -391,6 +397,12 @@ export class TableComponent<Data, ColumnName = string, QueryParams extends Table
|
||||||
sortField: this.sort.field
|
sortField: this.sort.field
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reset) {
|
||||||
|
const baseState = this.route.snapshot.queryParams.state || 0
|
||||||
|
|
||||||
|
newParams.state = +baseState + 1
|
||||||
|
}
|
||||||
|
|
||||||
debugLogger('Update URL', { newParams })
|
debugLogger('Update URL', { newParams })
|
||||||
|
|
||||||
this.peertubeRouter.silentNavigate([ '.' ], newParams, this.route)
|
this.peertubeRouter.silentNavigate([ '.' ], newParams, this.route)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue