cap install progress at 99% until complete, add ability to nav to service from marketplace show

This commit is contained in:
Matt Hill
2021-09-11 09:21:23 -06:00
committed by Aiden McClelland
parent a74a4b5c28
commit ac9b1a7744
4 changed files with 20 additions and 12 deletions

View File

@@ -32,7 +32,7 @@
</app-actions-item>
<!-- ** specific actions ** -->
<ion-item-divider>Actions for {{ pkg.manifest.title }}</ion-item-divider>
<ion-item-divider *ngIf="!(pkg.manifest.actions | empty)">Actions for {{ pkg.manifest.title }}</ion-item-divider>
<app-actions-item
*ngFor="let action of pkg.manifest.actions | keyvalue: asIsOrder"
[action]="{

View File

@@ -148,7 +148,7 @@
[value]="installProgress.validateProgress / 100"
></ion-progress-bar>
<p>Installing: {{ installProgress.unpackProgress }}%</p>
<p>Unpacking: {{ installProgress.unpackProgress }}%</p>
<ion-progress-bar
[color]="pkg['install-progress']['unpack-complete'] ? 'success' : 'secondary'"
[value]="installProgress.unpackProgress / 100"

View File

@@ -49,11 +49,11 @@
</ion-col>
<ion-col sizeXl="3" sizeLg="3" sizeMd="3" sizeSm="12" sizeXs="12" class="ion-align-self-center">
<!-- no localPkg -->
<ion-button *ngIf="!localPkg; else localPkg2" expand="block" (click)="tryInstall()">
<ion-button *ngIf="!localPkg" expand="block" (click)="tryInstall()">
Install
</ion-button>
<!-- localPkg -->
<ng-template #localPkg2>
<ng-container *ngIf="localPkg">
<!-- not installing, updating, or removing -->
<ng-container *ngIf="localPkg.state === PackageState.Installed">
<ion-button *ngIf="(localPkg.manifest.version | compareEmver : pkg.manifest.version) === -1" expand="block" (click)="presentModal('update')">
@@ -63,7 +63,14 @@
Downgrade
</ion-button>
</ng-container>
</ng-template>
</ng-container>
</ion-col>
</ion-row>
<ion-row *ngIf="localPkg">
<ion-col sizeXl="3" sizeLg="3" sizeMd="3" sizeSm="12" sizeXs="12" class="ion-align-self-center">
<ion-button expand="block" fill="outline" color="primary" [routerLink]="['/services', pkg.manifest.id]">
View Service
</ion-button>
</ion-col>
</ion-row>
</ion-grid>

View File

@@ -10,9 +10,10 @@ export class PackageLoadingService {
transform (loadData: InstallProgress): ProgressData {
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
// only permit 100% when "complete" == true
downloaded = downloadComplete ? size : Math.max(downloaded - 1, 0)
validated = validationComplete ? size : Math.max(validated - 1, 0)
unpacked = unpackComplete ? size : Math.max(unpacked - 1, 0)
const downloadWeight = 1
const validateWeight = .2
@@ -26,10 +27,10 @@ export class PackageLoadingService {
const denominator = Math.floor(size * (downloadWeight + validateWeight + unpackWeight))
return {
totalProgress: Math.round(100 * numerator / denominator),
downloadProgress: Math.round(100 * downloaded / size),
validateProgress: Math.round(100 * validated / size),
unpackProgress: Math.round(100 * unpacked / size),
totalProgress: Math.floor(100 * numerator / denominator),
downloadProgress: Math.floor(100 * downloaded / size),
validateProgress: Math.floor(100 * validated / size),
unpackProgress: Math.floor(100 * unpacked / size),
isComplete: downloadComplete && validationComplete && unpackComplete,
}
}