fix install progress by cloning

This commit is contained in:
Matt Hill
2021-09-07 08:47:30 -06:00
parent 68ff787b99
commit 2dfd5d994f
6 changed files with 17 additions and 15 deletions

View File

@@ -47,6 +47,7 @@ export class AppListPage {
}),
)
.subscribe(pkgs => {
console.log('PACKAGES LIST', pkgs)
this.loading = false
const ids = Object.keys(pkgs)
@@ -72,6 +73,8 @@ export class AppListPage {
}
// subscribe to pkg
this.pkgs[id].sub = this.patch.watch$('package-data', id).subscribe(pkg => {
console.log('SOLO PKG', id, pkg)
if (!pkg) return
let bulbClass = 'bulb-on'
let img = ''
const statusRendering = renderPkgStatus(pkg.state, pkg.installed?.status)
@@ -91,6 +94,7 @@ export class AppListPage {
break
}
this.pkgs[id].entry = pkg
this.pkgs[id].entry['install-progress'] = { ...this.pkgs[id].entry['install-progress'] }
this.pkgs[id].bulb = {
class: bulbClass,
img,

View File

@@ -6,7 +6,6 @@ import { Metric } from 'src/app/services/api/api.types'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { ErrorToastService } from 'src/app/services/error-toast.service'
import { MainStatus } from 'src/app/services/patch-db/data-model'
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
import { pauseFor } from 'src/app/util/misc.util'
@Component({
@@ -27,19 +26,11 @@ export class AppMetricsPage {
constructor (
private readonly route: ActivatedRoute,
private readonly errToast: ErrorToastService,
private readonly patch: PatchDbService,
private readonly embassyApi: ApiService,
) { }
ngOnInit () {
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
this.subs = [
this.patch.watch$('package-data', this.pkgId, 'installed', 'status', 'main')
.subscribe(main => {
this.mainStatus = main
}),
]
this.startDaemon()
}
@@ -49,7 +40,6 @@ export class AppMetricsPage {
ngOnDestroy () {
this.stopDaemon()
this.subs.forEach(sub => sub.unsubscribe())
}
async startDaemon (): Promise<void> {

View File

@@ -58,8 +58,9 @@ export class AppShowPage {
this.patch.watch$('package-data', this.pkgId)
.subscribe(pkg => {
this.pkg = pkg
this.pkg['install-progress'] = { ...this.pkg['install-progress'] }
this.rendering = renderPkgStatus(pkg.state, pkg.installed?.status)
this.mainStatus = pkg.installed?.status.main
this.mainStatus = { ...pkg.installed.status.main }
}),
// 2
this.connectionService.watchFailure$()