no tsc errs

This commit is contained in:
Drew Ansbacher
2021-09-20 21:18:55 -06:00
committed by Aiden McClelland
parent 5467383e8d
commit bd27beecdf
3 changed files with 8 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ import { ConnectionFailure, ConnectionService } from 'src/app/services/connectio
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
import { PackageDataEntry, PackageState } from 'src/app/services/patch-db/data-model'
import { Subscription } from 'rxjs'
import { PkgStatusRendering, renderPkgStatus } from 'src/app/services/pkg-status-rendering.service'
import { PrimaryRendering, renderPkgStatus, StatusRendering } from 'src/app/services/pkg-status-rendering.service'
import { filter } from 'rxjs/operators'
import { isEmptyObject } from 'src/app/util/misc.util'
import { PackageLoadingService, ProgressData } from 'src/app/services/package-loading.service'
@@ -23,7 +23,7 @@ export class AppListPage {
class: string
img: string
}
statusRendering: PkgStatusRendering | null
statusRendering: StatusRendering | null
sub: Subscription | null
installProgress: ProgressData
}} = { }
@@ -70,7 +70,7 @@ export class AppListPage {
class: 'bulb-off',
img: 'assets/img/off-bulb.png',
},
statusRendering: renderPkgStatus(pkgs[id].state, pkgs[id].installed?.status),
statusRendering: PrimaryRendering[renderPkgStatus(pkgs[id]).primary],
sub: null,
installProgress: !isEmptyObject(pkgs[id]['install-progress']) ? this.installPackageService.transform(pkgs[id]['install-progress']) : undefined,
}
@@ -79,7 +79,7 @@ export class AppListPage {
if (!pkg) return
let bulbClass = 'bulb-on'
let img = ''
const statusRendering = renderPkgStatus(pkg.state, pkg.installed?.status)
const statusRendering = PrimaryRendering[renderPkgStatus(pkg).primary]
switch (statusRendering.color) {
case 'danger':
img = 'assets/img/danger-bulb.png'

View File

@@ -11,17 +11,18 @@ export function renderPkgStatus (pkg: PackageDataEntry): {
let health: HealthStatus | null = null
if (pkg.state === PackageState.Installed) {
primary = PrimaryStatus[pkg.installed.status.main.status]
primary = pkg.installed.status.main.status as string as PrimaryStatus
dependency = getDependencyStatus(pkg.installed)
health = getHealthStatus(pkg.installed.status)
} else {
primary = PrimaryStatus[pkg.state]
primary = pkg.state as string as PrimaryStatus
}
return { primary, dependency, health }
}
function getDependencyStatus (pkg: InstalledPackageDataEntry): DependencyStatus {
console.log('pkg', pkg)
if (isEmptyObject(pkg['current-dependencies'])) return null
const pkgIds = Object.keys(pkg.status['dependency-errors'])

View File

@@ -86,6 +86,7 @@ export function isObject (val: any): boolean {
}
export function isEmptyObject (obj: object): boolean {
if (obj === undefined) return true
return !Object.keys(obj).length
}