mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
health page, manifest page, watch unauth, begin redesign
This commit is contained in:
committed by
Aiden McClelland
parent
7013364ae8
commit
5d24d9324c
@@ -28,7 +28,7 @@ export module RR {
|
||||
export type GetServerLogsRes = Log[]
|
||||
|
||||
export type GetServerMetricsReq = { } // server.metrics
|
||||
export type GetServerMetricsRes = ServerMetrics
|
||||
export type GetServerMetricsRes = Metrics
|
||||
|
||||
export type UpdateServerReq = WithExpire<{ }> // server.update
|
||||
export type UpdateServerRes = WithRevision<null>
|
||||
@@ -219,7 +219,7 @@ export interface ActionResponse {
|
||||
qr: boolean
|
||||
}
|
||||
|
||||
export interface ServerMetrics {
|
||||
export interface Metrics {
|
||||
[key: string]: {
|
||||
[key: string]: {
|
||||
value: string | number | null
|
||||
|
||||
@@ -67,17 +67,7 @@ export module Mock {
|
||||
inject: false,
|
||||
'shm-size': '',
|
||||
},
|
||||
'health-check': {
|
||||
type: 'docker',
|
||||
image: '',
|
||||
system: true,
|
||||
entrypoint: '',
|
||||
args: [''],
|
||||
mounts: { },
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
inject: false,
|
||||
'shm-size': '',
|
||||
},
|
||||
'health-checks': { },
|
||||
config: null,
|
||||
volumes: { },
|
||||
'min-os-version': '0.2.12',
|
||||
@@ -198,17 +188,7 @@ export module Mock {
|
||||
inject: false,
|
||||
'shm-size': '',
|
||||
},
|
||||
'health-check': {
|
||||
type: 'docker',
|
||||
image: '',
|
||||
system: true,
|
||||
entrypoint: '',
|
||||
args: [''],
|
||||
mounts: { },
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
inject: false,
|
||||
'shm-size': '',
|
||||
},
|
||||
'health-checks': { },
|
||||
config: null,
|
||||
volumes: { },
|
||||
'min-os-version': '0.2.12',
|
||||
@@ -353,17 +333,7 @@ export module Mock {
|
||||
inject: false,
|
||||
'shm-size': '',
|
||||
},
|
||||
'health-check': {
|
||||
type: 'docker',
|
||||
image: '',
|
||||
system: true,
|
||||
entrypoint: '',
|
||||
args: [''],
|
||||
mounts: { },
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
inject: false,
|
||||
'shm-size': '',
|
||||
},
|
||||
'health-checks': { },
|
||||
config: null,
|
||||
volumes: { },
|
||||
'min-os-version': '0.2.12',
|
||||
@@ -991,7 +961,7 @@ export module Mock {
|
||||
},
|
||||
},
|
||||
},
|
||||
'Another Property': {
|
||||
'Another Value': {
|
||||
type: 'string',
|
||||
description: 'Some more information about the service.',
|
||||
copyable: false,
|
||||
|
||||
@@ -22,7 +22,7 @@ export class HttpService {
|
||||
this.fullUrl = `${window.location.protocol}//${window.location.hostname}:${port}/${url}/${version}`
|
||||
}
|
||||
|
||||
watch401$ (): Observable<{ }> {
|
||||
watchUnauth$ (): Observable<{ }> {
|
||||
return this.unauthorizedApiResponse$.asObservable()
|
||||
}
|
||||
|
||||
@@ -36,7 +36,10 @@ export class HttpService {
|
||||
|
||||
const res = await this.httpRequest<RPCResponse<T>>(httpOpts)
|
||||
|
||||
if (isRpcError(res)) throw new RpcError(res.error)
|
||||
if (isRpcError(res)) {
|
||||
if (res.error.code === 34) this.unauthorizedApiResponse$.next(true)
|
||||
throw new RpcError(res.error)
|
||||
}
|
||||
|
||||
if (isRpcSuccess(res)) return res.result
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PackageDataEntry, PackageMainStatus, PackageState, Status } from '../models/patch-db/data-model'
|
||||
import { HealthCheckResultWarmingUp, MainStatus, MainStatusRunning, PackageDataEntry, PackageMainStatus, PackageState, Status } from '../models/patch-db/data-model'
|
||||
import { ConnectionState } from './connection.service'
|
||||
|
||||
export function renderPkgStatus (pkg: PackageDataEntry, connection: ConnectionState): PkgStatusRendering {
|
||||
@@ -19,16 +19,26 @@ function handleInstalledState (status: Status): PkgStatusRendering {
|
||||
return { display: 'Needs Config', color: 'warning', showDots: false, feStatus: FEStatus.NeedsConfig }
|
||||
}
|
||||
|
||||
if (Object.values(status['dependency-errors']).length) {
|
||||
if (Object.keys(status['dependency-errors']).length) {
|
||||
return { display: 'Dependency Issue', color: 'warning', showDots: false, feStatus: FEStatus.DependencyIssue }
|
||||
}
|
||||
|
||||
switch (status.main.status) {
|
||||
case PackageMainStatus.Running: return { display: 'Running', color: 'success', showDots: false, feStatus: FEStatus.Running }
|
||||
case PackageMainStatus.Stopping: return { display: 'Stopping', color: 'dark', showDots: true, feStatus: FEStatus.Stopping }
|
||||
case PackageMainStatus.Stopped: return { display: 'Stopped', color: 'medium', showDots: false, feStatus: FEStatus.Stopped }
|
||||
case PackageMainStatus.BackingUp: return { display: 'Backing Up', color: 'warning', showDots: true, feStatus: FEStatus.BackingUp }
|
||||
case PackageMainStatus.Restoring: return { display: 'Restoring', color: 'primary', showDots: true, feStatus: FEStatus.Restoring }
|
||||
case PackageMainStatus.Running: return handleRunningState(status.main)
|
||||
}
|
||||
}
|
||||
|
||||
function handleRunningState (status: MainStatusRunning): PkgStatusRendering {
|
||||
if (Object.values(status.health).some(h => h.result === 'failure')) {
|
||||
return { display: 'Needs Attention', color: 'danger', showDots: false, feStatus: FEStatus.NeedsAttention }
|
||||
} else if (Object.values(status.health).some(h => h.result === 'warming-up')) {
|
||||
return { display: 'Starting Up', color: 'warning', showDots: true, feStatus: FEStatus.StartingUp }
|
||||
} else {
|
||||
return { display: 'Running', color: 'success', showDots: false, feStatus: FEStatus.Running }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +62,8 @@ export enum FEStatus {
|
||||
BackingUp = 'backing-up',
|
||||
Restoring = 'restoring',
|
||||
// FE
|
||||
NeedsAttention = 'needs-attention',
|
||||
StartingUp = 'starting-up',
|
||||
Connecting = 'connecting',
|
||||
DependencyIssue = 'dependency-issue',
|
||||
NeedsConfig = 'needs-config',
|
||||
|
||||
Reference in New Issue
Block a user