mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
Feature/install wizard disk info (#1923)
* update disk res for install wizard (#1914) * change types to match setup api Co-authored-by: Matt Hill <MattDHill@users.noreply.github.com>
This commit is contained in:
@@ -4,11 +4,8 @@ import {
|
||||
LoadingController,
|
||||
ModalController,
|
||||
} from '@ionic/angular'
|
||||
import {
|
||||
ApiService,
|
||||
CifsBackupTarget,
|
||||
EmbassyOSRecoveryInfo,
|
||||
} from 'src/app/services/api/api.service'
|
||||
import { ApiService, CifsBackupTarget } from 'src/app/services/api/api.service'
|
||||
import { EmbassyOSDiskInfo } from '@start9labs/shared'
|
||||
import { PasswordPage } from '../password/password.page'
|
||||
|
||||
@Component({
|
||||
@@ -61,7 +58,7 @@ export class CifsModal {
|
||||
}
|
||||
|
||||
private async presentModalPassword(
|
||||
embassyOS: EmbassyOSRecoveryInfo,
|
||||
embassyOS: EmbassyOSDiskInfo,
|
||||
): Promise<void> {
|
||||
const target: CifsBackupTarget = {
|
||||
...this.cifs,
|
||||
|
||||
@@ -8,10 +8,9 @@ import {
|
||||
import {
|
||||
ApiService,
|
||||
BackupRecoverySource,
|
||||
DiskInfo,
|
||||
DiskRecoverySource,
|
||||
} from 'src/app/services/api/api.service'
|
||||
import { ErrorToastService } from '@start9labs/shared'
|
||||
import { DiskInfo, ErrorToastService } from '@start9labs/shared'
|
||||
import { StateService } from 'src/app/services/state.service'
|
||||
import { PasswordPage } from '../../modals/password/password.page'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<h2 class="target-label">Physical Drive</h2>
|
||||
<div class="ion-text-left ion-padding-bottom">
|
||||
<p>
|
||||
Restore your Emabssy from a physcial drive that is plugged
|
||||
Restore your Embassy from a physical drive that is plugged
|
||||
directly into your Embassy.
|
||||
</p>
|
||||
<br />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { AlertController, NavController } from '@ionic/angular'
|
||||
import { ApiService, DiskInfo } from 'src/app/services/api/api.service'
|
||||
import { ErrorToastService } from '@start9labs/shared'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { DiskInfo, ErrorToastService } from '@start9labs/shared'
|
||||
import { StateService } from 'src/app/services/state.service'
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as jose from 'node-jose'
|
||||
import { DiskListResponse, EmbassyOSDiskInfo } from '@start9labs/shared'
|
||||
export abstract class ApiService {
|
||||
pubkey?: jose.JWK.Key
|
||||
|
||||
@@ -6,7 +7,7 @@ export abstract class ApiService {
|
||||
abstract getPubKey(): Promise<void> // setup.get-pubkey
|
||||
abstract getDrives(): Promise<DiskListResponse> // setup.disk.list
|
||||
abstract getRecoveryStatus(): Promise<RecoveryStatusRes> // setup.recovery.status
|
||||
abstract verifyCifs(cifs: CifsRecoverySource): Promise<EmbassyOSRecoveryInfo> // setup.cifs.verify
|
||||
abstract verifyCifs(cifs: CifsRecoverySource): Promise<EmbassyOSDiskInfo> // setup.cifs.verify
|
||||
abstract importDrive(importInfo: ImportDriveReq): Promise<SetupEmbassyRes> // setup.attach
|
||||
abstract setupEmbassy(setupInfo: SetupEmbassyReq): Promise<SetupEmbassyRes> // setup.execute
|
||||
abstract setupComplete(): Promise<SetupEmbassyRes> // setup.complete
|
||||
@@ -48,15 +49,6 @@ export type SetupEmbassyRes = {
|
||||
'root-ca': string
|
||||
}
|
||||
|
||||
export type EmbassyOSRecoveryInfo = {
|
||||
version: string
|
||||
full: boolean
|
||||
'password-hash': string | null
|
||||
'wrapped-key': string | null
|
||||
}
|
||||
|
||||
export type DiskListResponse = DiskInfo[]
|
||||
|
||||
export type DiskBackupTarget = {
|
||||
vendor: string | null
|
||||
model: string | null
|
||||
@@ -64,7 +56,7 @@ export type DiskBackupTarget = {
|
||||
label: string | null
|
||||
capacity: number
|
||||
used: number | null
|
||||
'embassy-os': EmbassyOSRecoveryInfo | null
|
||||
'embassy-os': EmbassyOSDiskInfo | null
|
||||
}
|
||||
|
||||
export type CifsBackupTarget = {
|
||||
@@ -72,7 +64,7 @@ export type CifsBackupTarget = {
|
||||
path: string
|
||||
username: string
|
||||
mountable: boolean
|
||||
'embassy-os': EmbassyOSRecoveryInfo | null
|
||||
'embassy-os': EmbassyOSDiskInfo | null
|
||||
}
|
||||
|
||||
export type DiskRecoverySource = {
|
||||
@@ -99,25 +91,8 @@ export type CifsRecoverySource = {
|
||||
password: Encrypted | null
|
||||
}
|
||||
|
||||
export type DiskInfo = {
|
||||
logicalname: string
|
||||
vendor: string | null
|
||||
model: string | null
|
||||
partitions: PartitionInfo[]
|
||||
capacity: number
|
||||
guid: string | null // cant back up if guid exists, but needed if migrating
|
||||
}
|
||||
|
||||
export type RecoveryStatusRes = {
|
||||
'bytes-transferred': number
|
||||
'total-bytes': number
|
||||
complete: boolean
|
||||
}
|
||||
|
||||
export type PartitionInfo = {
|
||||
logicalname: string
|
||||
label: string | null
|
||||
capacity: number
|
||||
used: number | null
|
||||
'embassy-os': EmbassyOSRecoveryInfo | null
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import {
|
||||
DiskListResponse,
|
||||
EmbassyOSDiskInfo,
|
||||
encodeBase64,
|
||||
HttpService,
|
||||
isRpcError,
|
||||
@@ -9,10 +11,7 @@ import {
|
||||
import {
|
||||
ApiService,
|
||||
CifsRecoverySource,
|
||||
DiskListResponse,
|
||||
DiskMigrateSource,
|
||||
DiskRecoverySource,
|
||||
EmbassyOSRecoveryInfo,
|
||||
GetStatusRes,
|
||||
ImportDriveReq,
|
||||
RecoveryStatusRes,
|
||||
@@ -68,7 +67,7 @@ export class LiveApiService extends ApiService {
|
||||
|
||||
async verifyCifs(source: CifsRecoverySource) {
|
||||
source.path = source.path.replace('/\\/g', '/')
|
||||
return this.rpcRequest<EmbassyOSRecoveryInfo>({
|
||||
return this.rpcRequest<EmbassyOSDiskInfo>({
|
||||
method: 'setup.cifs.verify',
|
||||
params: source,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user