From b3a4ebcf5327ff906a0399295399b4cc5f4e8493 Mon Sep 17 00:00:00 2001 From: Drew Ansbacher Date: Wed, 8 Sep 2021 16:14:44 +0300 Subject: [PATCH] undefined bug fix --- ui/src/app/pages/apps-routes/app-list/app-list.page.ts | 2 +- ui/src/app/pages/apps-routes/app-show/app-show.page.ts | 3 ++- ui/src/app/services/package-loading.service.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) 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 6836f5756..7cfc90c96 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 @@ -73,7 +73,7 @@ export class AppListPage { }, statusRendering: renderPkgStatus(pkgs[id].state, pkgs[id].installed?.status), sub: null, - installProgress: this.installPackageService.transform(pkgs[id]['install-progress']), + installProgress: !isEmptyObject(pkgs[id]['install-progress']) ? this.installPackageService.transform(pkgs[id]['install-progress']) : undefined, } // subscribe to pkg this.pkgs[id].sub = this.patch.watch$('package-data', id).subscribe(pkg => { 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 82317653b..deb25cff4 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 @@ -62,7 +62,8 @@ export class AppShowPage { this.patch.watch$('package-data', this.pkgId) .subscribe(pkg => { this.pkg = pkg - this.installProgress = this.packageLoadingService.transform(this.pkg['install-progress']) + console.log('isnt empty', !isEmptyObject(pkg['install-progress'])) + this.installProgress = !isEmptyObject(pkg['install-progress']) ? this.packageLoadingService.transform(pkg['install-progress']) : undefined this.rendering = renderPkgStatus(pkg.state, pkg.installed?.status) this.mainStatus = { ...pkg.installed?.status.main } }), diff --git a/ui/src/app/services/package-loading.service.ts b/ui/src/app/services/package-loading.service.ts index 9456c9063..8da3009e2 100644 --- a/ui/src/app/services/package-loading.service.ts +++ b/ui/src/app/services/package-loading.service.ts @@ -23,7 +23,7 @@ export class PackageLoadingService { validateWeight * validated + unpackWeight * unpacked) - const denominator = Math.floor(loadData.size * (downloadWeight + validateWeight + unpackWeight)) + const denominator = Math.floor(size * (downloadWeight + validateWeight + unpackWeight)) return { totalProgress: Math.round(100 * numerator / denominator),