From 37a6df0815e50e425c728965c45138f35c9ed853 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Tue, 24 Aug 2021 16:55:53 -0600 Subject: [PATCH] react to enter key for alerts and modals. Styling and logic --- ui/src/app/app.component.html | 2 +- ui/src/app/app.component.ts | 95 +++++++++++-------- .../form-object/form-object.component.html | 19 ++-- .../form-object/form-object.component.ts | 21 +--- .../install-wizard.component.html | 4 +- .../modals/app-config/app-config.page.html | 34 +++---- .../app/modals/app-config/app-config.page.ts | 1 + .../app/modals/enum-list/enum-list.page.html | 14 +-- .../generic-form/generic-form.page.html | 12 +-- .../modals/os-welcome/os-welcome.page.scss | 2 +- .../app-actions/app-actions.page.ts | 11 ++- .../app-properties/app-properties.page.html | 2 +- .../apps-routes/app-show/app-show.page.ts | 2 +- .../marketplace-show.page.html | 26 ----- .../marketplace-show/marketplace-show.page.ts | 2 +- .../security-routes/sessions/sessions.page.ts | 2 +- .../ssh-keys/ssh-keys.page.html | 2 +- .../security-routes/ssh-keys/ssh-keys.page.ts | 84 ++++++++++++---- .../security-routes/ssh-keys/ssh.service.ts | 22 ----- .../server-show/server-show.page.ts | 8 +- .../app/pages/server-routes/wifi/wifi.page.ts | 12 ++- ui/src/app/services/connection.service.ts | 1 - ui/src/app/services/server-config.service.ts | 40 +------- ui/src/app/services/startup-alerts.service.ts | 6 +- 24 files changed, 195 insertions(+), 229 deletions(-) diff --git a/ui/src/app/app.component.html b/ui/src/app/app.component.html index a050da391..d4dbf946a 100644 --- a/ui/src/app/app.component.html +++ b/ui/src/app/app.component.html @@ -101,7 +101,7 @@ - + diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index 623efd67e..fda917e36 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core' +import { Component, HostListener } from '@angular/core' import { Storage } from '@ionic/storage-angular' import { AuthService, AuthState } from './services/auth.service' import { ApiService } from './services/api/embassy-api.service' @@ -24,6 +24,15 @@ import { Subscription } from 'rxjs' styleUrls: ['app.component.scss'], }) export class AppComponent { + @HostListener('document:keypress', ['$event']) + handleKeyboardEvent (event: KeyboardEvent) { + if (event.key === 'Enter') { + const elems = document.getElementsByClassName('enter-click') + const elem = elems[elems.length - 1] as HTMLButtonElement + if (elem) elem.click() + } + } + ServerStatus = ServerStatus showMenu = false selectedIndex = 0 @@ -143,6 +152,47 @@ export class AppComponent { window.open(url, '_blank') } + async presentAlertLogout () { + // @TODO warn user no way to recover Embassy if logout and forget password. Maybe require password to logout? + const alert = await this.alertCtrl.create({ + header: 'Caution', + message: 'Are you sure you want to logout?', + buttons: [ + { + text: 'Cancel', + role: 'cancel', + }, + { + text: 'Logout', + cssClass: 'enter-click', + handler: () => { + this.logout() + }, + }, + ], + }) + + await alert.present() + } + + private async logout () { + const loader = await this.loadingCtrl.create({ + spinner: 'lines', + message: 'Logging out...', + cssClass: 'loader', + }) + await loader.present() + + try { + await this.embassyApi.logout({ }) + this.authService.setUnverified() + } catch (e) { + await this.errToast.present(e) + } finally { + loader.dismiss() + } + } + private watchConnection (): Subscription { return this.connectionService.watchFailure$() .pipe( @@ -234,7 +284,7 @@ export class AppComponent { }) } - async presentAlertRefreshNeeded () { + private async presentAlertRefreshNeeded () { const alert = await this.alertCtrl.create({ backdropDismiss: false, header: 'Refresh Needed', @@ -242,6 +292,7 @@ export class AppComponent { buttons: [ { text: 'Refresh Page', + cssClass: 'enter-click', handler: () => { location.reload() }, @@ -251,46 +302,6 @@ export class AppComponent { await alert.present() } - async presentAlertLogout () { - // @TODO warn user no way to recover Embassy if logout and forget password. Maybe require password to logout? - const alert = await this.alertCtrl.create({ - backdropDismiss: false, - header: 'Caution', - message: 'Are you sure you want to logout?', - buttons: [ - { - text: 'Cancel', - role: 'cancel', - }, - { - text: 'Logout', - handler: () => { - this.logout() - }, - }, - ], - }) - await alert.present() - } - - private async logout () { - const loader = await this.loadingCtrl.create({ - spinner: 'lines', - message: 'Logging out...', - cssClass: 'loader', - }) - await loader.present() - - try { - await this.embassyApi.logout({ }) - this.authService.setUnverified() - } catch (e) { - await this.errToast.present(e) - } finally { - loader.dismiss() - } - } - private async presentToastNotifications () { const toast = await this.toastCtrl.create({ header: 'Embassy', diff --git a/ui/src/app/components/form-object/form-object.component.html b/ui/src/app/components/form-object/form-object.component.html index 8c40999d7..de772b0e5 100644 --- a/ui/src/app/components/form-object/form-object.component.html +++ b/ui/src/app/components/form-object/form-object.component.html @@ -1,15 +1,16 @@
+ -

