mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
package prog service
This commit is contained in:
committed by
Aiden McClelland
parent
24bb9125db
commit
d809e175db
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<ion-card-header>
|
<ion-card-header>
|
||||||
<status *ngIf="[PackageState.Installed, PackageState.Removing] | includes : pkg.value.entry.state" [disconnected]="connectionFailure" [rendering]="pkg.value.statusRendering" size="calc(8px + .4vw)" weight="bold"></status>
|
<status *ngIf="[PackageState.Installed, PackageState.Removing] | includes : pkg.value.entry.state" [disconnected]="connectionFailure" [rendering]="pkg.value.statusRendering" size="calc(8px + .4vw)" weight="bold"></status>
|
||||||
<p *ngIf="[PackageState.Installing, PackageState.Updating] | includes : pkg.value.entry.state" class="main-status"><ion-text color="primary">{{ pkg.value.entry.state | titlecase }}...{{ (pkg.value.entry['install-progress'] | installState).totalProgress }}%</ion-text></p>
|
<p *ngIf="!!pkg.value.installProgress" class="main-status"><ion-text color="primary">{{ pkg.value.entry.state | titlecase }}...{{ pkg.value.installProgress.totalProgress }}%</ion-text></p>
|
||||||
<ion-card-title>{{ pkg.value.entry.manifest.title }}</ion-card-title>
|
<ion-card-title>{{ pkg.value.entry.manifest.title }}</ion-card-title>
|
||||||
</ion-card-header>
|
</ion-card-header>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { Subscription } from 'rxjs'
|
|||||||
import { PkgStatusRendering, renderPkgStatus } from 'src/app/services/pkg-status-rendering.service'
|
import { PkgStatusRendering, renderPkgStatus } from 'src/app/services/pkg-status-rendering.service'
|
||||||
import { filter } from 'rxjs/operators'
|
import { filter } from 'rxjs/operators'
|
||||||
import { isEmptyObject } from 'src/app/util/misc.util'
|
import { isEmptyObject } from 'src/app/util/misc.util'
|
||||||
|
import { PackageLoadingService, ProgressData } from 'src/app/services/package-loading.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list',
|
selector: 'app-list',
|
||||||
@@ -24,6 +25,7 @@ export class AppListPage {
|
|||||||
}
|
}
|
||||||
statusRendering: PkgStatusRendering | null
|
statusRendering: PkgStatusRendering | null
|
||||||
sub: Subscription | null
|
sub: Subscription | null
|
||||||
|
installProgress: ProgressData
|
||||||
}} = { }
|
}} = { }
|
||||||
PackageState = PackageState
|
PackageState = PackageState
|
||||||
loading = true
|
loading = true
|
||||||
@@ -31,6 +33,7 @@ export class AppListPage {
|
|||||||
constructor (
|
constructor (
|
||||||
private readonly config: ConfigService,
|
private readonly config: ConfigService,
|
||||||
private readonly connectionService: ConnectionService,
|
private readonly connectionService: ConnectionService,
|
||||||
|
private readonly installPackageService: PackageLoadingService,
|
||||||
public readonly patch: PatchDbService,
|
public readonly patch: PatchDbService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
@@ -70,6 +73,7 @@ export class AppListPage {
|
|||||||
},
|
},
|
||||||
statusRendering: renderPkgStatus(pkgs[id].state, pkgs[id].installed?.status),
|
statusRendering: renderPkgStatus(pkgs[id].state, pkgs[id].installed?.status),
|
||||||
sub: null,
|
sub: null,
|
||||||
|
installProgress: this.installPackageService.transform(pkgs[id]['install-progress']),
|
||||||
}
|
}
|
||||||
// subscribe to pkg
|
// subscribe to pkg
|
||||||
this.pkgs[id].sub = this.patch.watch$('package-data', id).subscribe(pkg => {
|
this.pkgs[id].sub = this.patch.watch$('package-data', id).subscribe(pkg => {
|
||||||
@@ -94,7 +98,7 @@ export class AppListPage {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
this.pkgs[id].entry = pkg
|
this.pkgs[id].entry = pkg
|
||||||
this.pkgs[id].entry['install-progress'] = { ...this.pkgs[id].entry['install-progress'] }
|
this.pkgs[id].installProgress = !isEmptyObject(pkg['install-progress']) ? this.installPackageService.transform(pkg['install-progress']) : undefined
|
||||||
this.pkgs[id].bulb = {
|
this.pkgs[id].bulb = {
|
||||||
class: bulbClass,
|
class: bulbClass,
|
||||||
img,
|
img,
|
||||||
|
|||||||
@@ -136,22 +136,22 @@
|
|||||||
|
|
||||||
<!-- ** installing or updating ** -->
|
<!-- ** installing or updating ** -->
|
||||||
<div *ngIf="[PackageState.Installing, PackageState.Updating] | includes : pkg.state" style="padding: 16px;">
|
<div *ngIf="[PackageState.Installing, PackageState.Updating] | includes : pkg.state" style="padding: 16px;">
|
||||||
<p>Downloading: {{ (pkg['install-progress'] | installState).downloadProgress }}%</p>
|
<p>Downloading: {{ installProgress.downloadProgress }}%</p>
|
||||||
<ion-progress-bar
|
<ion-progress-bar
|
||||||
[color]="pkg['install-progress']['download-complete'] ? 'success' : 'secondary'"
|
[color]="pkg['install-progress']['download-complete'] ? 'success' : 'secondary'"
|
||||||
[value]="(pkg['install-progress'] | installState).downloadProgress / 100"
|
[value]="installProgress.downloadProgress / 100"
|
||||||
></ion-progress-bar>
|
></ion-progress-bar>
|
||||||
|
|
||||||
<p>Validating: {{ (pkg['install-progress'] | installState).validateProgress }}%</p>
|
<p>Validating: {{ installProgress.validateProgress }}%</p>
|
||||||
<ion-progress-bar
|
<ion-progress-bar
|
||||||
[color]="pkg['install-progress']['validation-complete'] ? 'success' : 'secondary'"
|
[color]="pkg['install-progress']['validation-complete'] ? 'success' : 'secondary'"
|
||||||
[value]="(pkg['install-progress'] | installState).validateProgress / 100"
|
[value]="installProgress.validateProgress / 100"
|
||||||
></ion-progress-bar>
|
></ion-progress-bar>
|
||||||
|
|
||||||
<p>Installing: {{ (pkg['install-progress'] | installState).unpackProgress }}%</p>
|
<p>Installing: {{ 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]="(pkg['install-progress'] | installState).unpackProgress / 100"
|
[value]="installProgress.unpackProgress / 100"
|
||||||
></ion-progress-bar>
|
></ion-progress-bar>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { ConnectionFailure, ConnectionService } from 'src/app/services/connectio
|
|||||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||||
import { AppConfigPage } from 'src/app/modals/app-config/app-config.page'
|
import { AppConfigPage } from 'src/app/modals/app-config/app-config.page'
|
||||||
import { PackageLoadingService } from 'src/app/services/package-loading.service'
|
import { PackageLoadingService } from 'src/app/services/package-loading.service'
|
||||||
|
import { ProgressData } from 'src/app/pipes/install-state.pipe'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-show',
|
selector: 'app-show',
|
||||||
@@ -34,6 +35,7 @@ export class AppShowPage {
|
|||||||
PackageMainStatus = PackageMainStatus
|
PackageMainStatus = PackageMainStatus
|
||||||
connectionFailure: boolean
|
connectionFailure: boolean
|
||||||
loading = true
|
loading = true
|
||||||
|
installProgress: ProgressData
|
||||||
|
|
||||||
@ViewChild(IonContent) content: IonContent
|
@ViewChild(IonContent) content: IonContent
|
||||||
subs: Subscription[] = []
|
subs: Subscription[] = []
|
||||||
@@ -60,9 +62,9 @@ export class AppShowPage {
|
|||||||
this.patch.watch$('package-data', this.pkgId)
|
this.patch.watch$('package-data', this.pkgId)
|
||||||
.subscribe(pkg => {
|
.subscribe(pkg => {
|
||||||
this.pkg = pkg
|
this.pkg = pkg
|
||||||
this.pkg['install-progress'] = { ...this.pkg['install-progress'] }
|
this.installProgress = this.packageLoadingService.transform(this.pkg['install-progress'])
|
||||||
this.rendering = renderPkgStatus(pkg.state, pkg.installed?.status)
|
this.rendering = renderPkgStatus(pkg.state, pkg.installed?.status)
|
||||||
this.mainStatus = { ...pkg.installed.status.main }
|
this.mainStatus = { ...pkg.installed?.status.main }
|
||||||
}),
|
}),
|
||||||
// 2
|
// 2
|
||||||
this.connectionService.watchFailure$()
|
this.connectionService.watchFailure$()
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ export class PackageLoadingService {
|
|||||||
constructor () { }
|
constructor () { }
|
||||||
|
|
||||||
transform (loadData: InstallProgress): ProgressData {
|
transform (loadData: InstallProgress): ProgressData {
|
||||||
console.log('LOAD DATA', loadData)
|
|
||||||
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
|
downloaded = downloadComplete ? size : downloaded
|
||||||
validated = validationComplete ? size : validated
|
validated = validationComplete ? size : validated
|
||||||
|
|||||||
Reference in New Issue
Block a user