From 37304a9d92425af30428afc031208920b088cecf Mon Sep 17 00:00:00 2001 From: Lucy Cifferello <12953208+elvece@users.noreply.github.com> Date: Tue, 14 Jun 2022 18:38:36 -0600 Subject: [PATCH] chore: cleanup and small misc fixes display success alert if on latest EOS after check for update fix bug with loader dismiss after alert present fix restart button on update complete alert and fix mocks to account for this state fix make clean and adjust default registry names --- Makefile | 4 +- frontend/README.md | 2 +- .../app/modals/cifs-modal/cifs-modal.page.ts | 55 +++++++++++------ .../global/services/update-toast.service.ts | 59 +++++++++---------- .../ui/src/app/app/snek/snek.directive.ts | 4 +- .../app-wizard/app-wizard.component.html | 18 ++++-- .../app-wizard/app-wizard.component.ts | 2 +- .../app-wizard/notes/notes.component.html | 2 +- .../app/components/app-wizard/wizard-defs.ts | 6 ++ .../components/status/status.component.html | 2 +- .../modals/app-config/app-config.page.html | 10 ++-- .../app/modals/app-config/app-config.page.ts | 2 +- .../app-recover-select.page.html | 24 ++++++-- .../app/modals/enum-list/enum-list.page.html | 31 ++++++---- .../modals/os-welcome/os-welcome.page.html | 7 ++- .../ui/src/app/modals/snake/snake.page.html | 9 ++- .../app-list-icon.component.scss | 5 +- .../marketplaces/marketplaces.page.ts | 23 ++------ .../server-show/server-show.page.ts | 31 ++++++++-- .../server-routes/sideload/sideload.page.html | 2 +- .../ui/src/app/services/api/api.fixures.ts | 6 ++ .../services/api/embassy-mock-api.service.ts | 11 +++- .../ui/src/app/services/api/mock-patch.ts | 2 +- .../ui/src/app/services/eos.service.ts | 1 + .../src/app/services/marketplace.service.ts | 13 ++-- .../src/app/services/patch-db/data-model.ts | 12 ++-- frontend/projects/ui/src/styles.scss | 4 ++ frontend/registries.json | 4 +- 28 files changed, 221 insertions(+), 130 deletions(-) diff --git a/Makefile b/Makefile index a4649fb74..326ea2b21 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,8 @@ clean: rm -rf patch-db/client/node_modules rm -rf patch-db/client/dist - rm libs/js_engine/src/artifacts/ARM_JS_SNAPSHOT.bin - rm libs/js_engine/src/artifacts/JS_SNAPSHOT.bin + rm -f libs/js_engine/src/artifacts/ARM_JS_SNAPSHOT.bin + rm -f libs/js_engine/src/artifacts/JS_SNAPSHOT.bin touch libs/snapshot-creator/Cargo.toml eos.img: $(EMBASSY_SRC) system-images/compat/compat.tar system-images/utils/utils.tar $(EMBASSY_V8_SNAPSHOTS) diff --git a/frontend/README.md b/frontend/README.md index f41ad89fb..026c3c549 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -58,7 +58,7 @@ npm run start:diagnostic-ui This section enables you to run a local frontend with a remote backend (eg. hosted on a live Embassy). It assumes you have completed Step 1 and Step 2 in the [section above](#running-locally-with-mocks) -1. Set `useMocks: true` in `config.json` +1. Set `useMocks: false` in `config.json` 2. Create a proxy configuration file from the sample: diff --git a/frontend/projects/setup-wizard/src/app/modals/cifs-modal/cifs-modal.page.ts b/frontend/projects/setup-wizard/src/app/modals/cifs-modal/cifs-modal.page.ts index a813f1ec4..713cd93fb 100644 --- a/frontend/projects/setup-wizard/src/app/modals/cifs-modal/cifs-modal.page.ts +++ b/frontend/projects/setup-wizard/src/app/modals/cifs-modal/cifs-modal.page.ts @@ -1,6 +1,14 @@ import { Component } from '@angular/core' -import { AlertController, LoadingController, ModalController } from '@ionic/angular' -import { ApiService, CifsBackupTarget, EmbassyOSRecoveryInfo } from 'src/app/services/api/api.service' +import { + AlertController, + LoadingController, + ModalController, +} from '@ionic/angular' +import { + ApiService, + CifsBackupTarget, + EmbassyOSRecoveryInfo, +} from 'src/app/services/api/api.service' import { PasswordPage } from '../password/password.page' @Component({ @@ -17,18 +25,18 @@ export class CifsModal { password: '', } - constructor ( + constructor( private readonly modalController: ModalController, private readonly apiService: ApiService, private readonly loadingCtrl: LoadingController, private readonly alertCtrl: AlertController, - ) { } + ) {} - cancel () { + cancel() { this.modalController.dismiss() } - async submit (): Promise { + async submit(): Promise { const loader = await this.loadingCtrl.create({ spinner: 'lines', message: 'Connecting to shared folder...', @@ -38,23 +46,30 @@ export class CifsModal { try { const embassyOS = await this.apiService.verifyCifs(this.cifs) + + await loader.dismiss() + const is02x = embassyOS.version.startsWith('0.2') if (is02x) { - this.modalController.dismiss({ - cifs: this.cifs, - }, 'success') + this.modalController.dismiss( + { + cifs: this.cifs, + }, + 'success', + ) } else { this.presentModalPassword(embassyOS) } } catch (e) { + await loader.dismiss() this.presentAlertFailed() - } finally { - loader.dismiss() } } - private async presentModalPassword (embassyOS: EmbassyOSRecoveryInfo): Promise { + private async presentModalPassword( + embassyOS: EmbassyOSRecoveryInfo, + ): Promise { const target: CifsBackupTarget = { ...this.cifs, mountable: true, @@ -68,19 +83,23 @@ export class CifsModal { }) modal.onDidDismiss().then(res => { if (res.role === 'success') { - this.modalController.dismiss({ - cifs: this.cifs, - recoveryPassword: res.data.password, - }, 'success') + this.modalController.dismiss( + { + cifs: this.cifs, + recoveryPassword: res.data.password, + }, + 'success', + ) } }) await modal.present() } - private async presentAlertFailed (): Promise { + private async presentAlertFailed(): Promise { const alert = await this.alertCtrl.create({ header: 'Connection Failed', - message: 'Unable to connect to shared folder. Ensure (1) target computer is connected to LAN, (2) target folder is being shared, and (3) hostname, path, and credentials are accurate.', + message: + 'Unable to connect to shared folder. Ensure (1) target computer is connected to LAN, (2) target folder is being shared, and (3) hostname, path, and credentials are accurate.', buttons: ['OK'], }) alert.present() diff --git a/frontend/projects/ui/src/app/app/global/services/update-toast.service.ts b/frontend/projects/ui/src/app/app/global/services/update-toast.service.ts index d4f262a82..5b06ce76f 100644 --- a/frontend/projects/ui/src/app/app/global/services/update-toast.service.ts +++ b/frontend/projects/ui/src/app/app/global/services/update-toast.service.ts @@ -45,23 +45,43 @@ export class UpdateToastService extends Observable { super(subscriber => this.stream$.subscribe(subscriber)) } + LOADER: LoadingOptions = { + spinner: 'lines', + message: 'Restarting...', + } + + TOAST: ToastOptions = { + header: 'EOS download complete!', + message: + 'Restart your Embassy for these updates to take effect. It can take several minutes to come back online.', + position: 'bottom', + duration: 0, + cssClass: 'success-toast', + buttons: [ + { + side: 'start', + icon: 'close', + handler: () => true, + }, + { + side: 'end', + text: 'Restart', + handler: () => { + this.restart() + }, + }, + ], + } private async showToast() { await this.updateToast?.dismiss() - this.updateToast = await this.toastCtrl.create(TOAST) - this.updateToast.buttons?.push({ - side: 'end', - text: 'Restart', - handler: () => { - this.restart() - }, - }) + this.updateToast = await this.toastCtrl.create(this.TOAST) await this.updateToast.present() } private async restart(): Promise { - const loader = await this.loadingCtrl.create(LOADER) + const loader = await this.loadingCtrl.create(this.LOADER) await loader.present() @@ -74,24 +94,3 @@ export class UpdateToastService extends Observable { } } } - -const LOADER: LoadingOptions = { - spinner: 'lines', - message: 'Restarting...', -} - -const TOAST: ToastOptions = { - header: 'EOS download complete!', - message: - 'Restart your Embassy for these updates to take effect. It can take several minutes to come back online.', - position: 'bottom', - duration: 0, - cssClass: 'success-toast', - buttons: [ - { - side: 'start', - icon: 'close', - handler: () => true, - }, - ], -} diff --git a/frontend/projects/ui/src/app/app/snek/snek.directive.ts b/frontend/projects/ui/src/app/app/snek/snek.directive.ts index f1d826236..3e8cd327e 100644 --- a/frontend/projects/ui/src/app/app/snek/snek.directive.ts +++ b/frontend/projects/ui/src/app/app/snek/snek.directive.ts @@ -32,8 +32,8 @@ export class SnekDirective { if (data?.highScore > highScore) { const loader = await this.loadingCtrl.create({ - spinner: 'lines', - message: 'Saving High Score...', + message: 'Saving high score...', + backdropDismiss: true, }) await loader.present() diff --git a/frontend/projects/ui/src/app/components/app-wizard/app-wizard.component.html b/frontend/projects/ui/src/app/components/app-wizard/app-wizard.component.html index b9a9d450b..9618ff366 100644 --- a/frontend/projects/ui/src/app/components/app-wizard/app-wizard.component.html +++ b/frontend/projects/ui/src/app/components/app-wizard/app-wizard.component.html @@ -66,22 +66,30 @@ - + - Dismiss + Dismiss - Continue + {{ + currentIndex < swiper.slides.length - 2 + ? 'Continue' + : params.submitBtn + }} diff --git a/frontend/projects/ui/src/app/components/app-wizard/app-wizard.component.ts b/frontend/projects/ui/src/app/components/app-wizard/app-wizard.component.ts index 8ced2fb3e..f88d92afb 100644 --- a/frontend/projects/ui/src/app/components/app-wizard/app-wizard.component.ts +++ b/frontend/projects/ui/src/app/components/app-wizard/app-wizard.component.ts @@ -27,6 +27,7 @@ export class AppWizardComponent { action: WizardAction title: string slides: SlideDefinition[] + submitBtn: string version?: string } @@ -76,7 +77,6 @@ export class AppWizardComponent { } setError(e: any) { - console.log(e) this.error = e } diff --git a/frontend/projects/ui/src/app/components/app-wizard/notes/notes.component.html b/frontend/projects/ui/src/app/components/app-wizard/notes/notes.component.html index 8d521d0c8..f3bf63e23 100644 --- a/frontend/projects/ui/src/app/components/app-wizard/notes/notes.component.html +++ b/frontend/projects/ui/src/app/components/app-wizard/notes/notes.component.html @@ -7,7 +7,7 @@ {{ v.version }} -
+

diff --git a/frontend/projects/ui/src/app/components/app-wizard/wizard-defs.ts b/frontend/projects/ui/src/app/components/app-wizard/wizard-defs.ts index e4fb16894..001ee5115 100644 --- a/frontend/projects/ui/src/app/components/app-wizard/wizard-defs.ts +++ b/frontend/projects/ui/src/app/components/app-wizard/wizard-defs.ts @@ -63,6 +63,7 @@ export class WizardDefs { title, version, slides: slides.filter(exists), + submitBtn: 'Begin Update', } } @@ -110,6 +111,7 @@ export class WizardDefs { title, version, slides: slides.filter(exists), + submitBtn: 'Begin Update', } } @@ -160,6 +162,7 @@ export class WizardDefs { title, version, slides: slides.filter(exists), + submitBtn: 'Begin Downgrade', } } @@ -199,6 +202,7 @@ export class WizardDefs { action: 'uninstall', title, slides: slides.filter(exists), + submitBtn: 'Uninstall Anyway', } } @@ -228,6 +232,7 @@ export class WizardDefs { action: 'stop', title, slides: slides.filter(exists), + submitBtn: 'Stop Anyway', } } @@ -261,6 +266,7 @@ export class WizardDefs { action: 'configure', title, slides: slides.filter(exists), + submitBtn: 'Configure Anyway', } } } diff --git a/frontend/projects/ui/src/app/components/status/status.component.html b/frontend/projects/ui/src/app/components/status/status.component.html index 2f42db493..b77b7cebe 100644 --- a/frontend/projects/ui/src/app/components/status/status.component.html +++ b/frontend/projects/ui/src/app/components/status/status.component.html @@ -14,7 +14,7 @@ rendering.display === PR[PS.Stopping].display && (sigtermTimeout | durationToSeconds) > 30 " - >This may take a while.this may take a while diff --git a/frontend/projects/ui/src/app/modals/app-config/app-config.page.html b/frontend/projects/ui/src/app/modals/app-config/app-config.page.html index 40cf050b6..28d72273d 100644 --- a/frontend/projects/ui/src/app/modals/app-config/app-config.page.html +++ b/frontend/projects/ui/src/app/modals/app-config/app-config.page.html @@ -107,19 +107,21 @@ > Save Close diff --git a/frontend/projects/ui/src/app/modals/app-config/app-config.page.ts b/frontend/projects/ui/src/app/modals/app-config/app-config.page.ts index 35170172e..16593a491 100644 --- a/frontend/projects/ui/src/app/modals/app-config/app-config.page.ts +++ b/frontend/projects/ui/src/app/modals/app-config/app-config.page.ts @@ -121,7 +121,7 @@ export class AppConfigPage { async dismiss() { if (this.configForm?.dirty) { - await this.presentAlertUnsaved() + this.presentAlertUnsaved() } else { this.modalCtrl.dismiss() } diff --git a/frontend/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.html b/frontend/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.html index 8fdb13794..4382b908a 100644 --- a/frontend/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.html +++ b/frontend/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.html @@ -20,13 +20,23 @@ Ready to restore

