Add warning in logs page with secondaries

This commit is contained in:
Chocobozzz committed 2026-10-28 11:27:10 +01:00
1 parent fbafb574ea
commit 6b3fcdcf8a
2 files changed
+29 -3

No files matched your search

@@ -1,3 +1,10 @@
@if (secondariesUp !== 0) {
<my-alert class="d-block mb-3" type="warning" i18n>
These logs only come from the primary PeerTube process: {secondariesUp, plural, =1 {1 secondary process is} other {{{ secondariesUp }} secondary processes are}} also running, and their logs are not displayed here.
Check the log files of each secondary process to get their logs.
</my-alert>
}
<div class="header">
<div>
@@ -1,13 +1,15 @@
import { NgClass } from '@angular/common'
import { Component, ElementRef, OnInit, inject, viewChild, ChangeDetectionStrategy } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { Notifier } from '@app/core'
import { AuthService, Notifier } from '@app/core'
import { SelectOptionsComponent } from '@app/shared/shared-forms/select/select-options.component'
import { AlertComponent } from '@app/shared/shared-main/common/alert.component'
import { PTDatePipe } from '@app/shared/shared-main/common/date.pipe'
import { ServerLogLevel } from '@peertube/peertube-models'
import { ServerLogLevel, UserRight } from '@peertube/peertube-models'
import { SelectTagsComponent } from '../../../shared/shared-forms/select/select-tags.component'
import { ButtonComponent } from '../../../shared/shared-main/buttons/button.component'
import { CopyButtonComponent } from '../../../shared/shared-main/buttons/copy-button.component'
import { DebugService } from '../debug/debug.service'
import { LogRow } from './log-row.model'
import { LogsService } from './logs.service'
@@ -22,12 +24,15 @@ import { LogsService } from './logs.service'
ButtonComponent,
PTDatePipe,
CopyButtonComponent,
SelectOptionsComponent
SelectOptionsComponent,
AlertComponent
]
})
export class LogsComponent implements OnInit {
private logsService = inject(LogsService)
private notifier = inject(Notifier)
private debugService = inject(DebugService)
private auth = inject(AuthService)
readonly logsElement = viewChild<ElementRef<HTMLElement>>('logsElement')
readonly logsContent = viewChild<ElementRef<HTMLElement>>('logsContent')
@@ -44,11 +49,14 @@ export class LogsComponent implements OnInit {
level: ServerLogLevel
tagsOneOf: string[] = []
secondariesUp = 0
ngOnInit (): void {
this.buildTimeChoices()
this.buildLevelChoices()
this.load()
this.loadSecondariesUp()
}
refresh () {
@@ -85,6 +93,17 @@ export class LogsComponent implements OnInit {
})
}
loadSecondariesUp () {
if (!this.auth.getUser().hasRight(UserRight.MANAGE_DEBUG)) return
this.debugService.getDebug()
.subscribe({
next: debug => this.secondariesUp = debug.secondariesUp,
error: err => this.notifier.handleError(err)
})
}
buildTimeChoices () {
const lastHour = new Date()
lastHour.setHours(lastHour.getHours() - 1)