From 5a4e980d3139679a1a3e79ce122fceb751ab28c3 Mon Sep 17 00:00:00 2001 From: Aaron Greenspan Date: Fri, 22 Jan 2021 15:18:16 -0700 Subject: [PATCH] ui: eject disks todo --- ui/src/app/app.component.ts | 4 +- .../app-backup-confirmation.component.html | 1 + .../app-backup-confirmation.component.scss | 10 ---- .../app-backup-confirmation.component.ts | 2 +- .../install-wizard/prebaked-wizards.ts | 2 +- .../update-os-banner.component.html | 2 +- .../update-os-banner.component.scss | 2 +- .../app/modals/app-backup/app-backup.page.ts | 2 +- .../modals/os-welcome/os-welcome.page.html | 2 +- .../modals/os-welcome/os-welcome.page.scss | 2 +- .../app/modals/os-welcome/os-welcome.page.ts | 2 +- ui/src/app/models/app-model.ts | 2 +- ui/src/app/models/app-types.ts | 2 +- .../app-installed-list.page.scss | 2 +- .../app-installed-show.page.scss | 2 +- .../app-installed-ui.page.html | 26 --------- .../external-drives/external-drives.module.ts | 1 + .../external-drives/external-drives.page.html | 19 ++++--- .../external-drives/external-drives.page.ts | 1 + ui/src/app/services/api/live-api.service.ts | 1 + .../app/services/startup-alerts.notifier.ts | 8 +-- ui/src/app/services/sync.notifier.ts | 53 +------------------ ui/src/app/util/misc.util.ts | 2 +- 23 files changed, 35 insertions(+), 115 deletions(-) delete mode 100644 ui/src/app/pages/apps-routes/app-installed-ui/app-installed-ui.page.html diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index 331b06989..a8745bc80 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -76,7 +76,9 @@ export class AppComponent { this.init() } - ionViewDidEnter(){ + ionViewDidEnter () { + // weird bug where a browser grabbed the value 'getdots' from the app.component.html preload input field. + // this removes that field after prleloading occurs. pauseFor(500).then(() => this.untilLoaded = false) } diff --git a/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.html b/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.html index 4f37a975c..ff6fa0ee6 100644 --- a/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.html +++ b/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.html @@ -1,3 +1,4 @@ +
diff --git a/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.scss b/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.scss index c500626a7..e69de29bb 100644 --- a/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.scss +++ b/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.scss @@ -1,10 +0,0 @@ -.error-message { - --background: var(--ion-color-danger); - margin: 12px; - border-radius: 3px; - font-weight: bold; -} - -.legacy-error-message { - margin: 5px; -} \ No newline at end of file diff --git a/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.ts b/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.ts index b61a0c8b8..b73fa1fe7 100644 --- a/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.ts +++ b/ui/src/app/components/app-backup-confirmation/app-backup-confirmation.component.ts @@ -14,7 +14,7 @@ export class AppBackupConfirmationComponent implements OnInit { password: string $error$: BehaviorSubject = new BehaviorSubject('') - // pass this through the modalCtrl once ejecting disks is an option in the UI. + // TODO: EJECT-DISKS pass this through the modalCtrl once ejecting disks is an option in the UI. eject = true message: string diff --git a/ui/src/app/components/install-wizard/prebaked-wizards.ts b/ui/src/app/components/install-wizard/prebaked-wizards.ts index d003b2dbd..521df79d4 100644 --- a/ui/src/app/components/install-wizard/prebaked-wizards.ts +++ b/ui/src/app/components/install-wizard/prebaked-wizards.ts @@ -173,4 +173,4 @@ function validate (t: T, test: (t: T) => Boolean, desc: string) { } -const defaultUninstallationWarning = serviceName => `Uninstalling ${ serviceName } will result in the deletion of its data.` \ No newline at end of file +const defaultUninstallationWarning = serviceName => `Uninstalling ${ serviceName } will result in the deletion of its data.` diff --git a/ui/src/app/components/update-os-banner/update-os-banner.component.html b/ui/src/app/components/update-os-banner/update-os-banner.component.html index 53124a1de..e48adb668 100644 --- a/ui/src/app/components/update-os-banner/update-os-banner.component.html +++ b/ui/src/app/components/update-os-banner/update-os-banner.component.html @@ -2,4 +2,4 @@ New EmbassyOS Version {{version | displayEmver}} Available! - \ No newline at end of file + diff --git a/ui/src/app/components/update-os-banner/update-os-banner.component.scss b/ui/src/app/components/update-os-banner/update-os-banner.component.scss index 43db077a7..5b6b18d63 100644 --- a/ui/src/app/components/update-os-banner/update-os-banner.component.scss +++ b/ui/src/app/components/update-os-banner/update-os-banner.component.scss @@ -8,4 +8,4 @@ ion-item { text-align: center; font-weight: bold; } -} \ No newline at end of file +} diff --git a/ui/src/app/modals/app-backup/app-backup.page.ts b/ui/src/app/modals/app-backup/app-backup.page.ts index 528e0dbc5..1742edc3d 100644 --- a/ui/src/app/modals/app-backup/app-backup.page.ts +++ b/ui/src/app/modals/app-backup/app-backup.page.ts @@ -100,7 +100,7 @@ export class AppBackupPage { m.onWillDismiss().then(res => { const data = res.data if (data.cancel) return - // we hard code the 'eject' last argument to be false, until ejection is an option in the UI. + // TODO: EJECT-DISKS we hard code the 'eject' last argument to be false, until ejection is an option in the UI. When it is, add it to the data object above ^ return this.create(disk, partition, data.password, false) }) diff --git a/ui/src/app/modals/os-welcome/os-welcome.page.html b/ui/src/app/modals/os-welcome/os-welcome.page.html index d867f76f2..407dfaba5 100644 --- a/ui/src/app/modals/os-welcome/os-welcome.page.html +++ b/ui/src/app/modals/os-welcome/os-welcome.page.html @@ -39,4 +39,4 @@
-
\ No newline at end of file + diff --git a/ui/src/app/modals/os-welcome/os-welcome.page.scss b/ui/src/app/modals/os-welcome/os-welcome.page.scss index e1b29d3fe..a618a1ad1 100644 --- a/ui/src/app/modals/os-welcome/os-welcome.page.scss +++ b/ui/src/app/modals/os-welcome/os-welcome.page.scss @@ -5,4 +5,4 @@ align-items: center; height: 100%; min-height: 100px; -} \ No newline at end of file +} diff --git a/ui/src/app/modals/os-welcome/os-welcome.page.ts b/ui/src/app/modals/os-welcome/os-welcome.page.ts index 975cf9523..0cb5cf69e 100644 --- a/ui/src/app/modals/os-welcome/os-welcome.page.ts +++ b/ui/src/app/modals/os-welcome/os-welcome.page.ts @@ -28,7 +28,7 @@ export class OSWelcomePage { .then(() => this.apiService.acknowledgeOSWelcome(this.config.version)) .catch(console.error) - // return false to skip subsequent alert modals + // return false to skip subsequent alert modals (e.g. check for updates modals) // return true to show subsequent alert modals return this.modalCtrl.dismiss(this.autoCheckUpdates) } diff --git a/ui/src/app/models/app-model.ts b/ui/src/app/models/app-model.ts index 4f255ccff..e17402bbc 100644 --- a/ui/src/app/models/app-model.ts +++ b/ui/src/app/models/app-model.ts @@ -61,7 +61,7 @@ export class AppModel extends MapSubject { ) } - // when an app is backing up + // TODO: EJECT-DISKS: we can use this to watch for an app completing its backup process. watchForBackup (appId: string): Observable { const toWatch = super.watch(appId) if (!toWatch) return of(undefined) diff --git a/ui/src/app/models/app-types.ts b/ui/src/app/models/app-types.ts index d8c2818f1..0c09065e6 100644 --- a/ui/src/app/models/app-types.ts +++ b/ui/src/app/models/app-types.ts @@ -14,7 +14,7 @@ export interface BaseApp { export interface AppAvailablePreview extends BaseApp { versionLatest: string descriptionShort: string - latestVersionTimestamp: Date + latestVersionTimestamp: Date //used for sorting AAL } export type AppAvailableFull = diff --git a/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.scss b/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.scss index 52f85a573..9721ccccc 100644 --- a/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.scss +++ b/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.scss @@ -88,4 +88,4 @@ right: 0px; top: 0px; margin: 0px; -} \ No newline at end of file +} diff --git a/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.scss b/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.scss index 0a5c0d9df..8c1e254ae 100644 --- a/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.scss +++ b/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.scss @@ -58,4 +58,4 @@ z-index: 1; right: -2px; --border-radius: 100px; -} \ No newline at end of file +} diff --git a/ui/src/app/pages/apps-routes/app-installed-ui/app-installed-ui.page.html b/ui/src/app/pages/apps-routes/app-installed-ui/app-installed-ui.page.html deleted file mode 100644 index 63629a446..000000000 --- a/ui/src/app/pages/apps-routes/app-installed-ui/app-installed-ui.page.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - {{$app$.title | async}} - - - - - - - - - - - - -
- {{$app$.title | async}} is not running. - View -
-
diff --git a/ui/src/app/pages/server-routes/external-drives/external-drives.module.ts b/ui/src/app/pages/server-routes/external-drives/external-drives.module.ts index 066b57a3a..759d88481 100644 --- a/ui/src/app/pages/server-routes/external-drives/external-drives.module.ts +++ b/ui/src/app/pages/server-routes/external-drives/external-drives.module.ts @@ -7,6 +7,7 @@ import { SharingModule } from 'src/app/modules/sharing.module' import { PwaBackComponentModule } from 'src/app/components/pwa-back-button/pwa-back.component.module' import { BadgeMenuComponentModule } from 'src/app/components/badge-menu-button/badge-menu.component.module' import { ObjectConfigComponentModule } from 'src/app/components/object-config/object-config.component.module' +// TODO: EJECT-DISKS const routes: Routes = [ { diff --git a/ui/src/app/pages/server-routes/external-drives/external-drives.page.html b/ui/src/app/pages/server-routes/external-drives/external-drives.page.html index 130067f79..ada072f1a 100644 --- a/ui/src/app/pages/server-routes/external-drives/external-drives.page.html +++ b/ui/src/app/pages/server-routes/external-drives/external-drives.page.html @@ -1,3 +1,4 @@ + @@ -16,16 +17,14 @@ - - - - {{d.logicalname}} ({{ d.size }}) - - - - - - + + + {{d.logicalname}} ({{ d.size }}) + + + + + diff --git a/ui/src/app/pages/server-routes/external-drives/external-drives.page.ts b/ui/src/app/pages/server-routes/external-drives/external-drives.page.ts index 1cbbcbfcb..d21611f9a 100644 --- a/ui/src/app/pages/server-routes/external-drives/external-drives.page.ts +++ b/ui/src/app/pages/server-routes/external-drives/external-drives.page.ts @@ -5,6 +5,7 @@ import { DiskInfo } from 'src/app/models/server-model' import { markAsLoadingDuringP } from 'src/app/services/loader.service' import { BehaviorSubject } from 'rxjs' import { AlertController } from '@ionic/angular' +// TODO: EJECT-DISKS type Ejectable = T & { $ejecting$: BehaviorSubject } diff --git a/ui/src/app/services/api/live-api.service.ts b/ui/src/app/services/api/live-api.service.ts index 2be7b7a7d..85886cdf7 100644 --- a/ui/src/app/services/api/live-api.service.ts +++ b/ui/src/app/services/api/live-api.service.ts @@ -65,6 +65,7 @@ export class LiveApiService extends ApiService { return this.authRequest({ method: Method.GET, url: `/disks` }) } + // TODO: EJECT-DISKS async ejectExternalDisk (logicalName: string): Promise { return this.authRequest({ method: Method.POST, url: `/disks/eject`, data: { logicalName } }) } diff --git a/ui/src/app/services/startup-alerts.notifier.ts b/ui/src/app/services/startup-alerts.notifier.ts index f8aee52fc..959d37219 100644 --- a/ui/src/app/services/startup-alerts.notifier.ts +++ b/ui/src/app/services/startup-alerts.notifier.ts @@ -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): Promise { 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 { diff --git a/ui/src/app/services/sync.notifier.ts b/ui/src/app/services/sync.notifier.ts index 3628f8533..efc9ff9c9 100644 --- a/ui/src/app/services/sync.notifier.ts +++ b/ui/src/app/services/sync.notifier.ts @@ -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): Promise { @@ -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: `
This is a hosted instance of Burn After Reading.
-//

Since you are not the server operator, you can never be 100% certain that your data are private or secure.

-//

You can run your own, private instance with the click of a button using the Start9 Embassy.

`, -// 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()), -// ) -// }) -// } \ No newline at end of file diff --git a/ui/src/app/util/misc.util.ts b/ui/src/app/util/misc.util.ts index c268bed1a..25f291bea 100644 --- a/ui/src/app/util/misc.util.ts +++ b/ui/src/app/util/misc.util.ts @@ -160,4 +160,4 @@ export function capitalizeFirstLetter (string: string): string { return string.charAt(0).toUpperCase() + string.slice(1) } -export const exists = t => !!t \ No newline at end of file +export const exists = t => !!t