From f9628f0230384790a29f4b65e6df723b3ad9671e Mon Sep 17 00:00:00 2001
From: Alex Inkin
Date: Wed, 12 Jan 2022 19:40:26 +0300
Subject: [PATCH] fix: progress not updating (#1055)
---
ui/src/app/modules/sharing.module.ts | 21 +++++++++++++------
.../apps-routes/app-show/app-show.page.html | 2 +-
.../app-show-status.component.html | 2 +-
.../app-show-status.component.ts | 12 +----------
.../app-show/pipes/to-dependencies.pipe.ts | 5 +++--
.../marketplace-list.page.html | 4 ++--
.../marketplace-show.page.html | 4 ++--
ui/src/app/pipes/install-progress.pipe.ts | 14 +++++++++++++
ui/src/app/pipes/install-state.pipe.ts | 6 +++---
9 files changed, 42 insertions(+), 28 deletions(-)
create mode 100644 ui/src/app/pipes/install-progress.pipe.ts
diff --git a/ui/src/app/modules/sharing.module.ts b/ui/src/app/modules/sharing.module.ts
index afebba63d..ab6d6b288 100644
--- a/ui/src/app/modules/sharing.module.ts
+++ b/ui/src/app/modules/sharing.module.ts
@@ -1,9 +1,17 @@
import { NgModule } from '@angular/core'
-import { EmverComparesPipe, EmverSatisfiesPipe, EmverDisplayPipe } from '../pipes/emver.pipe'
+import {
+ EmverComparesPipe,
+ EmverSatisfiesPipe,
+ EmverDisplayPipe,
+} from '../pipes/emver.pipe'
import { IncludesPipe } from '../pipes/includes.pipe'
import { TypeofPipe } from '../pipes/typeof.pipe'
import { MarkdownPipe } from '../pipes/markdown.pipe'
-import { TruncateCenterPipe, TruncateEndPipe, TruncateTailPipe } from '../pipes/truncate.pipe'
+import {
+ TruncateCenterPipe,
+ TruncateEndPipe,
+ TruncateTailPipe,
+} from '../pipes/truncate.pipe'
import { MaskPipe } from '../pipes/mask.pipe'
import { HasUiPipe, LaunchablePipe } from '../pipes/ui.pipe'
import { EmptyPipe } from '../pipes/empty.pipe'
@@ -12,6 +20,7 @@ import { InstallState } from '../pipes/install-state.pipe'
import { TextSpinnerComponentModule } from '../components/text-spinner/text-spinner.component.module'
import { ConvertBytesPipe } from '../pipes/convert-bytes.pipe'
import { DurationToSecondsPipe } from '../pipes/unit-conversion.pipe'
+import { InstallProgressPipe } from '../pipes/install-progress.pipe'
@NgModule({
declarations: [
@@ -19,6 +28,7 @@ import { DurationToSecondsPipe } from '../pipes/unit-conversion.pipe'
EmverSatisfiesPipe,
TypeofPipe,
IncludesPipe,
+ InstallProgressPipe,
InstallState,
MarkdownPipe,
TruncateCenterPipe,
@@ -33,9 +43,7 @@ import { DurationToSecondsPipe } from '../pipes/unit-conversion.pipe'
ConvertBytesPipe,
DurationToSecondsPipe,
],
- imports: [
- TextSpinnerComponentModule,
- ],
+ imports: [TextSpinnerComponentModule],
exports: [
EmverComparesPipe,
EmverSatisfiesPipe,
@@ -48,6 +56,7 @@ import { DurationToSecondsPipe } from '../pipes/unit-conversion.pipe'
MaskPipe,
EmverDisplayPipe,
HasUiPipe,
+ InstallProgressPipe,
InstallState,
LaunchablePipe,
EmptyPipe,
@@ -58,4 +67,4 @@ import { DurationToSecondsPipe } from '../pipes/unit-conversion.pipe'
TextSpinnerComponentModule,
],
})
-export class SharingModule { }
\ No newline at end of file
+export class SharingModule {}
diff --git a/ui/src/app/pages/apps-routes/app-show/app-show.page.html b/ui/src/app/pages/apps-routes/app-show/app-show.page.html
index 41389fd85..8301419f3 100644
--- a/ui/src/app/pages/apps-routes/app-show/app-show.page.html
+++ b/ui/src/app/pages/apps-routes/app-show/app-show.page.html
@@ -31,7 +31,7 @@
diff --git a/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.html b/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.html
index 421fc493d..990b1847e 100644
--- a/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.html
+++ b/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.html
@@ -5,7 +5,7 @@
size="x-large"
weight="500"
[disconnected]="connectionFailure"
- [installProgress]="(progress | installState)?.totalProgress"
+ [installProgress]="(pkg | installState)?.totalProgress"
[rendering]="PR[status.primary]"
[sigtermTimeout]="pkg.manifest.main['sigterm-timeout']"
>
diff --git a/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts b/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts
index e0a6adf94..e27dffb1f 100644
--- a/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts
+++ b/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts
@@ -1,12 +1,6 @@
-import {
- ChangeDetectionStrategy,
- Component,
- Inject,
- Input,
-} from '@angular/core'
+import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
import { UiLauncherService } from 'src/app/services/ui-launcher.service'
import {
- InstallProgress,
InterfaceDef,
PackageDataEntry,
PackageState,
@@ -68,10 +62,6 @@ export class AppShowStatusComponent {
return this.pkg.manifest.interfaces
}
- get progress(): InstallProgress | undefined {
- return this.pkg['install-progress']
- }
-
get pkgStatus(): Status {
return this.pkg.installed.status
}
diff --git a/ui/src/app/pages/apps-routes/app-show/pipes/to-dependencies.pipe.ts b/ui/src/app/pages/apps-routes/app-show/pipes/to-dependencies.pipe.ts
index 44d400831..489620df0 100644
--- a/ui/src/app/pages/apps-routes/app-show/pipes/to-dependencies.pipe.ts
+++ b/ui/src/app/pages/apps-routes/app-show/pipes/to-dependencies.pipe.ts
@@ -2,7 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core'
import { NavigationExtras } from '@angular/router'
import { NavController } from '@ionic/angular'
import { combineLatest, Observable } from 'rxjs'
-import { filter, map } from 'rxjs/operators'
+import { filter, map, startWith } from 'rxjs/operators'
import { DependentInfo, exists } from 'src/app/util/misc.util'
import {
DependencyError,
@@ -48,12 +48,13 @@ export class ToDependenciesPipe implements PipeTransform {
'dependency-errors',
),
]).pipe(
- filter(deps => deps.every(exists)),
+ filter(deps => deps.every(exists) && !!pkg.installed),
map(([currentDeps, depErrors]) =>
Object.keys(currentDeps)
.filter(id => !!pkg.manifest.dependencies[id])
.map(id => this.setDepValues(pkg, id, depErrors)),
),
+ startWith([]),
)
}
diff --git a/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html b/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html
index ae05b6511..85bc982f9 100644
--- a/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html
+++ b/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html
@@ -117,9 +117,9 @@
Update Available
-
+
Installing
- {{ progress.totalProgress < 99 ? progress.totalProgress + '%' : 'finalizing' }}
+ {{ progress }}
diff --git a/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.html b/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.html
index fd0073167..576eef29d 100644
--- a/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.html
+++ b/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.html
@@ -32,9 +32,9 @@
-
+
Installing
- {{ progress.totalProgress < 99 ? progress.totalProgress + '%' : 'finalizing' }}
+ {{ progress }}
diff --git a/ui/src/app/pipes/install-progress.pipe.ts b/ui/src/app/pipes/install-progress.pipe.ts
new file mode 100644
index 000000000..eb6eb34fe
--- /dev/null
+++ b/ui/src/app/pipes/install-progress.pipe.ts
@@ -0,0 +1,14 @@
+import { Pipe, PipeTransform } from '@angular/core'
+import { InstallProgress } from '../services/patch-db/data-model'
+import { packageLoadingProgress } from '../util/package-loading-progress'
+
+@Pipe({
+ name: 'installProgress',
+})
+export class InstallProgressPipe implements PipeTransform {
+ transform(loadData: InstallProgress): string {
+ const { totalProgress } = packageLoadingProgress(loadData)
+
+ return totalProgress < 99 ? totalProgress + '%' : 'finalizing'
+ }
+}
diff --git a/ui/src/app/pipes/install-state.pipe.ts b/ui/src/app/pipes/install-state.pipe.ts
index 2734da17e..0d339b8e5 100644
--- a/ui/src/app/pipes/install-state.pipe.ts
+++ b/ui/src/app/pipes/install-state.pipe.ts
@@ -1,5 +1,5 @@
import { Pipe, PipeTransform } from '@angular/core'
-import { InstallProgress } from '../services/patch-db/data-model'
+import { PackageDataEntry } from '../services/patch-db/data-model'
import {
packageLoadingProgress,
ProgressData,
@@ -9,7 +9,7 @@ import {
name: 'installState',
})
export class InstallState implements PipeTransform {
- transform(loadData: InstallProgress): ProgressData | null {
- return packageLoadingProgress(loadData)
+ transform(pkg: PackageDataEntry): ProgressData | null {
+ return packageLoadingProgress(pkg['install-progress'])
}
}