- Unavailable. {{ option.title }} is already installed. + Unavailable. {{ option.title }} is already installed.

- Unavailable. Backup was made on a newer version of EmbassyOS. + Unavailable. Backup was made on a newer version of + EmbassyOS.

- + @@ -34,7 +44,13 @@ - + Restore Selected diff --git a/frontend/projects/ui/src/app/modals/enum-list/enum-list.page.html b/frontend/projects/ui/src/app/modals/enum-list/enum-list.page.html index 660562bf1..e31202a87 100644 --- a/frontend/projects/ui/src/app/modals/enum-list/enum-list.page.html +++ b/frontend/projects/ui/src/app/modals/enum-list/enum-list.page.html @@ -1,26 +1,30 @@ - + {{ spec.name }} + - - {{ spec.name }} - - - - {{ selectAll ? 'All' : 'None' }} - - + + + + {{ selectAll ? 'All' : 'None' }} + + + {{ spec.spec['value-names'][option.key] }} - + @@ -28,7 +32,12 @@ - + Done diff --git a/frontend/projects/ui/src/app/modals/os-welcome/os-welcome.page.html b/frontend/projects/ui/src/app/modals/os-welcome/os-welcome.page.html index dd27c2ef1..c7f245298 100644 --- a/frontend/projects/ui/src/app/modals/os-welcome/os-welcome.page.html +++ b/frontend/projects/ui/src/app/modals/os-welcome/os-welcome.page.html @@ -90,7 +90,12 @@
- + Begin
diff --git a/frontend/projects/ui/src/app/modals/snake/snake.page.html b/frontend/projects/ui/src/app/modals/snake/snake.page.html index fbe8988f6..30e79de0d 100644 --- a/frontend/projects/ui/src/app/modals/snake/snake.page.html +++ b/frontend/projects/ui/src/app/modals/snake/snake.page.html @@ -15,9 +15,14 @@ High Score: {{ highScore }} - Byeeeeeee! + Save and Quit +
diff --git a/frontend/projects/ui/src/app/pages/apps-routes/app-list/app-list-icon/app-list-icon.component.scss b/frontend/projects/ui/src/app/pages/apps-routes/app-list/app-list-icon/app-list-icon.component.scss index 0a8e75789..a78ebb826 100644 --- a/frontend/projects/ui/src/app/pages/apps-routes/app-list/app-list-icon/app-list-icon.component.scss +++ b/frontend/projects/ui/src/app/pages/apps-routes/app-list/app-list-icon/app-list-icon.component.scss @@ -1,7 +1,6 @@ .bulb { position: absolute !important; - left: 9px !important; - top: 8px !important; + top: 6px !important; height: 14px; width: 14px; border-radius: 100%; @@ -10,7 +9,6 @@ .warning-icon { position: absolute !important; - left: 6px !important; top: 6px !important; font-size: 12px; border-radius: 100%; @@ -21,7 +19,6 @@ .spinner { position: absolute !important; - left: 6px !important; top: 6px !important; width: 18px; } diff --git a/frontend/projects/ui/src/app/pages/server-routes/marketplaces/marketplaces.page.ts b/frontend/projects/ui/src/app/pages/server-routes/marketplaces/marketplaces.page.ts index d9ef79a99..35c43704a 100644 --- a/frontend/projects/ui/src/app/pages/server-routes/marketplaces/marketplaces.page.ts +++ b/frontend/projects/ui/src/app/pages/server-routes/marketplaces/marketplaces.page.ts @@ -12,19 +12,10 @@ import { ValueSpecObject } from 'src/app/pkg-config/config-types' import { GenericFormPage } from 'src/app/modals/generic-form/generic-form.page' import { PatchDbService } from '../../../services/patch-db/patch-db.service' import { v4 } from 'uuid' -import { - UIData, - UIMarketplaceData, -} from '../../../services/patch-db/data-model' +import { UIMarketplaceData } from '../../../services/patch-db/data-model' import { ConfigService } from '../../../services/config.service' import { MarketplaceService } from 'src/app/services/marketplace.service' -import { - distinctUntilChanged, - finalize, - first, - map, - startWith, -} from 'rxjs/operators' +import { distinctUntilChanged, finalize, first } from 'rxjs/operators' type Marketplaces = { id: string | undefined @@ -55,11 +46,8 @@ export class MarketplacesPage { ngOnInit() { this.patch - .watch$('ui') - .pipe( - map((ui: UIData) => ui.marketplace), - distinctUntilChanged(), - ) + .watch$('ui', 'marketplace') + .pipe(distinctUntilChanged()) .subscribe((mp: UIMarketplaceData | undefined) => { let marketplaces: Marketplaces = [ { @@ -114,8 +102,7 @@ export class MarketplacesPage { async presentAction(id: string = '') { // no need to view actions if is selected marketplace - if (!id || id === this.patch.getData().ui.marketplace?.['selected-id']) - return + if (id === this.patch.getData().ui.marketplace?.['selected-id']) return const buttons: ActionSheetButton[] = [ { diff --git a/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts b/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts index 8043b8c65..2b6cdf075 100644 --- a/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts +++ b/frontend/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts @@ -16,6 +16,7 @@ import { WizardDefs } from 'src/app/components/app-wizard/wizard-defs' import { exists, isEmptyObject, ErrorToastService } from '@start9labs/shared' import { EOSService } from 'src/app/services/eos.service' import { LocalStorageService } from 'src/app/services/local-storage.service' +import { RecoveredPackageDataEntry } from 'src/app/services/patch-db/data-model' @Component({ selector: 'server-show', @@ -47,7 +48,7 @@ export class ServerShowPage { this.patch .watch$('recovered-packages') .pipe(filter(exists), take(1)) - .subscribe(rps => { + .subscribe((rps: { [id: string]: RecoveredPackageDataEntry }) => { this.hasRecoveredPackage = !isEmptyObject(rps) }) } @@ -233,16 +234,36 @@ export class ServerShowPage { try { const updateAvailable = await this.eosService.getEOS() + + await loader.dismiss() + if (updateAvailable) { this.updateEos() + } else { + this.presentAlertLatest() } } catch (e: any) { + await loader.dismiss() this.errToast.present(e) - } finally { - loader.dismiss() } } + async presentAlertLatest() { + const alert = await this.alertCtrl.create({ + header: 'Up to date!', + message: 'You are on the latest version of EmbassyOS.', + buttons: [ + { + text: 'OK', + role: 'cancel', + cssClass: 'enter-click', + }, + ], + cssClass: 'alert-success-message', + }) + alert.present() + } + settings: ServerSettings = { Backups: [ { @@ -332,8 +353,8 @@ export class ServerShowPage { disabled: of(false), }, { - title: 'Manually install a service', - description: `Install a service by drag n' drop`, + title: 'Manually Install A Service', + description: `Install a service by drag and drop`, icon: 'push-outline', action: () => this.navCtrl.navigateForward(['sideload'], { diff --git a/frontend/projects/ui/src/app/pages/server-routes/sideload/sideload.page.html b/frontend/projects/ui/src/app/pages/server-routes/sideload/sideload.page.html index 3929a8ad0..e320fae31 100644 --- a/frontend/projects/ui/src/app/pages/server-routes/sideload/sideload.page.html +++ b/frontend/projects/ui/src/app/pages/server-routes/sideload/sideload.page.html @@ -3,7 +3,7 @@ - Manually install a service + Manually Install A Service
diff --git a/frontend/projects/ui/src/app/services/api/api.fixures.ts b/frontend/projects/ui/src/app/services/api/api.fixures.ts index dbd974159..3b5ca1972 100644 --- a/frontend/projects/ui/src/app/services/api/api.fixures.ts +++ b/frontend/projects/ui/src/app/services/api/api.fixures.ts @@ -5,6 +5,7 @@ import { PackageDataEntry, PackageMainStatus, PackageState, + ServerStatusInfo, } from 'src/app/services/patch-db/data-model' import { Log, @@ -18,6 +19,11 @@ import { BTC_ICON, LND_ICON, PROXY_ICON } from './api-icons' import { MarketplacePkg } from '@start9labs/marketplace' export module Mock { + export const ServerUpdated: ServerStatusInfo = { + 'backing-up': false, + 'update-progress': null, + updated: true, + } export const MarketplaceEos: RR.GetMarketplaceEOSRes = { version: '0.3.2', headline: 'Our biggest release ever.', diff --git a/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts b/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts index 625e7e160..5711f4ca7 100644 --- a/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts +++ b/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts @@ -187,7 +187,6 @@ export class MockApiService extends ApiService { value: initialProgress, }, ] - return this.withRevision(patch, 'updating') } @@ -860,6 +859,16 @@ export class MockApiService extends ApiService { }, ] this.updateMock(patch4) + // set patch indicating update is complete + await pauseFor(100) + const patch6 = [ + { + op: PatchOp.REPLACE, + path: '/server-info/status-info', + value: Mock.ServerUpdated, + }, + ] + this.updateMock(patch6) }, 1000) } diff --git a/frontend/projects/ui/src/app/services/api/mock-patch.ts b/frontend/projects/ui/src/app/services/api/mock-patch.ts index 8cd05cd07..bc700f6df 100644 --- a/frontend/projects/ui/src/app/services/api/mock-patch.ts +++ b/frontend/projects/ui/src/app/services/api/mock-patch.ts @@ -444,7 +444,7 @@ export const mockPatchData: DataModel = { 'donation-url': null, alerts: { install: null, - uninstall: undefined, + uninstall: null, restore: 'If this is a duplicate instance of the same LND node, you may loose your funds.', start: 'Starting LND is good for your health.', diff --git a/frontend/projects/ui/src/app/services/eos.service.ts b/frontend/projects/ui/src/app/services/eos.service.ts index 53943937c..3446c1d59 100644 --- a/frontend/projects/ui/src/app/services/eos.service.ts +++ b/frontend/projects/ui/src/app/services/eos.service.ts @@ -4,6 +4,7 @@ import { MarketplaceEOS } from 'src/app/services/api/api.types' import { ApiService } from 'src/app/services/api/embassy-api.service' import { Emver } from '@start9labs/shared' import { PatchDbService } from 'src/app/services/patch-db/patch-db.service' +import { switchMap, take } from 'rxjs/operators' @Injectable({ providedIn: 'root', diff --git a/frontend/projects/ui/src/app/services/marketplace.service.ts b/frontend/projects/ui/src/app/services/marketplace.service.ts index 46b04e28f..52f4d00d3 100644 --- a/frontend/projects/ui/src/app/services/marketplace.service.ts +++ b/frontend/projects/ui/src/app/services/marketplace.service.ts @@ -12,13 +12,11 @@ import { ApiService } from 'src/app/services/api/embassy-api.service' import { ConfigService } from 'src/app/services/config.service' import { ServerInfo, - UIData, UIMarketplaceData, } from 'src/app/services/patch-db/data-model' import { PatchDbService } from 'src/app/services/patch-db/patch-db.service' import { catchError, - distinctUntilChanged, filter, map, shareReplay, @@ -34,11 +32,7 @@ export class MarketplaceService extends AbstractMarketplaceService { private readonly altMarketplaceData$: Observable< UIMarketplaceData | undefined - > = this.patch.watch$('ui').pipe( - map((ui: UIData) => ui.marketplace), - distinctUntilChanged(), - shareReplay({ bufferSize: 1, refCount: true }), - ) + > = this.patch.watch$('ui', 'marketplace').pipe(shareReplay()) private readonly marketplace$ = this.altMarketplaceData$.pipe( map(data => this.toMarketplace(data)), @@ -46,7 +40,7 @@ export class MarketplaceService extends AbstractMarketplaceService { private readonly serverInfo$: Observable = this.patch .watch$('server-info') - .pipe(take(1), shareReplay({ bufferSize: 1, refCount: true })) + .pipe(take(1), shareReplay()) private readonly categories$: Observable = this.marketplace$.pipe( switchMap(({ url }) => @@ -57,6 +51,7 @@ export class MarketplaceService extends AbstractMarketplaceService { ), ), map(({ categories }) => categories), + shareReplay(), ) private readonly pkg$: Observable = @@ -79,7 +74,7 @@ export class MarketplaceService extends AbstractMarketplaceService { return of([]) }), - shareReplay({ bufferSize: 1, refCount: true }), + shareReplay(), ) constructor( diff --git a/frontend/projects/ui/src/app/services/patch-db/data-model.ts b/frontend/projects/ui/src/app/services/patch-db/data-model.ts index 0d5e94d40..8eca23da2 100644 --- a/frontend/projects/ui/src/app/services/patch-db/data-model.ts +++ b/frontend/projects/ui/src/app/services/patch-db/data-model.ts @@ -52,15 +52,17 @@ export interface ServerInfo { 'lan-address': Url 'tor-address': Url 'unread-notification-count': number - 'status-info': { - 'backing-up': boolean - updated: boolean - 'update-progress': { size: number | null; downloaded: number } | null - } + 'status-info': ServerStatusInfo 'eos-version-compat': string 'password-hash': string } +export interface ServerStatusInfo { + 'backing-up': boolean + updated: boolean + 'update-progress': { size: number | null; downloaded: number } | null +} + export enum ServerStatus { Running = 'running', Updated = 'updated', diff --git a/frontend/projects/ui/src/styles.scss b/frontend/projects/ui/src/styles.scss index 5573723f8..70250ed65 100644 --- a/frontend/projects/ui/src/styles.scss +++ b/frontend/projects/ui/src/styles.scss @@ -60,6 +60,10 @@ $subheader-height: 48px; } } +.btn-128 { + min-width: 128px; +} + .subheader-padding { --padding-top: #{$subheader-height} + 10px; } diff --git a/frontend/registries.json b/frontend/registries.json index 07170e1d2..755f63edc 100644 --- a/frontend/registries.json +++ b/frontend/registries.json @@ -5,10 +5,10 @@ }, "beta": { "url": "https://beta-registry-0-3.start9labs.com", - "name": "Embassy Marketplace (Beta)" + "name": "Beta Marketplace" }, "alpha": { "url": "https://alpha-registry-0-3.start9labs.com", - "name": "Embassy Marketplace (Alpha)" + "name": "Alpha Marketplace" } }