diff --git a/ui/package-lock.json b/ui/package-lock.json index c01d952c0..fe206b2c0 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -51,24 +51,6 @@ } }, "../../patch-db-client": {}, - "../../patch-db/client": { - "name": "patch-db", - "version": "1.0.0", - "extraneous": true, - "license": "MIT", - "dependencies": { - "rxjs": "^6.6.3", - "sorted-btree": "^1.5.0", - "uuid": "^8.3.2" - }, - "devDependencies": { - "@types/node": "^15.0.0", - "@types/uuid": "^8.3.0", - "ts-node": "^9.1.1", - "tslint": "^6.1.0", - "typescript": "4.1.5" - } - }, "node_modules/@angular-devkit/architect": { "version": "0.1102.14", "dev": true, @@ -2402,8 +2384,7 @@ }, "node_modules/@ngrx/component": { "version": "11.1.1", - "resolved": "https://registry.npmjs.org/@ngrx/component/-/component-11.1.1.tgz", - "integrity": "sha512-Vw2jyz5O8g61OcDtX8FcJh+EV9VDJsk/q61WQyOuwr0yi3SbRnn/77bHzF27RVwiQn8lq3yteNnh32H/vRdFWQ==", + "license": "MIT", "dependencies": { "tslib": "^2.0.0" }, @@ -17039,8 +17020,6 @@ }, "@ngrx/component": { "version": "11.1.1", - "resolved": "https://registry.npmjs.org/@ngrx/component/-/component-11.1.1.tgz", - "integrity": "sha512-Vw2jyz5O8g61OcDtX8FcJh+EV9VDJsk/q61WQyOuwr0yi3SbRnn/77bHzF27RVwiQn8lq3yteNnh32H/vRdFWQ==", "requires": { "tslib": "^2.0.0" } diff --git a/ui/src/app/app-routing.module.ts b/ui/src/app/app-routing.module.ts index 076d1fed7..8d5fad4d2 100644 --- a/ui/src/app/app-routing.module.ts +++ b/ui/src/app/app-routing.module.ts @@ -12,9 +12,9 @@ const routes: Routes = [ path: '', }, { - path: 'auth', + path: 'login', canActivate: [UnauthGuard], - loadChildren: () => import('./pages/auth-routes/auth-routing.module').then(m => m.AuthRoutingModule), + loadChildren: () => import('./pages/login/login.module').then(m => m.LoginPageModule), }, { path: 'embassy', diff --git a/ui/src/app/app.component.html b/ui/src/app/app.component.html index b30dc6147..8c5d2463b 100644 --- a/ui/src/app/app.component.html +++ b/ui/src/app/app.component.html @@ -9,7 +9,7 @@ - + diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index a06b7124c..418d0e6f0 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -96,7 +96,7 @@ export class AppComponent { this.showMenu = false this.patch.stop() this.storage.clear() - this.router.navigate(['/auth'], { replaceUrl: true }) + this.router.navigate(['/login'], { replaceUrl: true }) } }) 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 7f30d05fa..e74f9223e 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 @@ -47,7 +47,7 @@ export class AppActionsPage { }) await alert.present() } else { - const statuses = [...action.allowedStatuses] + const statuses = [...action.value['allowedStatuses']] const last = statuses.pop() let statusesStr = statuses.join(', ') let error = null @@ -63,7 +63,7 @@ export class AppActionsPage { } const alert = await this.alertCtrl.create({ header: 'Forbidden', - message: error || `Action "${action.name}" can only be executed when service is ${statusesStr}`, + message: error || `Action "${action.value.name}" can only be executed when service is ${statusesStr}`, buttons: ['OK'], cssClass: 'alert-error-message', }) diff --git a/ui/src/app/pages/apps-routes/app-available-list/app-available-list.page.html b/ui/src/app/pages/apps-routes/app-available-list/app-available-list.page.html index 43b06a332..9db1e87a6 100644 --- a/ui/src/app/pages/apps-routes/app-available-list/app-available-list.page.html +++ b/ui/src/app/pages/apps-routes/app-available-list/app-available-list.page.html @@ -41,7 +41,7 @@ - + diff --git a/ui/src/app/pages/apps-routes/app-available-show/app-available-show.page.html b/ui/src/app/pages/apps-routes/app-available-show/app-available-show.page.html index f276157ac..a5680edbd 100644 --- a/ui/src/app/pages/apps-routes/app-available-show/app-available-show.page.html +++ b/ui/src/app/pages/apps-routes/app-available-show/app-available-show.page.html @@ -145,11 +145,6 @@ - - - License - {{ vars.licenseName }} - Other versions 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 28a121ff0..ede0211e6 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 @@ -104,7 +104,7 @@ Restore from Backup - + Donate 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 72901b92f..554e9e12d 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 @@ -2,7 +2,7 @@ import { Component, ViewChild } from '@angular/core' import { AlertController, NavController, ModalController, IonContent, PopoverController } from '@ionic/angular' import { ApiService } from 'src/app/services/api/api.service' import { ActivatedRoute, NavigationExtras } from '@angular/router' -import { chill } from 'src/app/util/misc.util' +import { chill, pauseFor } from 'src/app/util/misc.util' import { LoaderService } from 'src/app/services/loader.service' import { Observable, of, Subscription } from 'rxjs' import { wizardModal } from 'src/app/components/install-wizard/install-wizard.component' @@ -10,7 +10,7 @@ import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards' import { InformationPopoverComponent } from 'src/app/components/information-popover/information-popover.component' import { ConfigService } from 'src/app/services/config.service' import { PatchDbModel } from 'src/app/models/patch-db/patch-db-model' -import { DependencyErrorConfigUnsatisfied, DependencyErrorNotInstalled, DependencyErrorType, PackageDataEntry, PackageState } from 'src/app/models/patch-db/data-model' +import { DependencyErrorConfigUnsatisfied, DependencyErrorNotInstalled, DependencyErrorType, Manifest, PackageDataEntry, PackageState } from 'src/app/models/patch-db/data-model' import { FEStatus } from 'src/app/services/pkg-status-rendering.service' import { ConnectionService } from 'src/app/services/connection.service' import { Recommendation } from 'src/app/components/recommendation-button/recommendation-button.component' @@ -54,6 +54,10 @@ export class AppInstalledShowPage { this.pkgSub = this.patch.watch$('package-data', this.pkgId).subscribe(pkg => this.pkg = pkg) } + async ngAfterViewInit () { + this.content.scrollToPoint(undefined, 1) + } + async ngOnDestroy () { this.pkgSub.unsubscribe() } @@ -114,6 +118,20 @@ export class AppInstalledShowPage { return this.navCtrl.navigateRoot('/services/installed') } + async donate (manifest: Manifest): Promise { + const url = manifest['donation-url'] + if (url) { + window.open(url, '_blank') + } else { + const alert = await this.alertCtrl.create({ + header: 'Not Accepting Donations', + message: `The developers of ${manifest.title} have not provided a donation URL. Please contact them directly if you insist on giving them money.`, + buttons: ['OK'], + }) + await alert.present() + } + } + async presentPopover (information: string, ev: any) { const popover = await this.popoverController.create({ component: InformationPopoverComponent, diff --git a/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts b/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts index 985add52f..dbd48c736 100644 --- a/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts +++ b/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts @@ -1,6 +1,6 @@ -import { Component } from '@angular/core' +import { Component, ViewChild } from '@angular/core' import { ActivatedRoute } from '@angular/router' -import { ToastController } from '@ionic/angular' +import { IonContent, ToastController } from '@ionic/angular' import { InstalledPackageDataEntry } from 'src/app/models/patch-db/data-model' import { PatchDbModel } from 'src/app/models/patch-db/patch-db-model' import { ConfigService } from 'src/app/services/config.service' @@ -14,6 +14,8 @@ import { copyToClipboard } from 'src/app/util/web.util' export class AppInterfacesPage { pkgId: string + @ViewChild(IonContent) content: IonContent + constructor ( private readonly route: ActivatedRoute, private readonly toastCtrl: ToastController, @@ -25,6 +27,10 @@ export class AppInterfacesPage { this.pkgId = this.route.snapshot.paramMap.get('pkgId') } + async ngAfterViewInit () { + this.content.scrollToPoint(undefined, 1) + } + async copy (address: string): Promise { let message = '' await copyToClipboard(address || '') diff --git a/ui/src/app/pages/apps-routes/app-restore/app-restore.page.html b/ui/src/app/pages/apps-routes/app-restore/app-restore.page.html index 432fbc699..7790679ef 100644 --- a/ui/src/app/pages/apps-routes/app-restore/app-restore.page.html +++ b/ui/src/app/pages/apps-routes/app-restore/app-restore.page.html @@ -14,51 +14,62 @@ - - {{ error }} - - - - -

About

-

- Select a location from which to restore {{ pkg.installed.manifest.title }}. This will overwrite all current data. -

-
-
- - + + + + +

Loading Drives

+
+
+
- - - No partitions available. Insert the storage device containing the backup you intend to restore. + + {{ error }} - - - - - {{ disk.value.size }} - - - {{ disk.key }} - - - - - - - -

{{ partition.value.label || partition.key }} ({{ partition.value.size || 'unknown size' }})

-

Available

- -

Unavailable

-
-
-
-
-
-
+ + + +

About

+

+ Select a location from which to restore {{ pkg.installed.manifest.title }}. This will overwrite all current data. +

+
+
+ + + + + + + No partitions available. Insert the storage device containing the backup you intend to restore. + + + + + + {{ disk.value.size }} + + + {{ disk.key }} + + + + + + + +

{{ partition.value.label || partition.key }} ({{ partition.value.size || 'unknown size' }})

+

Available

+ +

Unavailable

+
+
+
+
+
+
+
diff --git a/ui/src/app/pages/apps-routes/app-restore/app-restore.page.ts b/ui/src/app/pages/apps-routes/app-restore/app-restore.page.ts index b990b4ebf..0ac4720c8 100644 --- a/ui/src/app/pages/apps-routes/app-restore/app-restore.page.ts +++ b/ui/src/app/pages/apps-routes/app-restore/app-restore.page.ts @@ -1,5 +1,5 @@ -import { Component } from '@angular/core' -import { LoadingController, ModalController } from '@ionic/angular' +import { Component, ViewChild } from '@angular/core' +import { IonContent, LoadingController, ModalController } from '@ionic/angular' import { ApiService } from 'src/app/services/api/api.service' import { BackupConfirmationComponent } from 'src/app/modals/backup-confirmation/backup-confirmation.component' import { DiskInfo, PartitionInfoEntry } from 'src/app/services/api/api-types' @@ -18,6 +18,8 @@ export class AppRestorePage { error: string allPartitionsMounted: boolean + @ViewChild(IonContent) content: IonContent + constructor ( private readonly route: ActivatedRoute, private readonly modalCtrl: ModalController, @@ -31,6 +33,10 @@ export class AppRestorePage { this.getExternalDisks() } + async ngAfterViewInit () { + this.content.scrollToPoint(undefined, 1) + } + async doRefresh () { this.loading = true await this.getExternalDisks() diff --git a/ui/src/app/pages/auth-routes/auth-password/auth-password.module.ts b/ui/src/app/pages/auth-routes/auth-password/auth-password.module.ts deleted file mode 100644 index 339a23182..000000000 --- a/ui/src/app/pages/auth-routes/auth-password/auth-password.module.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { NgModule } from '@angular/core' -import { RouterModule, Routes } from '@angular/router' -import { CommonModule } from '@angular/common' -import { FormsModule } from '@angular/forms' -import { IonicModule } from '@ionic/angular' -import { AuthPasswordPage } from './auth-password.page' -import { SharingModule } from 'src/app/modules/sharing.module' - -const routes: Routes = [ - { - path: '', - component: AuthPasswordPage, - }, -] - -@NgModule({ - imports: [ - CommonModule, - FormsModule, - IonicModule, - RouterModule.forChild(routes), - SharingModule, - ], - declarations: [AuthPasswordPage], -}) -export class AuthPasswordPageModule { } diff --git a/ui/src/app/pages/auth-routes/auth-pin/auth-pin.page.html b/ui/src/app/pages/auth-routes/auth-pin/auth-pin.page.html deleted file mode 100644 index ff39a4714..000000000 --- a/ui/src/app/pages/auth-routes/auth-pin/auth-pin.page.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- - - - - -
- - - - - - - - - {{ error }} - - - - Next - -
-
-
-
-
-
-
-
\ No newline at end of file diff --git a/ui/src/app/pages/auth-routes/auth-pin/auth-pin.page.scss b/ui/src/app/pages/auth-routes/auth-pin/auth-pin.page.scss deleted file mode 100644 index 3f4f0de05..000000000 --- a/ui/src/app/pages/auth-routes/auth-pin/auth-pin.page.scss +++ /dev/null @@ -1,3 +0,0 @@ -.sharp-button { - --border-radius: 1px; -} \ No newline at end of file diff --git a/ui/src/app/pages/auth-routes/auth-pin/auth-pin.page.ts b/ui/src/app/pages/auth-routes/auth-pin/auth-pin.page.ts deleted file mode 100644 index e8aa5491e..000000000 --- a/ui/src/app/pages/auth-routes/auth-pin/auth-pin.page.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Component } from '@angular/core' -import { NavController } from '@ionic/angular' -import { AuthService } from 'src/app/services/auth.service' -import { LoaderService } from 'src/app/services/loader.service' - -@Component({ - selector: 'auth-pin', - templateUrl: './auth-pin.page.html', - styleUrls: ['./auth-pin.page.scss'], -}) -export class AuthPinPage { - pin = '' - unmasked = false - error = '' - - constructor ( - private readonly authService: AuthService, - private readonly loader: LoaderService, - private readonly navCtrl: NavController, - ) { } - - ionViewDidEnter () { - this.error = '' - } - - toggleMask () { - this.unmasked = !this.unmasked - } - - async submit () { - try { - await this.loader.displayDuringP( - this.authService.submitPin(this.pin), - ) - this.pin = '' - await this.navCtrl.navigateForward(['/auth/password']) - } catch (e) { - this.error = e.message - } - } -} diff --git a/ui/src/app/pages/auth-routes/auth-routing.module.ts b/ui/src/app/pages/auth-routes/auth-routing.module.ts deleted file mode 100644 index 92d0d0089..000000000 --- a/ui/src/app/pages/auth-routes/auth-routing.module.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { NgModule } from '@angular/core' -import { Routes, RouterModule } from '@angular/router' - -const routes: Routes = [ - { - path: '', - redirectTo: 'pin', - pathMatch: 'full', - }, - { - path: 'pin', - loadChildren: () => import('./auth-pin/auth-pin.module').then(m => m.AuthPinPageModule), - }, - { - path: 'password', - loadChildren: () => import('./auth-password/auth-password.module').then(m => m.AuthPasswordPageModule), - }, -] - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class AuthRoutingModule { } \ No newline at end of file diff --git a/ui/src/app/pages/auth-routes/auth-pin/auth-pin.module.ts b/ui/src/app/pages/login/login.module.ts similarity index 77% rename from ui/src/app/pages/auth-routes/auth-pin/auth-pin.module.ts rename to ui/src/app/pages/login/login.module.ts index aac49aa22..5074a668a 100644 --- a/ui/src/app/pages/auth-routes/auth-pin/auth-pin.module.ts +++ b/ui/src/app/pages/login/login.module.ts @@ -3,13 +3,13 @@ import { RouterModule, Routes } from '@angular/router' import { CommonModule } from '@angular/common' import { FormsModule } from '@angular/forms' import { IonicModule } from '@ionic/angular' -import { AuthPinPage } from './auth-pin.page' +import { LoginPage } from './login.page' import { SharingModule } from 'src/app/modules/sharing.module' const routes: Routes = [ { path: '', - component: AuthPinPage, + component: LoginPage, }, ] @@ -21,6 +21,6 @@ const routes: Routes = [ RouterModule.forChild(routes), SharingModule, ], - declarations: [AuthPinPage], + declarations: [LoginPage], }) -export class AuthPinPageModule { } +export class LoginPageModule { } diff --git a/ui/src/app/pages/auth-routes/auth-password/auth-password.page.html b/ui/src/app/pages/login/login.page.html similarity index 83% rename from ui/src/app/pages/auth-routes/auth-password/auth-password.page.html rename to ui/src/app/pages/login/login.page.html index 059aceae4..c90bc5177 100644 --- a/ui/src/app/pages/auth-routes/auth-password/auth-password.page.html +++ b/ui/src/app/pages/login/login.page.html @@ -5,9 +5,7 @@
- Confirm Nym - - Chuck Tender +
@@ -23,7 +21,7 @@ - Login + Next
diff --git a/ui/src/app/pages/auth-routes/auth-password/auth-password.page.scss b/ui/src/app/pages/login/login.page.scss similarity index 100% rename from ui/src/app/pages/auth-routes/auth-password/auth-password.page.scss rename to ui/src/app/pages/login/login.page.scss diff --git a/ui/src/app/pages/auth-routes/auth-password/auth-password.page.ts b/ui/src/app/pages/login/login.page.ts similarity index 77% rename from ui/src/app/pages/auth-routes/auth-password/auth-password.page.ts rename to ui/src/app/pages/login/login.page.ts index 615603c99..4cbbf9dc6 100644 --- a/ui/src/app/pages/auth-routes/auth-password/auth-password.page.ts +++ b/ui/src/app/pages/login/login.page.ts @@ -1,15 +1,15 @@ import { Component } from '@angular/core' +import { NavController } from '@ionic/angular' import { AuthService } from 'src/app/services/auth.service' import { LoaderService } from 'src/app/services/loader.service' -import { NavController } from '@ionic/angular' @Component({ - selector: 'auth-password', - templateUrl: './auth-password.page.html', - styleUrls: ['./auth-password.page.scss'], + selector: 'login', + templateUrl: './login.page.html', + styleUrls: ['./login.page.scss'], }) -export class AuthPasswordPage { - password: string = '' +export class LoginPage { + password = '' unmasked = false error = '' @@ -33,7 +33,7 @@ export class AuthPasswordPage { this.authService.submitPassword(this.password), ) this.password = '' - return this.navCtrl.navigateForward(['']) + await this.navCtrl.navigateForward(['/']) } catch (e) { this.error = e.message } diff --git a/ui/src/app/services/api/mock-app-fixures.ts b/ui/src/app/services/api/mock-app-fixures.ts index 064b279c0..46a5c3d23 100644 --- a/ui/src/app/services/api/mock-app-fixures.ts +++ b/ui/src/app/services/api/mock-app-fixures.ts @@ -179,7 +179,7 @@ export module Mock { 'upstream-repo': 'https://github.com/lightningnetwork/lnd', 'support-site': 'https://lightning.engineering/', 'marketing-site': 'https://lightning.engineering/', - 'donation-url': 'https://start9.com', + 'donation-url': null, alerts: { install: null, uninstall: null,