mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
fix: fix build after minor merged into major
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'
|
||||
import { toSignal } from '@angular/core/rxjs-interop'
|
||||
import { Router } from '@angular/router'
|
||||
import { ErrorService, InitializingComponent } from '@start9labs/shared'
|
||||
import {
|
||||
ErrorService,
|
||||
formatProgress,
|
||||
InitializingComponent,
|
||||
} from '@start9labs/shared'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
import {
|
||||
catchError,
|
||||
@@ -40,9 +44,8 @@ export default class LoadingPage {
|
||||
startWith(progress),
|
||||
catchError((_, watch$) =>
|
||||
interval(2000).pipe(
|
||||
switchMap(() =>
|
||||
from(this.api.getStatus()).pipe(catchError(() => EMPTY)),
|
||||
),
|
||||
switchMap(() => from(this.api.getStatus())),
|
||||
catchError(() => EMPTY),
|
||||
take(1),
|
||||
switchMap(() => watch$),
|
||||
),
|
||||
@@ -54,13 +57,7 @@ export default class LoadingPage {
|
||||
}),
|
||||
),
|
||||
),
|
||||
map(({ phases, overall }) => ({
|
||||
total: getDecimal(overall),
|
||||
message: phases
|
||||
.filter(p => p.progress !== true && p.progress !== null)
|
||||
.map(p => `${p.name}${getPhaseBytes(p.progress)}`)
|
||||
.join(','),
|
||||
})),
|
||||
map(formatProgress),
|
||||
catchError(e => {
|
||||
this.errorService.handleError(e)
|
||||
return EMPTY
|
||||
@@ -87,19 +84,3 @@ export default class LoadingPage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getDecimal(progress: T.Progress): number {
|
||||
if (progress === true) {
|
||||
return 1
|
||||
} else if (!progress || !progress.total) {
|
||||
return 0
|
||||
} else {
|
||||
return progress.total && progress.done / progress.total
|
||||
}
|
||||
}
|
||||
|
||||
function getPhaseBytes(progress: T.Progress): string {
|
||||
return progress === true || !progress
|
||||
? ''
|
||||
: `: (${progress.done}/${progress.total})`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user