change disk type, add endpoint, share stats prompt

This commit is contained in:
Matt Hill
2021-10-17 08:18:25 -06:00
committed by Aiden McClelland
parent effcd5ea57
commit c27fd487b9
22 changed files with 350 additions and 148 deletions

View File

@@ -985,12 +985,10 @@ export module Mock {
label: 'Matt Stuff',
capacity: 1000000000000,
used: 0,
'embassy-os': null,
},
],
capacity: 1000000000000,
'embassy-os': {
version: '0.3.0',
},
},
{
logicalname: '/dev/sdb',
@@ -1002,21 +1000,35 @@ export module Mock {
label: 'Partition 1',
capacity: 1000000000,
used: 1000000000,
'embassy-os': {
version: '0.3.0',
full: true,
},
},
{
logicalname: 'sdba2',
label: 'Partition 2',
capacity: 900000000,
used: 300000000,
'embassy-os': null,
},
],
capacity: 10000000000,
'embassy-os': {
version: '0.3.0',
},
},
]
export const BackupInfo: RR.GetBackupInfoRes = {
version: '0.3.0',
timestamp: new Date().toISOString(),
'package-backups': {
bitcoind: {
version: '0.21.0',
'os-version': '0.3.0',
timestamp: new Date().toISOString(),
},
},
}
export const PackageProperties: RR.GetPackagePropertiesRes<2> = {
version: 2,
data: {
@@ -1534,6 +1546,7 @@ export module Mock {
manifest: MockManifestBitcoind,
installed: {
manifest: MockManifestBitcoind,
'last-backup': null,
status: {
configured: true,
main: {
@@ -1571,6 +1584,7 @@ export module Mock {
},
manifest: MockManifestBitcoinProxy,
installed: {
'last-backup': null,
status: {
configured: true,
main: {
@@ -1623,6 +1637,7 @@ export module Mock {
},
manifest: MockManifestLnd,
installed: {
'last-backup': null,
status: {
configured: true,
main: {

View File

@@ -46,7 +46,7 @@ export module RR {
export type GetSessionsReq = { } // sessions.list
export type GetSessionsRes = {
current: string,
current: string
sessions: { [hash: string]: Session }
}
@@ -126,8 +126,8 @@ export module RR {
export type GetDisksReq = { } // disk.list
export type GetDisksRes = DiskInfo[]
export type EjectDisksReq = { logicalname: string } // disk.eject
export type EjectDisksRes = null
export type GetBackupInfoReq = { logicalname: string, password: string } // disk.backup-info
export type GetBackupInfoRes = BackupInfo
// package
@@ -214,7 +214,7 @@ export type WithExpire<T> = { 'expire-id'?: string } & T
export type WithRevision<T> = { response: T, revision?: Revision }
export interface MarketplaceData {
categories: string[],
categories: string[]
}
export interface MarketplaceEOS {
@@ -243,8 +243,8 @@ export interface Breakages {
}
export interface TaggedDependencyError {
dependency: string,
error: DependencyError,
dependency: string
error: DependencyError
}
export interface Log {
@@ -289,22 +289,35 @@ export type PlatformType = 'cli' | 'ios' | 'ipad' | 'iphone' | 'android' | 'phab
export interface DiskInfo {
logicalname: string
vendor: string | null,
model: string | null,
partitions: PartitionInfo[],
vendor: string | null
model: string | null
partitions: PartitionInfo[]
capacity: number
'embassy-os': EmbassyOsDiskInfo | null
}
export interface PartitionInfo {
logicalname: string,
label: string | null,
capacity: number,
used: number | null,
logicalname: string
label: string | null
capacity: number
used: number | null
'embassy-os': EmbassyOsDiskInfo | null
}
export interface EmbassyOsDiskInfo {
version: string
full: boolean
}
export interface BackupInfo {
version: string,
timestamp: string,
'package-backups': {
[id: string]: {
version: string
'os-version': string
timestamp: string
}
}
}
export interface ServerSpecs {

View File

@@ -130,7 +130,7 @@ export abstract class ApiService implements Source<DataModel>, Http<DataModel> {
abstract getDisks (params: RR.GetDisksReq): Promise<RR.GetDisksRes>
abstract ejectDisk (params: RR.EjectDisksReq): Promise<RR.EjectDisksRes>
abstract getBackupInfo (params: RR.GetBackupInfoReq): Promise<RR.GetBackupInfoRes>
// package

View File

@@ -197,8 +197,8 @@ export class LiveApiService extends ApiService {
return this.http.rpcRequest({ method: 'disk.list', params })
}
ejectDisk (params: RR.EjectDisksReq): Promise <RR.EjectDisksRes> {
return this.http.rpcRequest({ method: 'disk.eject', params })
getBackupInfo (params: RR.GetBackupInfoReq): Promise <RR.GetBackupInfoRes> {
return this.http.rpcRequest({ method: 'disk.backup-info', params })
}
// package

View File

@@ -291,9 +291,9 @@ export class MockApiService extends ApiService {
return Mock.Disks
}
async ejectDisk (params: RR.EjectDisksReq): Promise<RR.EjectDisksRes> {
async getBackupInfo (params: RR.GetBackupInfoReq): Promise<RR.GetBackupInfoRes> {
await pauseFor(2000)
return null
return Mock.BackupInfo
}
// package
@@ -415,12 +415,13 @@ export class MockApiService extends ApiService {
const patch = [
{
op: PatchOp.REPLACE,
path,
value: {
status: PackageMainStatus.Running,
started: new Date().toISOString(), // UTC date string
health: { },
},
path: path + '/status',
value: PackageMainStatus.Running,
},
{
op: PatchOp.REPLACE,
path: path + '/started',
value: new Date().toISOString(),
},
]
return this.http.rpcRequest<WithRevision<null>>({ method: 'db.patch', params: { patch } })
@@ -440,14 +441,12 @@ export class MockApiService extends ApiService {
async stopPackageRaw (params: RR.StopPackageReq): Promise<RR.StopPackageRes> {
await pauseFor(2000)
const path = `/package-data/${params.id}/installed/status/main`
const path = `/package-data/${params.id}/installed/status/main/status`
const patch = [
{
op: PatchOp.REPLACE,
path,
value: {
status: PackageMainStatus.Stopping,
},
value: PackageMainStatus.Stopping,
},
]
const res = await this.http.rpcRequest<WithRevision<null>>({ method: 'db.patch', params: { patch } })
@@ -455,7 +454,7 @@ export class MockApiService extends ApiService {
const patch = [
{
op: PatchOp.REPLACE,
path: path + '/status',
path,
value: PackageMainStatus.Stopped,
},
]