From 55bf7c71daccdf40ea5a3b2b6f9be12475fd8195 Mon Sep 17 00:00:00 2001 From: Drew Ansbacher Date: Sun, 17 Oct 2021 21:01:09 -0600 Subject: [PATCH] eos dl restrictions --- .../marketplace-list/marketplace-list.page.ts | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts b/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts index 67686dfb6..73faab194 100644 --- a/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts +++ b/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts @@ -1,7 +1,7 @@ import { Component, ViewChild } from '@angular/core' import { MarketplacePkg } from 'src/app/services/api/api.types' import { wizardModal } from 'src/app/components/install-wizard/install-wizard.component' -import { IonContent, ModalController } from '@ionic/angular' +import { AlertController, IonContent, ModalController } from '@ionic/angular' import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards' import { PackageDataEntry, PackageState } from 'src/app/services/patch-db/data-model' import { Subscription } from 'rxjs' @@ -9,6 +9,8 @@ import { ErrorToastService } from 'src/app/services/error-toast.service' import { MarketplaceService } from '../marketplace.service' import { PatchDbService } from 'src/app/services/patch-db/patch-db.service' import Fuse from 'fuse.js/dist/fuse.min.js' +import { isEmptyObject } from 'src/app/util/misc.util' +import { Router } from '@angular/router' const defaultOps = { isCaseSensitive: false, @@ -42,6 +44,7 @@ export class MarketplaceListPage { @ViewChild(IonContent) content: IonContent pkgs: MarketplacePkg[] = [] + hasRecoveredPackage: boolean categories: string[] localPkgs: { [id: string]: PackageDataEntry } = { } category = 'featured' @@ -55,6 +58,8 @@ export class MarketplaceListPage { private readonly errToast: ErrorToastService, private readonly wizardBaker: WizardBaker, private readonly patch: PatchDbService, + private readonly alertCtrl: AlertController, + private readonly router: Router, public readonly marketplaceService: MarketplaceService, ) { } @@ -66,6 +71,9 @@ export class MarketplaceListPage { pkg['install-progress'] = { ...pkg['install-progress'] } }) }), + this.patch.watch$('recovered-packages').subscribe(rps => { + this.hasRecoveredPackage = !isEmptyObject(rps) + }), ] try { @@ -109,6 +117,28 @@ export class MarketplaceListPage { } async updateEos (): Promise { + if (this.hasRecoveredPackage) { + const alert = await this.alertCtrl.create({ + header: 'Cannot Update', + message: 'You cannot update EmbassyOS when you have unresolved recovered services.', + buttons: [ + { + text: 'OK', + role: 'cancel', + }, + { + text: 'Resolve', + handler: () => { + this.router.navigate(['/services/list'], { replaceUrl: true }) + }, + cssClass: 'enter-click', + }, + ], + }) + await alert.present() + return + } + const { version, headline, 'release-notes': releaseNotes } = this.marketplaceService.eos await wizardModal(