mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
make needs config a primary status
This commit is contained in:
committed by
Aiden McClelland
parent
6b62f0a883
commit
b6e25cc6ff
@@ -71,7 +71,7 @@ export class AppListPage {
|
||||
this.pkgs[id].entry = pkg
|
||||
this.pkgs[id].installProgress = !isEmptyObject(pkg['install-progress']) ? this.installPackageService.transform(pkg['install-progress']) : undefined
|
||||
this.pkgs[id].primaryRendering = primaryRendering
|
||||
this.pkgs[id].error = [HealthStatus.NeedsConfig, HealthStatus.Failure].includes(statuses.health) || [DependencyStatus.Issue, DependencyStatus.Critical].includes(statuses.dependency)
|
||||
this.pkgs[id].error = statuses.health === HealthStatus.Failure || [DependencyStatus.Issue, DependencyStatus.Critical].includes(statuses.dependency)
|
||||
})
|
||||
})
|
||||
}),
|
||||
|
||||
@@ -11,7 +11,7 @@ export function renderPkgStatus (pkg: PackageDataEntry): {
|
||||
let health: HealthStatus | null = null
|
||||
|
||||
if (pkg.state === PackageState.Installed) {
|
||||
primary = pkg.installed.status.main.status as string as PrimaryStatus
|
||||
primary = getPrimaryStatus(pkg.installed.status)
|
||||
dependency = getDependencyStatus(pkg)
|
||||
health = getHealthStatus(pkg.installed.status)
|
||||
} else {
|
||||
@@ -21,6 +21,14 @@ export function renderPkgStatus (pkg: PackageDataEntry): {
|
||||
return { primary, dependency, health }
|
||||
}
|
||||
|
||||
function getPrimaryStatus (status: Status): PrimaryStatus {
|
||||
if (!status.configured) {
|
||||
return PrimaryStatus.NeedsConfig
|
||||
} else {
|
||||
return status.main.status as any as PrimaryStatus
|
||||
}
|
||||
}
|
||||
|
||||
function getDependencyStatus (pkg: PackageDataEntry): DependencyStatus {
|
||||
const installed = pkg.installed
|
||||
if (isEmptyObject(installed['current-dependencies'])) return null
|
||||
@@ -37,10 +45,6 @@ function getDependencyStatus (pkg: PackageDataEntry): DependencyStatus {
|
||||
}
|
||||
|
||||
function getHealthStatus (status: Status): HealthStatus {
|
||||
if (!status.configured) {
|
||||
return HealthStatus.NeedsConfig
|
||||
}
|
||||
|
||||
if (status.main.status === PackageMainStatus.Running) {
|
||||
const values = Object.values(status.main.health)
|
||||
if (values.some(h => h.result === 'failure')) {
|
||||
@@ -72,6 +76,8 @@ export enum PrimaryStatus {
|
||||
Stopped = 'stopped',
|
||||
BackingUp = 'backing-up',
|
||||
Restoring = 'restoring',
|
||||
// config
|
||||
NeedsConfig = 'needs-config',
|
||||
}
|
||||
|
||||
export enum DependencyStatus {
|
||||
@@ -81,7 +87,6 @@ export enum DependencyStatus {
|
||||
}
|
||||
|
||||
export enum HealthStatus {
|
||||
NeedsConfig = 'needs-config',
|
||||
Failure = 'failure',
|
||||
Starting = 'starting',
|
||||
Loading = 'loading',
|
||||
@@ -97,6 +102,7 @@ export const PrimaryRendering: { [key: string]: StatusRendering } = {
|
||||
[PrimaryStatus.BackingUp]: { display: 'Backing Up', color: 'primary', showDots: true },
|
||||
[PrimaryStatus.Restoring]: { display: 'Restoring', color: 'primary', showDots: true },
|
||||
[PrimaryStatus.Running]: { display: 'Running', color: 'success', showDots: false },
|
||||
[PrimaryStatus.NeedsConfig]: { display: 'Needs Config', color: 'warning' },
|
||||
}
|
||||
|
||||
export const DependencyRendering: { [key: string]: StatusRendering } = {
|
||||
@@ -106,7 +112,6 @@ export const DependencyRendering: { [key: string]: StatusRendering } = {
|
||||
}
|
||||
|
||||
export const HealthRendering: { [key: string]: StatusRendering } = {
|
||||
[HealthStatus.NeedsConfig]: { display: 'Needs Config', color: 'warning' },
|
||||
[HealthStatus.Failure]: { display: 'Failure', color: 'danger' },
|
||||
[HealthStatus.Starting]: { display: 'Starting', color: 'primary' },
|
||||
[HealthStatus.Loading]: { display: 'Loading', color: 'primary' },
|
||||
|
||||
Reference in New Issue
Block a user