chore: comments (#2863)

This commit is contained in:
Alex Inkin
2025-04-06 17:18:01 +04:00
committed by GitHub
parent f51dcf23d6
commit 31856d9895
45 changed files with 362 additions and 503 deletions

View File

@@ -27,10 +27,12 @@ export class BadgeService {
private readonly notifications = inject(NotificationService)
private readonly exver = inject(Exver)
private readonly patch = inject<PatchDB<DataModel>>(PatchDB)
private readonly system$ = combineLatest([
this.patch.watch$('serverInfo', 'ntpSynced'),
inject(EOSService).updateAvailable$,
]).pipe(map(([synced, update]) => Number(!synced) + Number(update)))
private readonly system$ = inject(EOSService).updateAvailable$.pipe(
map(Number),
)
private readonly metrics$ = this.patch
.watch$('serverInfo', 'ntpSynced')
.pipe(map(synced => Number(!synced)))
private readonly marketplaceService = inject(MarketplaceService)
private readonly local$ = inject(ConnectionService).pipe(
@@ -86,6 +88,8 @@ export class BadgeService {
return this.updates$
case '/portal/system':
return this.system$
case '/portal/metrics':
return this.metrics$
case '/portal/notifications':
return this.notifications.unreadCount$
default:

View File

@@ -2,7 +2,7 @@ import { inject, Injectable } from '@angular/core'
import { ErrorService, MARKDOWN } from '@start9labs/shared'
import { TuiDialogService } from '@taiga-ui/core'
import { PatchDB } from 'patch-db-client'
import { firstValueFrom, merge, shareReplay, Subject } from 'rxjs'
import { firstValueFrom, merge, of, shareReplay, Subject } from 'rxjs'
import { REPORT } from 'src/app/components/report.component'
import {
ServerNotification,
@@ -94,13 +94,14 @@ export class NotificationService {
full = false,
) {
const label = full || code === 2 ? title : 'Backup Report'
const content = code === 1 ? REPORT : MARKDOWN
const component = code === 1 ? REPORT : MARKDOWN
const content = code === 1 ? data : of(data)
this.dialogs
.open(full ? message : content, {
.open(full ? message : component, {
label,
data: {
content: data,
content,
timestamp: createdAt,
},
})