{{ unionSpec.tag.name }}

- - {{ unionSpec.tag.name }} - - - {{ unionSpec.tag['variant-names'][option] }} - - - +

{{ unionSpec.tag.name }}

+ + {{ unionSpec.tag.name }} + + + {{ unionSpec.tag['variant-names'][option] }} + + +
diff --git a/ui/src/app/components/form-object/form-object.component.ts b/ui/src/app/components/form-object/form-object.component.ts index 2f219bb3f..0d4e233dd 100644 --- a/ui/src/app/components/form-object/form-object.component.ts +++ b/ui/src/app/components/form-object/form-object.component.ts @@ -1,7 +1,7 @@ import { Component, Input, Output, SimpleChange, EventEmitter } from '@angular/core' import { AbstractFormGroupDirective, FormArray, FormGroup } from '@angular/forms' -import { AlertController, IonicSafeString, ModalController } from '@ionic/angular' -import { ConfigSpec, ListValueSpecOf, ValueSpec, ValueSpecBoolean, ValueSpecList, ValueSpecListOf, ValueSpecNumber, ValueSpecString, ValueSpecUnion } from 'src/app/pkg-config/config-types' +import { AlertButton, AlertController, IonicSafeString, ModalController } from '@ionic/angular' +import { ConfigSpec, ListValueSpecOf, ValueSpec, ValueSpecBoolean, ValueSpecList, ValueSpecListOf, ValueSpecUnion } from 'src/app/pkg-config/config-types' import { FormService } from 'src/app/services/form.service' import { Range } from 'src/app/pkg-config/config-utilities' import { EnumListPage } from 'src/app/modals/enum-list/enum-list.page' @@ -34,17 +34,6 @@ export class FormObjectComponent { ) { } ngOnChanges (changes: { [propName: string]: SimpleChange }) { - // @TODO figure out why changes are being triggered so often. If too heavy, switch to ngOnInit and figure out another way to manually reset defaults is executed. Needed because otherwise ObjectListInfo won't be accurate. - - // if ( changes['current'] && changes['current'].previousValue != changes['current'].currentValue ) { - // console.log('CURRENT') - // } - // if ( changes['formGroup'] && changes['formGroup'].previousValue != changes['formGroup'].currentValue ) { - // console.log('FORM GROUP') - // } - // if ( changes['objectSpec'] && changes['objectSpec'].previousValue != changes['objectSpec'].currentValue ) { - // console.log('OBJECT SPEC') - // } // Lists are automatically expanded, but their members are not Object.keys(this.objectSpec).forEach(key => { const spec = this.objectSpec[key] @@ -157,12 +146,13 @@ export class FormObjectComponent { if (!spec.warning || this.warningAck[key]) return okFn ? okFn() : null this.warningAck[key] = true - const buttons = [ + const buttons: AlertButton[] = [ { text: 'Ok', handler: () => { if (okFn) okFn() }, + cssClass: 'enter-click', }, ] @@ -186,7 +176,6 @@ export class FormObjectComponent { async presentAlertDelete (key: string, index: number) { const alert = await this.alertCtrl.create({ - backdropDismiss: false, header: 'Confirm', message: 'Are you sure you want to delete this entry?', buttons: [ @@ -199,6 +188,7 @@ export class FormObjectComponent { handler: () => { this.deleteListItem(key, index) }, + cssClass: 'enter-click', }, ], }) @@ -260,7 +250,6 @@ export class FormLabelComponent { const alert = await this.alertCtrl.create({ header: name, message: description, - buttons: ['Ok'], }) await alert.present() } diff --git a/ui/src/app/components/install-wizard/install-wizard.component.html b/ui/src/app/components/install-wizard/install-wizard.component.html index 579e56689..4ab09245b 100644 --- a/ui/src/app/components/install-wizard/install-wizard.component.html +++ b/ui/src/app/components/install-wizard/install-wizard.component.html @@ -49,12 +49,12 @@ - + {{ next }} - + {{ finish }} diff --git a/ui/src/app/modals/app-config/app-config.page.html b/ui/src/app/modals/app-config/app-config.page.html index 723d9341d..3910133aa 100644 --- a/ui/src/app/modals/app-config/app-config.page.html +++ b/ui/src/app/modals/app-config/app-config.page.html @@ -1,9 +1,14 @@ - - + + + + + + + Config - + Reset Defaults @@ -19,17 +24,11 @@ - - - -

- - Initial Config -

-

To use the default config for {{ pkg.manifest.title }}, click "Save" above.

-
-
-
+ + + To use the default config for {{ pkg.manifest.title }}, click "Save" below. + + @@ -81,13 +80,8 @@ - - - Cancel - - - + Save diff --git a/ui/src/app/modals/app-config/app-config.page.ts b/ui/src/app/modals/app-config/app-config.page.ts index 9542cb3af..2f64c9e0f 100644 --- a/ui/src/app/modals/app-config/app-config.page.ts +++ b/ui/src/app/modals/app-config/app-config.page.ts @@ -172,6 +172,7 @@ export class AppConfigPage { handler: () => { this.modalCtrl.dismiss() }, + cssClass: 'enter-click', }, ], }) diff --git a/ui/src/app/modals/enum-list/enum-list.page.html b/ui/src/app/modals/enum-list/enum-list.page.html index 78b7e4719..660562bf1 100644 --- a/ui/src/app/modals/enum-list/enum-list.page.html +++ b/ui/src/app/modals/enum-list/enum-list.page.html @@ -1,10 +1,15 @@ + + + + + {{ spec.name }} - + {{ selectAll ? 'All' : 'None' }} @@ -22,13 +27,8 @@ - - - Cancel - - - + Done diff --git a/ui/src/app/modals/generic-form/generic-form.page.html b/ui/src/app/modals/generic-form/generic-form.page.html index c58450265..6acf39778 100644 --- a/ui/src/app/modals/generic-form/generic-form.page.html +++ b/ui/src/app/modals/generic-form/generic-form.page.html @@ -1,5 +1,10 @@ + + + + + {{ title }} @@ -15,13 +20,8 @@ - - - Cancel - - - + {{ button.text }} 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 d48aace7d..ecd4c542a 100644 --- a/ui/src/app/modals/os-welcome/os-welcome.page.scss +++ b/ui/src/app/modals/os-welcome/os-welcome.page.scss @@ -8,5 +8,5 @@ .main-content { height: 100%; - color: var(--ion-color-medium); + color: var(--ion-color-dark); } \ No newline at end of file diff --git a/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts b/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts index 50522eab6..e05637b12 100644 --- a/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts +++ b/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts @@ -80,6 +80,7 @@ export class AppActionsPage { handler: () => { this.executeAction(pkg.manifest.id, action.key) }, + cssClass: 'enter-click', }, ], }) @@ -104,7 +105,7 @@ export class AppActionsPage { header: 'Forbidden', message: error || `Action "${action.value.name}" can only be executed when service is ${statusesStr}`, buttons: ['OK'], - cssClass: 'alert-error-message', + cssClass: 'alert-error-message enter-click', }) await alert.present() } @@ -159,7 +160,13 @@ export class AppActionsPage { const successAlert = await this.alertCtrl.create({ header: 'Execution Complete', message: res.message.split('\n').join('

'), - buttons: ['OK'], + buttons: [ + { + text: 'Ok', + role: 'cancel', + cssClass: 'enter-click', + }, + ], }) setTimeout(() => successAlert.present(), 400) diff --git a/ui/src/app/pages/apps-routes/app-properties/app-properties.page.html b/ui/src/app/pages/apps-routes/app-properties/app-properties.page.html index 94ea0eb52..7ddd542de 100644 --- a/ui/src/app/pages/apps-routes/app-properties/app-properties.page.html +++ b/ui/src/app/pages/apps-routes/app-properties/app-properties.page.html @@ -6,7 +6,7 @@ Properties - + Refresh diff --git a/ui/src/app/pages/apps-routes/app-show/app-show.page.ts b/ui/src/app/pages/apps-routes/app-show/app-show.page.ts index 1bff44580..ea48f7085 100644 --- a/ui/src/app/pages/apps-routes/app-show/app-show.page.ts +++ b/ui/src/app/pages/apps-routes/app-show/app-show.page.ts @@ -130,7 +130,6 @@ export class AppShowPage { const alert = await this.alertCtrl.create({ header: 'Not Accepting Donations', message: `The developers of ${this.pkg.manifest.title} have not provided a donation URL. Please contact them directly if you insist on giving them money.`, - buttons: ['OK'], }) await alert.present() } @@ -215,6 +214,7 @@ export class AppShowPage { handler: () => { this.start() }, + cssClass: 'enter-click', }, ], }) diff --git a/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.html b/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.html index 2a7e8486a..7b82dca66 100644 --- a/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.html +++ b/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.html @@ -140,18 +140,6 @@ - - -

Service ID

-

{{ pkg.manifest.id }}

-
-
- - -

Categories

-

{{ pkg.categories.join(', ') }}

-
-

Other Versions

@@ -198,20 +186,6 @@
- - -

Marketing Site

-

{{ pkg.manifest['marketing-site'] }}

-
- -
- - -

Donation Site

-

{{ donationUrl }}

-
- -
diff --git a/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts b/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts index 53460f01c..0b25f2155 100644 --- a/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts +++ b/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts @@ -81,7 +81,6 @@ export class MarketplaceShowPage { async presentAlertVersions () { const alert = await this.alertCtrl.create({ header: 'Versions', - backdropDismiss: false, inputs: this.marketplaceService.pkgs[this.pkgId].versions.sort((a, b) => -1 * this.emver.compare(a, b)).map(v => { return { name: v, // for CSS @@ -100,6 +99,7 @@ export class MarketplaceShowPage { handler: (version: string) => { this.getPkg(version) }, + cssClass: 'enter-click', }, ], }) diff --git a/ui/src/app/pages/server-routes/security-routes/sessions/sessions.page.ts b/ui/src/app/pages/server-routes/security-routes/sessions/sessions.page.ts index 989c38168..f3af1ed6e 100644 --- a/ui/src/app/pages/server-routes/security-routes/sessions/sessions.page.ts +++ b/ui/src/app/pages/server-routes/security-routes/sessions/sessions.page.ts @@ -32,7 +32,6 @@ export class SessionsPage { async presentAlertKill (id: string) { const alert = await this.alertCtrl.create({ - backdropDismiss: false, header: 'Caution', message: `Are you sure you want to kill this session?`, buttons: [ @@ -45,6 +44,7 @@ export class SessionsPage { handler: () => { this.kill(id) }, + cssClass: 'enter-click', }, ], }) diff --git a/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh-keys.page.html b/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh-keys.page.html index c64725f8c..d14f1ca69 100644 --- a/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh-keys.page.html +++ b/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh-keys.page.html @@ -22,7 +22,7 @@ Saved Keys - + Add new key diff --git a/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh-keys.page.ts b/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh-keys.page.ts index 9eca53c36..c594ab766 100644 --- a/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh-keys.page.ts +++ b/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh-keys.page.ts @@ -1,10 +1,9 @@ import { Component } from '@angular/core' -import { ServerConfigService } from 'src/app/services/server-config.service' -import { AlertController, LoadingController } from '@ionic/angular' -import { SSHService } from './ssh.service' -import { Subscription } from 'rxjs' +import { AlertController, LoadingController, ModalController } from '@ionic/angular' import { SSHKeys } from 'src/app/services/api/api.types' import { ErrorToastService } from 'src/app/services/error-toast.service' +import { ApiService } from 'src/app/services/api/embassy-api.service' +import { BackupConfirmationComponent } from 'src/app/modals/backup-confirmation/backup-confirmation.component' @Component({ selector: 'ssh-keys', @@ -14,37 +13,66 @@ import { ErrorToastService } from 'src/app/services/error-toast.service' export class SSHKeysPage { loading = true sshKeys: SSHKeys - subs: Subscription[] = [] readonly docsUrl = 'https://docs.start9.com/user-manual/general/developer-options/ssh-setup.html' constructor ( private readonly loadingCtrl: LoadingController, + private readonly modalCtrl: ModalController, private readonly errToast: ErrorToastService, private readonly alertCtrl: AlertController, - private readonly sshService: SSHService, - public readonly serverConfig: ServerConfigService, + private readonly embassyApi: ApiService, ) { } async ngOnInit () { - this.subs = [ - this.sshService.watch$() - .subscribe(keys => { - this.sshKeys = keys - }), - ] - - await this.sshService.getKeys() - - this.loading = false + await this.getKeys() } - ngOnDestroy () { - this.subs.forEach(sub => sub.unsubscribe()) + async getKeys (): Promise { + try { + this.sshKeys = await this.embassyApi.getSshKeys({ }) + } catch (e) { + this.errToast.present(e) + } finally { + this.loading = false + } + } + + async presentModalAdd () { + const { name, description } = sshSpec + + const modal = await this.modalCtrl.create({ + component: BackupConfirmationComponent, + componentProps: { + title: name, + message: description, + label: name, + submitFn: this.add, + }, + cssClass: 'alertlike-modal', + }) + await modal.present() + } + + async add (pubkey: string): Promise { + const loader = await this.loadingCtrl.create({ + spinner: 'lines', + message: 'Saving...', + cssClass: 'loader', + }) + await loader.present() + + try { + const key = await this.embassyApi.addSshKey({ pubkey }) + this.sshKeys = { ...this.sshKeys, ...key } + } catch (e) { + this.errToast.present(e) + } finally { + loader.dismiss() + } } async presentAlertDelete (hash: string) { const alert = await this.alertCtrl.create({ - backdropDismiss: false, header: 'Caution', message: `Are you sure you want to delete this key?`, buttons: [ @@ -57,6 +85,7 @@ export class SSHKeysPage { handler: () => { this.delete(hash) }, + cssClass: 'enter-click', }, ], }) @@ -72,7 +101,8 @@ export class SSHKeysPage { await loader.present() try { - await this.sshService.delete(hash) + await this.embassyApi.deleteSshKey({ hash }) + delete this.sshKeys[hash] } catch (e) { this.errToast.present(e) } finally { @@ -84,3 +114,15 @@ export class SSHKeysPage { return 0 } } + +const sshSpec = { + type: 'string', + name: 'SSH Key', + description: 'Enter the SSH public key of you would like to authorize for root access to your Embassy.', + nullable: false, + // @TODO regex for SSH Key + // pattern: '', + 'pattern-description': 'Must be a valid SSH key', + masked: false, + copyable: false, +} diff --git a/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh.service.ts b/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh.service.ts index 97df127b5..1b72a375b 100644 --- a/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh.service.ts +++ b/ui/src/app/pages/server-routes/security-routes/ssh-keys/ssh.service.ts @@ -17,27 +17,5 @@ export class SSHService { return this.keys$.asObservable() } - async getKeys (): Promise { - const keys = await this.embassyApi.getSshKeys({ }) - this.keys$.next(keys) - } - async add (pubkey: string): Promise { - const key = await this.embassyApi.addSshKey({ pubkey }) - const keys = this.keys$.getValue() - this.keys$.next({ ...keys, ...key }) - } - - async delete (hash: string): Promise { - await this.embassyApi.deleteSshKey({ hash }) - const keys = this.keys$.getValue() - - const filtered = Object.keys(keys) - .filter(h => h !== hash) - .reduce((res, h) => { - res[h] = keys[h] - return res - }, { }) - this.keys$.next(filtered) - } } diff --git a/ui/src/app/pages/server-routes/server-show/server-show.page.ts b/ui/src/app/pages/server-routes/server-show/server-show.page.ts index dcc12ee77..bf330d436 100644 --- a/ui/src/app/pages/server-routes/server-show/server-show.page.ts +++ b/ui/src/app/pages/server-routes/server-show/server-show.page.ts @@ -27,7 +27,6 @@ export class ServerShowPage { async presentAlertRestart () { const alert = await this.alertCtrl.create({ - backdropDismiss: false, header: 'Confirm', message: `Are you sure you want to restart your Embassy?`, buttons: [ @@ -40,15 +39,15 @@ export class ServerShowPage { handler: () => { this.restart() }, + cssClass: 'enter-click', }, - ]}, - ) + ], + }) await alert.present() } async presentAlertShutdown () { const alert = await this.alertCtrl.create({ - backdropDismiss: false, header: 'Confirm', message: `Are you sure you want to shut down your Embassy? To turn it back on, you will need to physically unplug the device and plug it back in.`, buttons: [ @@ -61,6 +60,7 @@ export class ServerShowPage { handler: () => { this.shutdown() }, + cssClass: 'enter-click', }, ], }) diff --git a/ui/src/app/pages/server-routes/wifi/wifi.page.ts b/ui/src/app/pages/server-routes/wifi/wifi.page.ts index 893bccd52..a6f790ac7 100644 --- a/ui/src/app/pages/server-routes/wifi/wifi.page.ts +++ b/ui/src/app/pages/server-routes/wifi/wifi.page.ts @@ -33,7 +33,7 @@ export class WifiPage { try { await this.getWifi() } catch (e) { - this.errToast.present(e.message) + this.errToast.present(e) } finally { this.loading = false } @@ -72,7 +72,7 @@ export class WifiPage { }, }, ], - cssClass: 'wide-alert', + cssClass: 'wide-alert enter-click', }) await alert.present() } @@ -206,7 +206,13 @@ export class WifiPage { const alert = await this.alertCtrl.create({ header: `Connected to "${ssid}"`, message: 'Note. It may take several minutes to an hour for your Embassy to reconnect over Tor.', - buttons: ['OK'], + buttons: [ + { + text: 'Ok', + role: 'cancel', + cssClass: 'enter-click', + }, + ], }) await alert.present() diff --git a/ui/src/app/services/connection.service.ts b/ui/src/app/services/connection.service.ts index 27a526627..ad041f9b1 100644 --- a/ui/src/app/services/connection.service.ts +++ b/ui/src/app/services/connection.service.ts @@ -4,7 +4,6 @@ import { PatchConnection, PatchDbService } from './patch-db/patch-db.service' import { HttpService, Method } from './http.service' import { distinctUntilChanged } from 'rxjs/operators' import { ConfigService } from './config.service' -import { pauseFor } from '../util/misc.util' @Injectable({ providedIn: 'root', diff --git a/ui/src/app/services/server-config.service.ts b/ui/src/app/services/server-config.service.ts index 0e6c4305b..5cab48cb3 100644 --- a/ui/src/app/services/server-config.service.ts +++ b/ui/src/app/services/server-config.service.ts @@ -1,12 +1,9 @@ import { Injectable } from '@angular/core' import { AlertInput, AlertButton } from '@ionic/core' import { ApiService } from './api/embassy-api.service' -import { ConfigSpec, ValueSpecString } from '../pkg-config/config-types' -import { SSHService } from '../pages/server-routes/security-routes/ssh-keys/ssh.service' +import { ConfigSpec } from '../pkg-config/config-types' import { AlertController, LoadingController } from '@ionic/angular' import { ErrorToastService } from './error-toast.service' -import { ModalController } from '@ionic/angular' -import { BackupConfirmationComponent } from '../modals/backup-confirmation/backup-confirmation.component' @Injectable({ providedIn: 'root', @@ -14,12 +11,10 @@ import { BackupConfirmationComponent } from '../modals/backup-confirmation/backu export class ServerConfigService { constructor ( - private readonly modalCtrl: ModalController, private readonly loadingCtrl: LoadingController, private readonly errToast: ErrorToastService, private readonly alertCtrl: AlertController, private readonly embassyApi: ApiService, - private readonly sshService: SSHService, ) { } async presentAlert (key: string, current?: any): Promise { @@ -49,6 +44,7 @@ export class ServerConfigService { loader.dismiss() } }, + cssClass: 'enter-click', }, ] @@ -84,24 +80,6 @@ export class ServerConfigService { await alert.present() } - async presentModalInput (key: string, current?: string) { - const { name, description, masked } = serverConfig[key] as ValueSpecString - - const modal = await this.modalCtrl.create({ - component: BackupConfirmationComponent, - componentProps: { - title: name, - message: description, - label: name, - useMask: masked, - value: current, - submitFn: this.saveFns[key], - }, - cssClass: 'alertlike-modal', - }) - await modal.present() - } - // async presentModalForm (key: string) { // const modal = await this.modalCtrl.create({ // component: AppActionInputPage, @@ -123,9 +101,6 @@ export class ServerConfigService { 'auto-check-updates': async (enabled: boolean) => { return this.embassyApi.setDbValue({ pointer: '/auto-check-updates', value: enabled }) }, - ssh: async (pubkey: string) => { - return this.sshService.add(pubkey) - }, // 'eos-marketplace': async () => { // return this.embassyApi.setEosMarketplace() // }, @@ -148,17 +123,6 @@ export const serverConfig: ConfigSpec = { description: 'On launch, EmbassyOS will automatically check for updates of itself and your installed services. Updating still requires user approval and action. No updates will ever be performed automatically.', default: true, }, - ssh: { - type: 'string', - name: 'SSH Key', - description: 'Enter the SSH public key of you would like to authorize for root access to your Embassy.', - nullable: false, - // @TODO regex for SSH Key - // pattern: '', - 'pattern-description': 'Must be a valid SSH key', - masked: false, - copyable: false, - }, // 'eos-marketplace': { // type: 'boolean', // name: 'Tor Only Marketplace', diff --git a/ui/src/app/services/startup-alerts.service.ts b/ui/src/app/services/startup-alerts.service.ts index 493b5a573..19bc1bfd6 100644 --- a/ui/src/app/services/startup-alerts.service.ts +++ b/ui/src/app/services/startup-alerts.service.ts @@ -155,7 +155,6 @@ export class StartupAlertsService { private async displayAppsCheck (): Promise { return new Promise(async resolve => { const alert = await this.alertCtrl.create({ - backdropDismiss: true, header: 'Updates Available!', message: new IonicSafeString( `
@@ -173,8 +172,9 @@ export class StartupAlertsService { { text: 'View in Marketplace', handler: () => { - return this.navCtrl.navigateForward('/marketplace').then(() => resolve(false)) + this.navCtrl.navigateForward('/marketplace').then(() => resolve(false)) }, + cssClass: 'enter-click', }, ], }) @@ -186,7 +186,6 @@ export class StartupAlertsService { private async presentAlertNewOS (versionLatest: string): Promise<{ cancel?: true, update?: true }> { return new Promise(async resolve => { const alert = await this.alertCtrl.create({ - backdropDismiss: true, header: 'New EmbassyOS Version!', message: new IonicSafeString( `
@@ -204,6 +203,7 @@ export class StartupAlertsService { { text: 'Update', handler: () => resolve({ update: true }), + cssClass: 'enter-click', }, ], })