From 92c297648c0acb94fcc306a047e4fa50f513bd27 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 26 Feb 2021 09:16:45 -0700 Subject: [PATCH] remove lan stuff --- ui/src/app/models/app-types.ts | 1 - .../app-installed-list.page.html | 34 +++---- .../app-installed-list.page.ts | 2 - .../app-installed-show.page.html | 56 +++++------- .../app-installed-show.page.scss | 34 +------ .../app-installed-show.page.ts | 91 ++----------------- .../app-instructions/app-instructions.page.ts | 1 - .../app/pages/server-routes/lan/lan.page.html | 2 +- .../server-show/server-show.page.html | 4 +- .../pages/server-routes/wifi/wifi.page.html | 4 +- ui/src/app/services/api/mock-app-fixures.ts | 4 - 11 files changed, 55 insertions(+), 178 deletions(-) diff --git a/ui/src/app/models/app-types.ts b/ui/src/app/models/app-types.ts index 65de7a822..bac656409 100644 --- a/ui/src/app/models/app-types.ts +++ b/ui/src/app/models/app-types.ts @@ -35,7 +35,6 @@ export interface AppAvailableVersionSpecificInfo { export interface AppInstalledPreview extends BaseApp { lanAddress?: string - lanEnabled?: boolean torAddress: string versionInstalled: string ui: boolean diff --git a/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.html b/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.html index 7a8e9e8e2..bde43f504 100644 --- a/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.html +++ b/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.html @@ -22,26 +22,26 @@ - + - -
-
- + +
+
+ +
-
- - - - - - - - -

{{ vars.title }}

-
- + + + + + + + + +

{{ vars.title }}

+
+ diff --git a/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.ts b/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.ts index 8b2ff4ffb..95c26cbb8 100644 --- a/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.ts +++ b/ui/src/app/pages/apps-routes/app-installed-list/app-installed-list.page.ts @@ -96,8 +96,6 @@ export class AppInstalledListPage extends Cleanup { this.error = e.message }, }) - - console.log(this.isTor, this.apps[2].subject.lanEnabled.getValue()) } async launchUiTab (id: string, event: Event) { diff --git a/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.html b/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.html index 860f1f4fe..be5e2e923 100644 --- a/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.html +++ b/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.html @@ -21,10 +21,7 @@ iconURL: app.iconURL | async, title: app.title | async, ui: app.ui | async, - lanAddress: app.lanAddress | async, - lanEnabled: app.lanEnabled | async, - launchDisabled: (app.status | async) !== 'RUNNING' || (!isTor && !($lanConnected$ | async)), - testingLanConnection: $testingLanConnection$ | async + lanAddress: app.lanAddress | async } as vars" class="ion-padding-bottom"> @@ -56,42 +53,36 @@ - + - + Configure - + Stop - + Stop Backup - + Force Uninstall - + Fix - + Start - - - - - - - - - LAUNCH - - - + + + Launch Web + + +
@@ -100,21 +91,20 @@

Tor Address

-

{{ vars.torAddress }}

+

{{ vars.torAddress }}

+ + +

LAN Address

-

- {{ vars.lanAddress }} -

-

- Testing Connection - -

+

{{ vars.lanAddress }}

