mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
handle possible null case for dep error
This commit is contained in:
committed by
Aiden McClelland
parent
8c6fab319a
commit
eaafc764f5
@@ -207,7 +207,7 @@ export class AppShowPage {
|
|||||||
let actionText = 'View'
|
let actionText = 'View'
|
||||||
let action: () => any = () => this.navCtrl.navigateForward(`/services/${id}`)
|
let action: () => any = () => this.navCtrl.navigateForward(`/services/${id}`)
|
||||||
|
|
||||||
const error = this.pkg.installed.status['dependency-errors'][id] || null
|
const error = this.pkg.installed.status['dependency-errors'][id]
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
// health checks failed
|
// health checks failed
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ export interface Action {
|
|||||||
export interface Status {
|
export interface Status {
|
||||||
configured: boolean
|
configured: boolean
|
||||||
main: MainStatus
|
main: MainStatus
|
||||||
'dependency-errors': { [id: string]: DependencyError }
|
'dependency-errors': { [id: string]: DependencyError | null }
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MainStatus = MainStatusStopped | MainStatusStopping | MainStatusRunning | MainStatusBackingUp | MainStatusRestoring
|
export type MainStatus = MainStatusStopped | MainStatusStopping | MainStatusRunning | MainStatusBackingUp | MainStatusRestoring
|
||||||
|
|||||||
@@ -33,15 +33,16 @@ function getDependencyStatus (pkg: PackageDataEntry): DependencyStatus {
|
|||||||
const installed = pkg.installed
|
const installed = pkg.installed
|
||||||
if (isEmptyObject(installed['current-dependencies'])) return null
|
if (isEmptyObject(installed['current-dependencies'])) return null
|
||||||
|
|
||||||
const pkgIds = Object.keys(installed.status['dependency-errors'])
|
const depErrors = installed.status['dependency-errors']
|
||||||
|
const depIds = Object.keys(depErrors).filter(key => !!depErrors[key])
|
||||||
|
|
||||||
for (let pkgId of pkgIds) {
|
for (let pkgId of depIds) {
|
||||||
if (pkg.manifest.dependencies[pkgId].critical) {
|
if (pkg.manifest.dependencies[pkgId].critical) {
|
||||||
return DependencyStatus.Critical
|
return DependencyStatus.Critical
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pkgIds.length ? DependencyStatus.Issue : DependencyStatus.Satisfied
|
return depIds.length ? DependencyStatus.Issue : DependencyStatus.Satisfied
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHealthStatus (status: Status): HealthStatus {
|
function getHealthStatus (status: Status): HealthStatus {
|
||||||
|
|||||||
Reference in New Issue
Block a user