mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
cap install progress at 99% until complete, add ability to nav to service from marketplace show
This commit is contained in:
committed by
Aiden McClelland
parent
a74a4b5c28
commit
ac9b1a7744
@@ -32,7 +32,7 @@
|
|||||||
</app-actions-item>
|
</app-actions-item>
|
||||||
|
|
||||||
<!-- ** specific actions ** -->
|
<!-- ** 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
|
<app-actions-item
|
||||||
*ngFor="let action of pkg.manifest.actions | keyvalue: asIsOrder"
|
*ngFor="let action of pkg.manifest.actions | keyvalue: asIsOrder"
|
||||||
[action]="{
|
[action]="{
|
||||||
|
|||||||
@@ -148,7 +148,7 @@
|
|||||||
[value]="installProgress.validateProgress / 100"
|
[value]="installProgress.validateProgress / 100"
|
||||||
></ion-progress-bar>
|
></ion-progress-bar>
|
||||||
|
|
||||||
<p>Installing: {{ installProgress.unpackProgress }}%</p>
|
<p>Unpacking: {{ installProgress.unpackProgress }}%</p>
|
||||||
<ion-progress-bar
|
<ion-progress-bar
|
||||||
[color]="pkg['install-progress']['unpack-complete'] ? 'success' : 'secondary'"
|
[color]="pkg['install-progress']['unpack-complete'] ? 'success' : 'secondary'"
|
||||||
[value]="installProgress.unpackProgress / 100"
|
[value]="installProgress.unpackProgress / 100"
|
||||||
|
|||||||
@@ -49,11 +49,11 @@
|
|||||||
</ion-col>
|
</ion-col>
|
||||||
<ion-col sizeXl="3" sizeLg="3" sizeMd="3" sizeSm="12" sizeXs="12" class="ion-align-self-center">
|
<ion-col sizeXl="3" sizeLg="3" sizeMd="3" sizeSm="12" sizeXs="12" class="ion-align-self-center">
|
||||||
<!-- no localPkg -->
|
<!-- no localPkg -->
|
||||||
<ion-button *ngIf="!localPkg; else localPkg2" expand="block" (click)="tryInstall()">
|
<ion-button *ngIf="!localPkg" expand="block" (click)="tryInstall()">
|
||||||
Install
|
Install
|
||||||
</ion-button>
|
</ion-button>
|
||||||
<!-- localPkg -->
|
<!-- localPkg -->
|
||||||
<ng-template #localPkg2>
|
<ng-container *ngIf="localPkg">
|
||||||
<!-- not installing, updating, or removing -->
|
<!-- not installing, updating, or removing -->
|
||||||
<ng-container *ngIf="localPkg.state === PackageState.Installed">
|
<ng-container *ngIf="localPkg.state === PackageState.Installed">
|
||||||
<ion-button *ngIf="(localPkg.manifest.version | compareEmver : pkg.manifest.version) === -1" expand="block" (click)="presentModal('update')">
|
<ion-button *ngIf="(localPkg.manifest.version | compareEmver : pkg.manifest.version) === -1" expand="block" (click)="presentModal('update')">
|
||||||
@@ -63,7 +63,14 @@
|
|||||||
Downgrade
|
Downgrade
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</ng-container>
|
</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-col>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
</ion-grid>
|
</ion-grid>
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ export class PackageLoadingService {
|
|||||||
|
|
||||||
transform (loadData: InstallProgress): ProgressData {
|
transform (loadData: InstallProgress): ProgressData {
|
||||||
let { downloaded, validated, unpacked, size, 'download-complete': downloadComplete, 'validation-complete': validationComplete, 'unpack-complete': unpackComplete } = loadData
|
let { downloaded, validated, unpacked, size, 'download-complete': downloadComplete, 'validation-complete': validationComplete, 'unpack-complete': unpackComplete } = loadData
|
||||||
downloaded = downloadComplete ? size : downloaded
|
// only permit 100% when "complete" == true
|
||||||
validated = validationComplete ? size : validated
|
downloaded = downloadComplete ? size : Math.max(downloaded - 1, 0)
|
||||||
unpacked = unpackComplete ? size : unpacked
|
validated = validationComplete ? size : Math.max(validated - 1, 0)
|
||||||
|
unpacked = unpackComplete ? size : Math.max(unpacked - 1, 0)
|
||||||
|
|
||||||
const downloadWeight = 1
|
const downloadWeight = 1
|
||||||
const validateWeight = .2
|
const validateWeight = .2
|
||||||
@@ -26,10 +27,10 @@ export class PackageLoadingService {
|
|||||||
const denominator = Math.floor(size * (downloadWeight + validateWeight + unpackWeight))
|
const denominator = Math.floor(size * (downloadWeight + validateWeight + unpackWeight))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
totalProgress: Math.round(100 * numerator / denominator),
|
totalProgress: Math.floor(100 * numerator / denominator),
|
||||||
downloadProgress: Math.round(100 * downloaded / size),
|
downloadProgress: Math.floor(100 * downloaded / size),
|
||||||
validateProgress: Math.round(100 * validated / size),
|
validateProgress: Math.floor(100 * validated / size),
|
||||||
unpackProgress: Math.round(100 * unpacked / size),
|
unpackProgress: Math.floor(100 * unpacked / size),
|
||||||
isComplete: downloadComplete && validationComplete && unpackComplete,
|
isComplete: downloadComplete && validationComplete && unpackComplete,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user