mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
drive return type update
This commit is contained in:
committed by
Aiden McClelland
parent
6b3570e150
commit
c21ebd2c5e
@@ -44,8 +44,8 @@
|
||||
<ion-icon slot="start" name="save-outline"></ion-icon>
|
||||
<ion-label class="ion-text-wrap">
|
||||
<h1>{{ drive.logicalname }}</h1>
|
||||
<h2 style="min-height: 19px;">{{ drive.labels.length ? drive.labels.join(' / ') : 'unnamed' }}</h2>
|
||||
<p> Using {{drive.used.toFixed(2)}} of {{drive.capacity.toFixed(2)}} GiB</p>
|
||||
<h2 style="min-height: 19px;">{{ getLabelLabel(drive) }}</h2>
|
||||
<p> Using {{ getUsage(drive) }} of {{drive.capacity.toFixed(2)}} GiB</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ng-container>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { iosTransitionAnimation, LoadingController, ModalController, NavController } from '@ionic/angular'
|
||||
import { ApiService, EmbassyDrive } from 'src/app/services/api/api.service'
|
||||
import { ApiService, Drive } 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: EmbassyDrive = null
|
||||
selectedDrive: Drive = null
|
||||
loading = true
|
||||
window = window
|
||||
|
||||
@@ -24,11 +24,12 @@ export class EmbassyPage {
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.embassyDrives = await this.apiService.getEmbassyDrives()
|
||||
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: EmbassyDrive) {
|
||||
async chooseDrive(drive: Drive) {
|
||||
const modal = await this.modalController.create({
|
||||
component: PasswordPage,
|
||||
componentProps: {
|
||||
@@ -62,4 +63,19 @@ export class EmbassyPage {
|
||||
})
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
getLabelLabel(drive: Drive) {
|
||||
const labels = drive.partitions.map(p => p.label).filter(l => !!l)
|
||||
return labels.length ? labels.join(' / ') : 'unnamed'
|
||||
}
|
||||
|
||||
getUsage(drive: Drive) {
|
||||
let usage = 0
|
||||
drive.partitions.forEach(par => {
|
||||
if(par.used) {
|
||||
usage += par.used
|
||||
}
|
||||
})
|
||||
return usage.toFixed(2)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user