Feature/diagnostic repair disk (#1358)

* add disk repair actions to diagnostic ui and server menu

* only display repair disk button when activated

* fix typo

* add repairDrive fn with restart to diagnostic ui

* fix copy

* add alert before repairing disk in diagnostic ui

* fix repair disk message spacing and hidden display

* fix version comparisons and enable dismissable refresh modal

* eager load medkit and fix storefront to outline icon
This commit is contained in:
Lucy C
2022-03-28 17:31:32 -06:00
committed by GitHub
parent 8ef1584a4d
commit e53bf81cbc
15 changed files with 260 additions and 82 deletions

View File

@@ -1,22 +1,31 @@
export abstract class ApiService {
abstract getError (): Promise<GetErrorRes>
abstract restart (): Promise<void>
abstract forgetDrive (): Promise<void>
abstract getLogs (params: GetLogsReq): Promise<GetLogsRes>
abstract getError(): Promise<GetErrorRes>
abstract restart(): Promise<void>
abstract forgetDrive(): Promise<void>
abstract repairDisk(): Promise<void>
abstract getLogs(params: GetLogsReq): Promise<GetLogsRes>
}
export interface GetErrorRes {
code: number,
message: string,
code: number
message: string
data: { details: string }
}
export type GetLogsReq = { cursor?: string, before_flag?: boolean, limit?: number }
export type GetLogsReq = {
cursor?: string
before_flag?: boolean
limit?: number
}
export type GetLogsRes = LogsRes
export type LogsRes = { entries: Log[], 'start-cursor'?: string, 'end-cursor'?: string }
export type LogsRes = {
entries: Log[]
'start-cursor'?: string
'end-cursor'?: string
}
export interface Log {
timestamp: string
message: string
}
}

View File

@@ -24,7 +24,14 @@ export class LiveApiService extends ApiService {
forgetDrive(): Promise<void> {
return this.http.rpcRequest<void>({
method: 'diagnostic.forget-disk',
method: 'diagnostic.disk.forget',
params: {},
})
}
repairDisk(): Promise<void> {
return this.http.rpcRequest<void>({
method: 'diagnostic.disk.repair',
params: {},
})
}

View File

@@ -33,6 +33,11 @@ export class MockApiService extends ApiService {
return null
}
async repairDisk(): Promise<void> {
await pauseFor(1000)
return null
}
async getLogs(params: GetLogsReq): Promise<GetLogsRes> {
await pauseFor(1000)
let entries: Log[]