ui: eject disks todo

This commit is contained in:
Aaron Greenspan
2021-01-22 15:18:16 -07:00
committed by Aiden McClelland
parent 8c79984e80
commit 5a4e980d31
23 changed files with 35 additions and 115 deletions

View File

@@ -65,6 +65,7 @@ export class LiveApiService extends ApiService {
return this.authRequest<ReqRes.GetExternalDisksRes>({ method: Method.GET, url: `/disks` })
}
// TODO: EJECT-DISKS
async ejectExternalDisk (logicalName: string): Promise<Unit> {
return this.authRequest({ method: Method.POST, url: `/disks/eject`, data: { logicalName } })
}

View File

@@ -22,13 +22,15 @@ export class StartupAlertsNotifier {
private readonly osUpdateService: OsUpdateService,
) { }
// So. This takes our three checks and filters down to those that should run.
// Then, the reduce fires, quickly iterating through yielding a promise (acc) to the next element
// This takes our three checks and filters down to those that should run.
// Then, the reduce fires, quickly iterating through yielding a promise (previousDisplay) to the next element
// Each promise fires more or less concurrently, so each c.check(server) is run concurrently
// Then, since we await acc before c.display(res), each promise executing gets hung awaiting the display of the previous run
// Then, since we await previoudDisplay before c.display(res), each promise executing gets hung awaiting the display of the previous run
async runChecks (server: Readonly<S9Server>): Promise<void> {
await this.checks
.filter(c => !c.hasRun && c.shouldRun(server))
// returning true in the below block means to continue to next modal
// returning false means to skip all subsequent modals
.reduce(async (previousDisplay, c) => {
let checkRes: any
try {

View File

@@ -1,12 +1,6 @@
import { Injectable } from '@angular/core'
import { ConfigService } from 'src/app/services/config.service'
import { ToastController, NavController, ModalController, AlertController } from '@ionic/angular'
import { ToastController, NavController } from '@ionic/angular'
import { ServerModel, S9Server } from '../models/server-model'
import { OSWelcomePage } from '../modals/os-welcome/os-welcome.page'
import { ApiService } from './api/api.service'
import { Emver } from './emver.service'
import { LoaderService } from './loader.service'
import { OsUpdateService } from './os-update.service'
@Injectable({
providedIn: 'root',
})
@@ -15,16 +9,9 @@ export class SyncNotifier {
checkedForUpdates = false
constructor (
private readonly config: ConfigService,
private readonly toastCtrl: ToastController,
private readonly modalCtrl: ModalController,
private readonly alertCtrl: AlertController,
private readonly navCtrl: NavController,
private readonly serverModel: ServerModel,
private readonly apiService: ApiService,
private readonly loader: LoaderService,
private readonly emver: Emver,
private readonly osUpdateService: OsUpdateService,
) { }
async handleSpecial (server: Readonly<S9Server>): Promise<void> {
@@ -67,41 +54,3 @@ export class SyncNotifier {
this.serverModel.update(updates)
}
}
// return new Promise(async resolve => {
// const confirm = await this.alertController.create({
// cssClass: 'alert-demo',
// header: 'Warning',
// message: `<h6>This is a <i>hosted</i> instance of Burn After Reading.</h6>
// <p>Since you are not the server operator, you can never be 100% certain that your data are private or secure.</p>
// <p>You can run your own, private instance with the click of a button using the Start9 Embassy.</p>`,
// buttons: [
// {
// text: 'Run my Own',
// handler: () => {
// const a = document.createElement('a')
// const site = (this.config.isConsulate || !this.config.isTor) ? 'https://start9labs.com' : 'http://privacy34kn4ez3y3nijweec6w4g54i3g54sdv7r5mr6soma3w4begyd.onion/'
// a.href = site
// a.target = '_blank'
// pauseFor(500).then(() => a.click())
// return resolve()
// },
// },
// {
// text: 'Use Demo',
// role: 'cancel',
// handler: () => resolve(),
// },
// ],
// })
// await confirm.present()
// const alert = document.getElementsByClassName('alert-demo').item(0)
// this.cleanup(
// fromEvent(alert, 'keyup')
// .pipe(filter((k: KeyboardEvent) => isEnter(k)))
// .subscribe(() => confirm.dismiss()),
// )
// })
// }