diff --git a/ui/src/app/pages/apps-routes/app-list/app-list.page.ts b/ui/src/app/pages/apps-routes/app-list/app-list.page.ts index e09f7c072..528fff7d3 100644 --- a/ui/src/app/pages/apps-routes/app-list/app-list.page.ts +++ b/ui/src/app/pages/apps-routes/app-list/app-list.page.ts @@ -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, diff --git a/ui/src/app/pages/apps-routes/app-metrics/app-metrics.page.ts b/ui/src/app/pages/apps-routes/app-metrics/app-metrics.page.ts index 74867c05e..9b4beda0f 100644 --- a/ui/src/app/pages/apps-routes/app-metrics/app-metrics.page.ts +++ b/ui/src/app/pages/apps-routes/app-metrics/app-metrics.page.ts @@ -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 { diff --git a/ui/src/app/pages/apps-routes/app-show/app-show.page.ts b/ui/src/app/pages/apps-routes/app-show/app-show.page.ts index fdfd83481..4050f0da7 100644 --- a/ui/src/app/pages/apps-routes/app-show/app-show.page.ts +++ b/ui/src/app/pages/apps-routes/app-show/app-show.page.ts @@ -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$() diff --git a/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts b/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts index e022964ad..c7f24fab8 100644 --- a/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts +++ b/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts @@ -9,7 +9,6 @@ import { ErrorToastService } from 'src/app/services/error-toast.service' import { MarketplaceService } from '../marketplace.service' import { ApiService } from 'src/app/services/api/embassy-api.service' import { PatchDbService } from 'src/app/services/patch-db/patch-db.service' -import { debounce } from 'src/app/util/misc.util' @Component({ selector: 'marketplace-list', @@ -51,6 +50,9 @@ export class MarketplaceListPage { this.subs = [ this.patch.watch$('package-data').subscribe(pkgs => { this.localPkgs = pkgs + Object.values(this.localPkgs).forEach(pkg => { + pkg['install-progress'] = { ...pkg['install-progress'] } + }) }), ] @@ -108,7 +110,6 @@ export class MarketplaceListPage { ) } - @debounce(1000) private async getPkgs (doInfinite = false): Promise { try { if (this.category === 'updates') { diff --git a/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts b/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts index ccf1a516e..8247a1e01 100644 --- a/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts +++ b/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts @@ -48,7 +48,9 @@ export class MarketplaceShowPage { this.subs = [ this.patch.watch$('package-data', this.pkgId) .subscribe(pkg => { + if (!pkg) return this.localPkg = pkg + this.localPkg['install-progress'] = { ...this.localPkg['install-progress'] } }), ] diff --git a/ui/src/app/pipes/install-state.pipe.ts b/ui/src/app/pipes/install-state.pipe.ts index 22d731c59..ca8fd9925 100644 --- a/ui/src/app/pipes/install-state.pipe.ts +++ b/ui/src/app/pipes/install-state.pipe.ts @@ -7,7 +7,11 @@ import { InstallProgress } from '../services/patch-db/data-model' export class InstallState implements PipeTransform { transform (loadData: InstallProgress): ProgressData { - const { downloaded, validated, unpacked, size } = loadData + console.log('LOAD DATA', loadData) + let { downloaded, validated, unpacked, size, 'download-complete': downloadComplete, 'validation-complete': validationComplete, 'unpack-complete': unpackComplete } = loadData + downloaded = downloadComplete ? size : downloaded + validated = validationComplete ? size : validated + unpacked = unpackComplete ? size : unpacked const downloadWeight = 1 const validateWeight = .2 @@ -25,7 +29,7 @@ export class InstallState implements PipeTransform { downloadProgress: Math.round(100 * downloaded / size), validateProgress: Math.round(100 * validated / size), unpackProgress: Math.round(100 * unpacked / size), - isComplete: loadData['download-complete'] && loadData['validation-complete'] && loadData['unpack-complete'], + isComplete: downloadComplete && validationComplete && unpackComplete, } } }