- + + +
Backups @@ -122,7 +112,7 @@ - Create new Backup + Create Backup Last Backup: {{vars.lastBackup ? (vars.lastBackup | date: 'short') : 'never'}} 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 9d1390694..20648cbcb 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 @@ -40,35 +40,7 @@ } .launch-button { - width: 100%; - padding: 0px 10px; - --background: linear-gradient(200deg, rgb(70 193 255), rgb(70 193 255 / 45%)); - width: calc(100% - 32px); - border-radius: 8px; - --border-radius: 8px; + --border-width: 1px; + --border-radius: 10px; + margin: 10px; } - -.launch-button-off { - --background: #383838; - color: var(--ion-color-medium) -} - -.launch-explanation-button { - position: absolute; - z-index: 1; - right: -2px; - --border-radius: 100px; -} - -.lan-toggle { - width: 2em; - height: 1em; - --handle-width: 0.9em; - --handle-height: 0.9em; -} - -.item-interactive-disabled:not(.item-multiple-inputs) ion-label { - cursor: default; - opacity: 1 !important; - pointer-events: auto !important; -} \ No newline at end of file diff --git a/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.ts b/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.ts index 69651e38e..642ceb9b1 100644 --- a/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.ts +++ b/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.ts @@ -6,20 +6,20 @@ import { copyToClipboard } from 'src/app/util/web.util' import { AppModel, AppStatus } from 'src/app/models/app-model' import { AppInstalledFull } from 'src/app/models/app-types' import { ModelPreload } from 'src/app/models/model-preload' -import { chill, modulateTime, pauseFor, traceWheel } from 'src/app/util/misc.util' +import { chill, pauseFor } from 'src/app/util/misc.util' import { PropertySubject, peekProperties } from 'src/app/util/property-subject.util' import { AppBackupPage } from 'src/app/modals/app-backup/app-backup.page' import { LoaderService, markAsLoadingDuring$, markAsLoadingDuringP } from 'src/app/services/loader.service' -import { BehaviorSubject, combineLatest, from, merge, Observable, of, Subject } from 'rxjs' +import { BehaviorSubject, Observable, of } from 'rxjs' import { wizardModal } from 'src/app/components/install-wizard/install-wizard.component' import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards' -import { catchError, concatMap, delay, distinctUntilChanged, filter, map, mergeMap, retryWhen, switchMap, take, tap } from 'rxjs/operators' +import { catchError, concatMap, filter, switchMap, tap } from 'rxjs/operators' import { Cleanup } from 'src/app/util/cleanup' import { InformationPopoverComponent } from 'src/app/components/information-popover/information-popover.component' import { Emver } from 'src/app/services/emver.service' import { displayEmver } from 'src/app/pipes/emver.pipe' import { ConfigService } from 'src/app/services/config.service' -import { concatObservableValues, squash } from 'src/app/util/rxjs.util' + @Component({ selector: 'app-installed-show', templateUrl: './app-installed-show.page.html', @@ -37,15 +37,7 @@ export class AppInstalledShowPage extends Cleanup { isConsulate: boolean isTor: boolean - // true iff service lan address has been tested and is accessible - $lanConnected$: BehaviorSubject = new BehaviorSubject(false) - // true during service lan address testing - $testingLanConnection$: BehaviorSubject = new BehaviorSubject(false) - dependencyDefintion = () => `Dependencies are other services which must be installed, configured appropriately, and started in order to start ${this.app.title.getValue()}` - launchDefinition = `Launch A Service

This button appears only for services that can be accessed inside the browser. If a service does not have this button, you must access it using another interface, such as a mobile app, desktop app, or another service on the Embassy. Please view the instructions for a service for details on how to use it.

` - launchOffDefinition = `Launch A Service

This button appears only for services that can be accessed inside the browser. Get your service running in order to launch!

` - launchLocalDefinition = `Launch A Service

This button appears only for services that can be accessed inside the browser. To launch this service over LAN, enable the toggle below by your service's LAN Address.

` @ViewChild(IonContent) content: IonContent @@ -76,69 +68,12 @@ export class AppInstalledShowPage extends Cleanup { markAsLoadingDuring$(this.$loading$, this.preload.appFull(this.appId)) .pipe( tap(app => this.app = app), - concatMap(app => - merge( - this.syncWhenDependencyInstalls(), - // new lan info or status info from sync daemon - combineLatest([app.lanEnabled, app.status]).pipe( - concatObservableValues([this.$lanConnected$, this.$testingLanConnection$]), - concatMap(([enabled, status, connected, alreadyConnecting]) => { - if (status !== AppStatus.RUNNING) return of(this.$lanConnected$.next(false)) - if (alreadyConnecting) return of() - if (enabled && !connected) return markAsLoadingDuring$(this.$testingLanConnection$, this.testLanConnection()) - if (!enabled && connected) return of(this.$lanConnected$.next(false)) - return of() - }), - ), - // toggle lan - this.$lanToggled$.pipe( - map(toggleEvent => (toggleEvent as any).detail.checked), - concatObservableValues([app.lanEnabled, this.$testingLanConnection$]), - traceWheel('toggle'), - map( ([uiEnabled, appEnabled, alreadyConnecting]) => { - if (!alreadyConnecting && uiEnabled && !appEnabled) return this.enableLan().pipe(concatMap(() => this.testLanConnection())) - if (!alreadyConnecting && !uiEnabled) return this.disableLan() //do this even if app already disabled because of appModel update timeout hack. - return of() - }), - concatMap((o: Observable) => this.testLanLoader(o)), - ), - ), - ), //must be final in stack - catchError(e => this.setError(e)), + concatMap(() => this.syncWhenDependencyInstalls()), //must be final in stack + catchError(e => of(this.setError(e))), ).subscribe(), ) } - testLanLoader (o: Observable): Observable { - return markAsLoadingDuring$(this.$testingLanConnection$, o).pipe(catchError(e => this.setError(e))) - } - - testLanConnection () : Observable { - if (!this.app.lanAddress) return of() - - return this.app.lanAddress.pipe( - switchMap(la => this.apiService.testConnection(la)), - retryWhen(errors => errors.pipe(delay(2500), take(20))), - catchError(() => of(false)), - take(1), - traceWheel('lan connected test'), - map(connected => this.$lanConnected$.next(connected)), - ) - } - - enableLan (): Observable { - return from(this.apiService.toggleAppLAN(this.appId, 'enable')).pipe(squash) - } - - disableLan (): Observable { - return from(this.apiService.toggleAppLAN(this.appId, 'disable')).pipe( - map(() => this.appModel.update({ id: this.appId, lanEnabled: false }), modulateTime(new Date(), 10, 'seconds')), - map(() => this.$lanConnected$.next(false)), - squash, - ) - } - - $lanToggled$ = new Subject() ionViewDidEnter () { markAsLoadingDuringP(this.$loadingDependencies$, this.getApp()) } @@ -238,7 +173,7 @@ export class AppInstalledShowPage extends Cleanup { await toast.present() } - async copyLan () { + async copyLAN () { const app = peekProperties(this.app) let message = '' await copyToClipboard(app.lanAddress).then(success => { message = success ? 'copied to clipboard!' : 'failed to copy' }) @@ -353,18 +288,6 @@ export class AppInstalledShowPage extends Cleanup { return this.navCtrl.navigateRoot('/services/installed') } - async presentLaunchPopover (status: AppStatus, ev: any) { - let desc: string - if (!this.isTor) { - desc = this.launchLocalDefinition - } else if (status !== AppStatus.RUNNING) { - desc = this.launchOffDefinition - } else { - desc = this.launchDefinition - } - return this.presentPopover(desc, ev) - } - async presentPopover (information: string, ev: any) { const popover = await this.popoverController.create({ component: InformationPopoverComponent, diff --git a/ui/src/app/pages/apps-routes/app-instructions/app-instructions.page.ts b/ui/src/app/pages/apps-routes/app-instructions/app-instructions.page.ts index b1049a649..9219cf6e5 100644 --- a/ui/src/app/pages/apps-routes/app-instructions/app-instructions.page.ts +++ b/ui/src/app/pages/apps-routes/app-instructions/app-instructions.page.ts @@ -16,7 +16,6 @@ export class AppInstructionsPage { error = '' app: AppInstalledFull = { } as any appId: string - instructions: any constructor ( private readonly route: ActivatedRoute, diff --git a/ui/src/app/pages/server-routes/lan/lan.page.html b/ui/src/app/pages/server-routes/lan/lan.page.html index ed3532f30..c8a245dcd 100644 --- a/ui/src/app/pages/server-routes/lan/lan.page.html +++ b/ui/src/app/pages/server-routes/lan/lan.page.html @@ -3,7 +3,7 @@ - Secure LAN Setup + LAN Setup diff --git a/ui/src/app/pages/server-routes/server-show/server-show.page.html b/ui/src/app/pages/server-routes/server-show/server-show.page.html index f4fa3c24e..e13bd06be 100644 --- a/ui/src/app/pages/server-routes/server-show/server-show.page.html +++ b/ui/src/app/pages/server-routes/server-show/server-show.page.html @@ -59,12 +59,12 @@ - Secure LAN Setup + LAN Setup - WiFi + WiFi Setup diff --git a/ui/src/app/pages/server-routes/wifi/wifi.page.html b/ui/src/app/pages/server-routes/wifi/wifi.page.html index 90bce7c92..3d6b9a3d2 100644 --- a/ui/src/app/pages/server-routes/wifi/wifi.page.html +++ b/ui/src/app/pages/server-routes/wifi/wifi.page.html @@ -3,7 +3,7 @@ - Wifi + WiFi Setup @@ -26,7 +26,7 @@ Warning!

- WiFi is a beta feature with known issues. If you make changes to WiFi, your Embassy and its Services may become unreachable for upward of a few hours over Tor. Please use with caution and patience. + Making changes to WiFi can cause your Embassy and its Services to become unreachable for a few minutes to an hour. Please be patient.
diff --git a/ui/src/app/services/api/mock-app-fixures.ts b/ui/src/app/services/api/mock-app-fixures.ts index 0548044f9..9031527e4 100644 --- a/ui/src/app/services/api/mock-app-fixures.ts +++ b/ui/src/app/services/api/mock-app-fixures.ts @@ -25,7 +25,6 @@ export function toInstalledPreview (f: AppInstalledFull): AppInstalledPreview { torAddress: f.torAddress, ui: f.ui, lanAddress: f.lanAddress, - lanEnabled: f.lanEnabled, } } @@ -50,7 +49,6 @@ export const bitcoinI: AppInstalledFull = { id: 'bitcoind', versionInstalled: '0.18.1', lanAddress: 'bitcoinLan.local', - lanEnabled: true, title: 'Bitcoin Core', torAddress: '4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion', startAlert: 'Bitcoind could take a loooooong time to start. Please be patient.', @@ -71,7 +69,6 @@ export const bitcoinI: AppInstalledFull = { export const lightningI: AppInstalledFull = { id: 'c-lightning', lanAddress: 'lightningLan.local', - lanEnabled: true, status: AppStatus.RUNNING, title: 'C Lightning', versionInstalled: '1.0.0', @@ -97,7 +94,6 @@ export const lightningI: AppInstalledFull = { export const cupsI: AppInstalledFull = { id: 'cups', lanAddress: 'cupsLan.local', - lanEnabled: false, versionInstalled: '2.1.0', title: 'Cups Messenger', torAddress: 'sample-cups-tor-address.onion',