mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
spec updates
This commit is contained in:
committed by
Aiden McClelland
parent
c21ebd2c5e
commit
77495cb674
@@ -11,18 +11,12 @@ setup.disk.list
|
||||
|
||||
Response
|
||||
{
|
||||
logicalname: string
|
||||
partitions: {
|
||||
logicalname: string
|
||||
label: string | null
|
||||
capacity: number
|
||||
used: number | null
|
||||
}[],
|
||||
capacity: number
|
||||
'embassy-os': {
|
||||
version: string
|
||||
name: string
|
||||
} | null
|
||||
logicalname : string,
|
||||
vendor : string | null,
|
||||
model : string | null,
|
||||
partitions : PartitionInfo[],
|
||||
capacity : number,
|
||||
embassy_os : EmbassyOsDiskInfo | null,
|
||||
}[]
|
||||
|
||||
setup.recovery.status
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { iosTransitionAnimation, LoadingController, ModalController, NavController } from '@ionic/angular'
|
||||
import { ApiService, Drive } from 'src/app/services/api/api.service'
|
||||
import { ApiService, DiskInfo } from 'src/app/services/api/api.service'
|
||||
import { StateService } from 'src/app/services/state.service'
|
||||
import { PasswordPage } from '../password/password.page'
|
||||
|
||||
@@ -11,7 +11,7 @@ import { PasswordPage } from '../password/password.page'
|
||||
})
|
||||
export class EmbassyPage {
|
||||
embassyDrives = []
|
||||
selectedDrive: Drive = null
|
||||
selectedDrive: DiskInfo = null
|
||||
loading = true
|
||||
window = window
|
||||
|
||||
@@ -24,12 +24,12 @@ export class EmbassyPage {
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
const drives = (await this.apiService.getDrives()).filter(d => !d['embassy-os'])
|
||||
this.embassyDrives = (await this.apiService.getDrives()).filter(d => !d['embassy-os'])
|
||||
const drives = (await this.apiService.getDrives()).filter(d => !d['embassy_os'])
|
||||
this.embassyDrives = (await this.apiService.getDrives()).filter(d => !d['embassy_os'])
|
||||
this.loading = false
|
||||
}
|
||||
|
||||
async chooseDrive(drive: Drive) {
|
||||
async chooseDrive(drive: DiskInfo) {
|
||||
const modal = await this.modalController.create({
|
||||
component: PasswordPage,
|
||||
componentProps: {
|
||||
@@ -64,12 +64,12 @@ export class EmbassyPage {
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
getLabelLabel(drive: Drive) {
|
||||
getLabelLabel(drive: DiskInfo) {
|
||||
const labels = drive.partitions.map(p => p.label).filter(l => !!l)
|
||||
return labels.length ? labels.join(' / ') : 'unnamed'
|
||||
}
|
||||
|
||||
getUsage(drive: Drive) {
|
||||
getUsage(drive: DiskInfo) {
|
||||
let usage = 0
|
||||
drive.partitions.forEach(par => {
|
||||
if(par.used) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { LoadingController, ModalController } from '@ionic/angular'
|
||||
import { ApiService, Drive } from 'src/app/services/api/api.service'
|
||||
import { ApiService, DiskInfo } from 'src/app/services/api/api.service'
|
||||
import { StateService } from 'src/app/services/state.service'
|
||||
|
||||
@Component({
|
||||
@@ -9,8 +9,8 @@ import { StateService } from 'src/app/services/state.service'
|
||||
styleUrls: ['password.page.scss'],
|
||||
})
|
||||
export class PasswordPage {
|
||||
@Input() recoveryDrive: Drive
|
||||
@Input() embassyDrive: Drive
|
||||
@Input() recoveryDrive: DiskInfo
|
||||
@Input() embassyDrive: DiskInfo
|
||||
|
||||
pwError = ''
|
||||
password = ''
|
||||
@@ -84,12 +84,12 @@ export class PasswordPage {
|
||||
this.modalController.dismiss()
|
||||
}
|
||||
|
||||
getLabelLabel(drive: Drive) {
|
||||
getLabelLabel(drive: DiskInfo) {
|
||||
const labels = drive.partitions.map(p => p.label).filter(l => !!l)
|
||||
return labels.length ? labels.join(' / ') : 'unnamed'
|
||||
}
|
||||
|
||||
getUsage(drive: Drive) {
|
||||
getUsage(drive: DiskInfo) {
|
||||
let usage = 0
|
||||
drive.partitions.forEach(par => {
|
||||
if(par.used) {
|
||||
|
||||
@@ -44,17 +44,17 @@
|
||||
<ion-icon slot="start" name="save-outline"></ion-icon>
|
||||
<ion-label class="ion-text-wrap">
|
||||
<h1>{{ drive.logicalname }}</h1>
|
||||
<h2>{{ drive['embassy-os'].name }}</h2>
|
||||
<p> Embassy version: {{drive['embassy-os'].version}}</p>
|
||||
<h2>{{ drive.model }}</h2>
|
||||
<p> Embassy version: {{drive['embassy_os'].version}}</p>
|
||||
</ion-label>
|
||||
<ion-icon *ngIf="drive['embassy-os'].version.startsWith('0.2') || passwords[drive.logicalname]" color="success" slot="end" name="lock-open-outline"></ion-icon>
|
||||
<ion-icon *ngIf="!drive['embassy-os'].version.startsWith('0.2') && !passwords[drive.logicalname]" color="danger" slot="end" name="lock-closed-outline"></ion-icon>
|
||||
<ion-icon *ngIf="drive['embassy_os'].version.startsWith('0.2') || passwords[drive.logicalname]" color="success" slot="end" name="lock-open-outline"></ion-icon>
|
||||
<ion-icon *ngIf="!drive['embassy_os'].version.startsWith('0.2') && !passwords[drive.logicalname]" color="danger" slot="end" name="lock-closed-outline"></ion-icon>
|
||||
|
||||
</ion-item>
|
||||
</ng-container>
|
||||
<ion-button
|
||||
(click)="selectRecoveryDrive()"
|
||||
[disabled]="!selectedDrive || (!passwords[selectedDrive.logicalname] && !selectedDrive['embassy-os'].version.startsWith('0.2'))"
|
||||
[disabled]="!selectedDrive || (!passwords[selectedDrive.logicalname] && !selectedDrive['embassy_os'].version.startsWith('0.2'))"
|
||||
class="claim-button"
|
||||
>
|
||||
Next
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { iosTransitionAnimation, ModalController, NavController } from '@ionic/angular'
|
||||
import { ApiService, Drive } from 'src/app/services/api/api.service'
|
||||
import { ApiService, DiskInfo } from 'src/app/services/api/api.service'
|
||||
import { StateService } from 'src/app/services/state.service'
|
||||
import { PasswordPage } from '../password/password.page'
|
||||
|
||||
@@ -12,7 +12,7 @@ import { PasswordPage } from '../password/password.page'
|
||||
export class RecoverPage {
|
||||
passwords = {}
|
||||
recoveryDrives = []
|
||||
selectedDrive: Drive = null
|
||||
selectedDrive: DiskInfo = null
|
||||
loading = true
|
||||
window = window
|
||||
|
||||
@@ -24,11 +24,11 @@ export class RecoverPage {
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.recoveryDrives = (await this.apiService.getDrives()).filter(d => !!d['embassy-os'])
|
||||
this.recoveryDrives = (await this.apiService.getDrives()).filter(d => !!d['embassy_os'])
|
||||
this.loading = false
|
||||
}
|
||||
|
||||
async chooseDrive(drive: Drive) {
|
||||
async chooseDrive(drive: DiskInfo) {
|
||||
|
||||
if (this.selectedDrive?.logicalname === drive.logicalname) {
|
||||
this.selectedDrive = null
|
||||
@@ -37,7 +37,7 @@ export class RecoverPage {
|
||||
this.selectedDrive = drive
|
||||
}
|
||||
|
||||
if (drive['embassy-os'].version.startsWith('0.2') || this.passwords[drive.logicalname]) return
|
||||
if (drive['embassy_os'].version.startsWith('0.2') || this.passwords[drive.logicalname]) return
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: PasswordPage,
|
||||
|
||||
@@ -4,7 +4,7 @@ export abstract class ApiService {
|
||||
protected error$: Subject<string> = new Subject();
|
||||
watchError$ = this.error$.asObservable();
|
||||
abstract verifyProductKey (key: string): Promise<VerifyProductKeyRes>;
|
||||
abstract getDrives (): Promise<Drive[]>;
|
||||
abstract getDrives (): Promise<DiskInfo[]>;
|
||||
abstract getDataTransferProgress (): Promise<TransferProgressRes>;
|
||||
abstract verifyRecoveryPassword (logicalname: string, password: string): Promise<boolean>;
|
||||
abstract setupEmbassy (setupInfo: {
|
||||
@@ -29,17 +29,22 @@ export interface SetupEmbassyRes {
|
||||
"tor-address": string
|
||||
}
|
||||
|
||||
export interface Drive {
|
||||
logicalname: string
|
||||
partitions: {
|
||||
logicalname: string
|
||||
label: string | null
|
||||
capacity: number
|
||||
used: number | null
|
||||
}[],
|
||||
capacity: number
|
||||
'embassy-os': {
|
||||
version: string
|
||||
name: string
|
||||
} | null
|
||||
}[]
|
||||
export interface DiskInfo {
|
||||
logicalname: string,
|
||||
vendor: string | null,
|
||||
model: string | null,
|
||||
partitions: PartitionInfo[],
|
||||
capacity: number,
|
||||
embassy_os: EmbassyOsDiskInfo | null,
|
||||
}
|
||||
|
||||
interface PartitionInfo {
|
||||
logicalname: string,
|
||||
label: string | null,
|
||||
capacity: number,
|
||||
used: number | null,
|
||||
}
|
||||
|
||||
interface EmbassyOsDiskInfo {
|
||||
version: string,
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ApiService, Drive, SetupEmbassyRes, TransferProgressRes, VerifyProductKeyRes } from './api.service'
|
||||
import { ApiService, DiskInfo, SetupEmbassyRes, TransferProgressRes, VerifyProductKeyRes } from './api.service'
|
||||
import { HttpService } from './http.service'
|
||||
|
||||
@Injectable({
|
||||
@@ -26,7 +26,7 @@ export class LiveApiService extends ApiService {
|
||||
}
|
||||
|
||||
async getDrives() {
|
||||
return this.http.rpcRequest<Drive[]>({
|
||||
return this.http.rpcRequest<DiskInfo[]>({
|
||||
method: 'setup.disk.list',
|
||||
params: {}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { pauseFor } from '../state.service'
|
||||
import { ApiService } from './api.service'
|
||||
import { ApiService, DiskInfo } from './api.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -30,6 +30,8 @@ export class MockApiService extends ApiService {
|
||||
async getDrives() {
|
||||
return [
|
||||
{
|
||||
vendor: 'vendor',
|
||||
model: 'model',
|
||||
logicalname: 'Name1',
|
||||
partitions: [{
|
||||
logicalname: 'Name1',
|
||||
@@ -43,9 +45,11 @@ export class MockApiService extends ApiService {
|
||||
used: 200.1255312
|
||||
}],
|
||||
capacity: 150000,
|
||||
'embassy-os': null
|
||||
'embassy_os': null
|
||||
},
|
||||
{
|
||||
vendor: 'vendor',
|
||||
model: 'model',
|
||||
logicalname: 'Name2',
|
||||
partitions: [{
|
||||
logicalname: 'Name2',
|
||||
@@ -54,9 +58,11 @@ export class MockApiService extends ApiService {
|
||||
used: 0.00,
|
||||
}],
|
||||
capacity: 1600.01234,
|
||||
'embassy-os': null
|
||||
'embassy_os': null
|
||||
},
|
||||
{
|
||||
vendor: 'vendor',
|
||||
model: 'model',
|
||||
logicalname: 'Name3',
|
||||
partitions: [{
|
||||
logicalname: 'Name3',
|
||||
@@ -65,12 +71,13 @@ export class MockApiService extends ApiService {
|
||||
used: null
|
||||
}],
|
||||
capacity: 100000,
|
||||
'embassy-os': {
|
||||
'embassy_os': {
|
||||
version: '0.3.3',
|
||||
name: 'My Embassy'
|
||||
}
|
||||
},
|
||||
{
|
||||
vendor: 'vendor',
|
||||
model: 'model',
|
||||
logicalname: 'Name4',
|
||||
partitions: [{
|
||||
logicalname: 'Name4',
|
||||
@@ -79,9 +86,8 @@ export class MockApiService extends ApiService {
|
||||
used: null
|
||||
}],
|
||||
capacity: 10000,
|
||||
'embassy-os': {
|
||||
'embassy_os': {
|
||||
version: '0.2.7',
|
||||
name: 'My Embassy'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { ApiService, Drive } from './api/api.service'
|
||||
import { ApiService, DiskInfo } from './api/api.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -8,9 +8,9 @@ import { ApiService, Drive } from './api/api.service'
|
||||
export class StateService {
|
||||
polling = false
|
||||
|
||||
embassyDrive: Drive;
|
||||
embassyDrive: DiskInfo;
|
||||
embassyPassword: string
|
||||
recoveryDrive: Drive;
|
||||
recoveryDrive: DiskInfo;
|
||||
recoveryPassword: string
|
||||
dataTransferProgress: { bytesTransfered: number; totalBytes: number } | null;
|
||||
dataProgress = 0;
|
||||
|
||||
Reference in New Issue
Block a user