mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
rework Embassy tab, fix error type in patch-db, fix response type for embassy updates
This commit is contained in:
committed by
Aiden McClelland
parent
2f865a1953
commit
933481cd7d
@@ -34,7 +34,7 @@ export module RR {
|
||||
export type GetServerMetricsRes = Metrics
|
||||
|
||||
export type UpdateServerReq = WithExpire<{ }> // server.update
|
||||
export type UpdateServerRes = WithRevision<null>
|
||||
export type UpdateServerRes = WithRevision<'updating' | 'no-updates'>
|
||||
|
||||
export type RestartServerReq = { } // server.restart
|
||||
export type RestartServerRes = null
|
||||
|
||||
@@ -54,8 +54,15 @@ export abstract class ApiService implements Source<DataModel>, Http<DataModel> {
|
||||
|
||||
protected abstract updateServerRaw (params: RR.UpdateServerReq): Promise<RR.UpdateServerRes>
|
||||
updateServer = (params: RR.UpdateServerReq) => this.syncResponse(
|
||||
() => this.updateServerRaw(params),
|
||||
() => this.updateServerWrapper(params),
|
||||
)()
|
||||
async updateServerWrapper (params: RR.UpdateServerReq) {
|
||||
const res = await this.updateServerRaw(params)
|
||||
if (res.response === 'no-updates') {
|
||||
throw new Error('Could ont find a newer version of EmbassyOS')
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
abstract restartServer (params: RR.UpdateServerReq): Promise<RR.RestartServerRes>
|
||||
|
||||
|
||||
@@ -118,9 +118,11 @@ export class MockApiService extends ApiService {
|
||||
value: initialProgress,
|
||||
},
|
||||
]
|
||||
const res = await this.http.rpcRequest<WithRevision<null>>({ method: 'db.patch', params: { patch } })
|
||||
const res = await this.http.rpcRequest<RR.UpdateServerRes>({ method: 'db.patch', params: { patch } })
|
||||
res.response = 'updating'
|
||||
|
||||
this.updateOSProgress(initialProgress.size)
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ import { ErrorHandler, Injectable } from '@angular/core'
|
||||
@Injectable()
|
||||
export class GlobalErrorHandler implements ErrorHandler {
|
||||
|
||||
handleError (error: any): void {
|
||||
const chunkFailedMessage = /Loading chunk [\d]+ failed/
|
||||
handleError (e: any): void {
|
||||
console.error(e)
|
||||
const chunkFailedMessage = /Loading chunk [\d]+ failed/
|
||||
|
||||
if (chunkFailedMessage.test(error.message)) {
|
||||
if (chunkFailedMessage.test(e.message)) {
|
||||
window.location.reload()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ export interface DependencyErrorIncorrectVersion {
|
||||
|
||||
export interface DependencyErrorConfigUnsatisfied {
|
||||
type: DependencyErrorType.ConfigUnsatisfied
|
||||
errors: string[]
|
||||
error: string
|
||||
}
|
||||
|
||||
export interface DependencyErrorHealthChecksFailed {
|
||||
|
||||
Reference in New Issue
Block a user