mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
minor cleanup from patch-db audit
This commit is contained in:
@@ -2,10 +2,11 @@ import { inject, Injectable } from '@angular/core'
|
|||||||
import { PatchDB } from 'patch-db-client'
|
import { PatchDB } from 'patch-db-client'
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
distinctUntilChanged,
|
|
||||||
map,
|
|
||||||
combineLatest,
|
combineLatest,
|
||||||
|
distinctUntilChanged,
|
||||||
firstValueFrom,
|
firstValueFrom,
|
||||||
|
map,
|
||||||
|
shareReplay,
|
||||||
} from 'rxjs'
|
} from 'rxjs'
|
||||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||||
import { getServerInfo } from 'src/app/utils/get-server-info'
|
import { getServerInfo } from 'src/app/utils/get-server-info'
|
||||||
@@ -22,17 +23,19 @@ export class OSService {
|
|||||||
osUpdate?: T.OsVersionInfoMap
|
osUpdate?: T.OsVersionInfoMap
|
||||||
readonly updateAvailable$ = new BehaviorSubject<boolean>(false)
|
readonly updateAvailable$ = new BehaviorSubject<boolean>(false)
|
||||||
|
|
||||||
readonly updating$ = this.patch.watch$('serverInfo', 'statusInfo').pipe(
|
private readonly statusInfo$ = this.patch
|
||||||
|
.watch$('serverInfo', 'statusInfo')
|
||||||
|
.pipe(shareReplay({ bufferSize: 1, refCount: true }))
|
||||||
|
|
||||||
|
readonly updating$ = this.statusInfo$.pipe(
|
||||||
map(status => status.updateProgress ?? status.updated),
|
map(status => status.updateProgress ?? status.updated),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
)
|
)
|
||||||
|
|
||||||
readonly backingUp$ = this.patch
|
readonly backingUp$ = this.statusInfo$.pipe(
|
||||||
.watch$('serverInfo', 'statusInfo', 'backupProgress')
|
map(status => !!status.backupProgress),
|
||||||
.pipe(
|
distinctUntilChanged(),
|
||||||
map(obj => !!obj),
|
)
|
||||||
distinctUntilChanged(),
|
|
||||||
)
|
|
||||||
|
|
||||||
readonly updatingOrBackingUp$ = combineLatest([
|
readonly updatingOrBackingUp$ = combineLatest([
|
||||||
this.updating$,
|
this.updating$,
|
||||||
|
|||||||
Reference in New Issue
Block a user