mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-27 02:41:53 +00:00
fix install progress by cloning
This commit is contained in:
@@ -47,6 +47,7 @@ export class AppListPage {
|
||||
}),
|
||||
)
|
||||
.subscribe(pkgs => {
|
||||
console.log('PACKAGES LIST', pkgs)
|
||||
this.loading = false
|
||||
|
||||
const ids = Object.keys(pkgs)
|
||||
@@ -72,6 +73,8 @@ export class AppListPage {
|
||||
}
|
||||
// subscribe to pkg
|
||||
this.pkgs[id].sub = this.patch.watch$('package-data', id).subscribe(pkg => {
|
||||
console.log('SOLO PKG', id, pkg)
|
||||
if (!pkg) return
|
||||
let bulbClass = 'bulb-on'
|
||||
let img = ''
|
||||
const statusRendering = renderPkgStatus(pkg.state, pkg.installed?.status)
|
||||
@@ -91,6 +94,7 @@ export class AppListPage {
|
||||
break
|
||||
}
|
||||
this.pkgs[id].entry = pkg
|
||||
this.pkgs[id].entry['install-progress'] = { ...this.pkgs[id].entry['install-progress'] }
|
||||
this.pkgs[id].bulb = {
|
||||
class: bulbClass,
|
||||
img,
|
||||
|
||||
@@ -6,7 +6,6 @@ import { Metric } from 'src/app/services/api/api.types'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { MainStatus } from 'src/app/services/patch-db/data-model'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { pauseFor } from 'src/app/util/misc.util'
|
||||
|
||||
@Component({
|
||||
@@ -27,19 +26,11 @@ export class AppMetricsPage {
|
||||
constructor (
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly errToast: ErrorToastService,
|
||||
private readonly patch: PatchDbService,
|
||||
private readonly embassyApi: ApiService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
|
||||
this.subs = [
|
||||
this.patch.watch$('package-data', this.pkgId, 'installed', 'status', 'main')
|
||||
.subscribe(main => {
|
||||
this.mainStatus = main
|
||||
}),
|
||||
]
|
||||
|
||||
this.startDaemon()
|
||||
}
|
||||
|
||||
@@ -49,7 +40,6 @@ export class AppMetricsPage {
|
||||
|
||||
ngOnDestroy () {
|
||||
this.stopDaemon()
|
||||
this.subs.forEach(sub => sub.unsubscribe())
|
||||
}
|
||||
|
||||
async startDaemon (): Promise<void> {
|
||||
|
||||
@@ -58,8 +58,9 @@ export class AppShowPage {
|
||||
this.patch.watch$('package-data', this.pkgId)
|
||||
.subscribe(pkg => {
|
||||
this.pkg = pkg
|
||||
this.pkg['install-progress'] = { ...this.pkg['install-progress'] }
|
||||
this.rendering = renderPkgStatus(pkg.state, pkg.installed?.status)
|
||||
this.mainStatus = pkg.installed?.status.main
|
||||
this.mainStatus = { ...pkg.installed.status.main }
|
||||
}),
|
||||
// 2
|
||||
this.connectionService.watchFailure$()
|
||||
|
||||
@@ -9,7 +9,6 @@ import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { MarketplaceService } from '../marketplace.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { debounce } from 'src/app/util/misc.util'
|
||||
|
||||
@Component({
|
||||
selector: 'marketplace-list',
|
||||
@@ -51,6 +50,9 @@ export class MarketplaceListPage {
|
||||
this.subs = [
|
||||
this.patch.watch$('package-data').subscribe(pkgs => {
|
||||
this.localPkgs = pkgs
|
||||
Object.values(this.localPkgs).forEach(pkg => {
|
||||
pkg['install-progress'] = { ...pkg['install-progress'] }
|
||||
})
|
||||
}),
|
||||
]
|
||||
|
||||
@@ -108,7 +110,6 @@ export class MarketplaceListPage {
|
||||
)
|
||||
}
|
||||
|
||||
@debounce(1000)
|
||||
private async getPkgs (doInfinite = false): Promise<void> {
|
||||
try {
|
||||
if (this.category === 'updates') {
|
||||
|
||||
@@ -48,7 +48,9 @@ export class MarketplaceShowPage {
|
||||
this.subs = [
|
||||
this.patch.watch$('package-data', this.pkgId)
|
||||
.subscribe(pkg => {
|
||||
if (!pkg) return
|
||||
this.localPkg = pkg
|
||||
this.localPkg['install-progress'] = { ...this.localPkg['install-progress'] }
|
||||
}),
|
||||
]
|
||||
|
||||
|
||||
@@ -7,7 +7,11 @@ import { InstallProgress } from '../services/patch-db/data-model'
|
||||
export class InstallState implements PipeTransform {
|
||||
|
||||
transform (loadData: InstallProgress): ProgressData {
|
||||
const { downloaded, validated, unpacked, size } = loadData
|
||||
console.log('LOAD DATA', loadData)
|
||||
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
|
||||
|
||||
const downloadWeight = 1
|
||||
const validateWeight = .2
|
||||
@@ -25,7 +29,7 @@ export class InstallState implements PipeTransform {
|
||||
downloadProgress: Math.round(100 * downloaded / size),
|
||||
validateProgress: Math.round(100 * validated / size),
|
||||
unpackProgress: Math.round(100 * unpacked / size),
|
||||
isComplete: loadData['download-complete'] && loadData['validation-complete'] && loadData['unpack-complete'],
|
||||
isComplete: downloadComplete && validationComplete && unpackComplete,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user