diff --git a/ui/src/app/pages/apps-routes/app-list/app-list.page.html b/ui/src/app/pages/apps-routes/app-list/app-list.page.html index 0c7b945e2..3df3efa78 100644 --- a/ui/src/app/pages/apps-routes/app-list/app-list.page.html +++ b/ui/src/app/pages/apps-routes/app-list/app-list.page.html @@ -10,7 +10,7 @@ diff --git a/ui/src/app/pages/apps-routes/app-list/app-list.page.ts b/ui/src/app/pages/apps-routes/app-list/app-list.page.ts index 19a3daab0..c6036df60 100644 --- a/ui/src/app/pages/apps-routes/app-list/app-list.page.ts +++ b/ui/src/app/pages/apps-routes/app-list/app-list.page.ts @@ -18,13 +18,12 @@ export class AppListPage { pkgs: readonly PackageDataEntry[] = [] recoveredPkgs: readonly RecoveredInfo[] = [] order: readonly string[] = [] - loading = true reordering = false constructor ( private readonly api: ApiService, - private readonly patch: PatchDbService, private readonly destroy$: DestroyService, + public readonly patch: PatchDbService, ) { } get empty (): boolean { @@ -42,7 +41,6 @@ export class AppListPage { this.pkgs = pkgs this.recoveredPkgs = recoveredPkgs this.order = order - this.loading = false // set order in UI DB if there were unknown packages if (order.length < pkgs.length) { diff --git a/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html b/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html index 63d4ad2ca..ae05b6511 100644 --- a/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html +++ b/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html @@ -7,127 +7,136 @@ -

Embassy Marketplace

- - - - - - - - - - - - -
- - - -
+ -
-
+ + +

Embassy Marketplace

- - -
- + + + + + + + + + + + +
+ + + +
+ +
+
+ + + +
+ + {{ cat }} + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
- {{ cat }} - -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - -
-

All services are up to date!

-
- - - - - - - - -

Now Available...

-

Embassy OS {{ marketplaceService.eos.version }}

-

{{ marketplaceService.eos.headline }}

-
-
-
- - - - - - -

{{ pkg.manifest.title }}

-

{{ pkg.manifest.description.short }}

- -

- Installed - Update Available -

-

- - Installing - {{ progress.totalProgress < 99 ? progress.totalProgress + '%' : 'finalizing' }} - -

-

- - Removing - - -

-
- -

Not Installed

-
-
-
-
-
-
+

All services are up to date!

+
+ + + + + + + + +

Now Available...

+

Embassy OS {{ marketplaceService.eos.version }}

+

{{ marketplaceService.eos.headline }}

+
+
+
+ + + + + + +

{{ pkg.manifest.title }}

+

{{ pkg.manifest.description.short }}

+ +

+ Installed + Update Available +

+

+ + Installing + {{ progress.totalProgress < 99 ? progress.totalProgress + '%' : 'finalizing' }} + +

+

+ + Removing + + +

+
+ +

Not Installed

+
+
+
+
+
+
+
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 73faab194..80a5ac0d2 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 @@ -9,8 +9,9 @@ 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 { exists, isEmptyObject } from 'src/app/util/misc.util' import { Router } from '@angular/router' +import { filter, first } from 'rxjs/operators' const defaultOps = { isCaseSensitive: false, @@ -57,15 +58,18 @@ export class MarketplaceListPage { private readonly modalCtrl: ModalController, private readonly errToast: ErrorToastService, private readonly wizardBaker: WizardBaker, - private readonly patch: PatchDbService, private readonly alertCtrl: AlertController, private readonly router: Router, + public readonly patch: PatchDbService, public readonly marketplaceService: MarketplaceService, ) { } async ngOnInit () { this.subs = [ - this.patch.watch$('package-data').subscribe(pkgs => { + this.patch.watch$('package-data') + .pipe( + filter((data) => exists(data) && !isEmptyObject(data)), + ).subscribe(pkgs => { this.localPkgs = pkgs Object.values(this.localPkgs).forEach(pkg => { pkg['install-progress'] = { ...pkg['install-progress'] } @@ -76,23 +80,30 @@ export class MarketplaceListPage { }), ] - try { - if (!this.marketplaceService.pkgs.length) { - await this.marketplaceService.load() + this.patch.watch$('server-info') + .pipe( + filter((data) => exists(data) && !isEmptyObject(data)), + first(), + ).subscribe(async _ => { + try { + if (!this.marketplaceService.pkgs.length) { + await this.marketplaceService.load() + } + + // category should start as first item in array + // remove here then add at beginning + const filterdCategories = this.marketplaceService.data.categories.filter(cat => this.category !== cat) + this.categories = [this.category, 'updates'].concat(filterdCategories).concat(['all']) + + this.filterPkgs() + + } catch (e) { + this.errToast.present(e) + } finally { + this.loading = false } + }) - // category should start as first item in array - // remove here then add at beginning - const filterdCategories = this.marketplaceService.data.categories.filter(cat => this.category !== cat) - this.categories = [this.category, 'updates'].concat(filterdCategories).concat(['all']) - - this.filterPkgs() - - } catch (e) { - this.errToast.present(e) - } finally { - this.loading = false - } } ngAfterViewInit () { 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 53233b9c1..4ef1fdf0b 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 @@ -1,6 +1,7 @@ - {{ patch.data.ui.name || "Embassy-" + patch.data['server-info'].id }} + Loading + {{ patch.data.ui.name || "Embassy-" + patch.data['server-info'].id }} @@ -8,29 +9,38 @@ - -
- {{ cat.key }} - - - -

{{ button.title }}

-

{{ button.description }}

-

- - - Last Backup: {{ patch.data['server-info']['last-backup'] ? (patch.data['server-info']['last-backup'] | date: 'short') : 'never' }} - - - - - Backing up + + + + + + +

+ {{ cat.key }} + + + +

{{ button.title }}

+

{{ button.description }}

+

+ + + Last Backup: {{ patch.data['server-info']['last-backup'] ? (patch.data['server-info']['last-backup'] | date: 'short') : 'never' }} - - -

-
-
-
- + + + + Backing up + + + +

+
+
+
+
+
\ No newline at end of file diff --git a/ui/src/app/services/patch-db/patch-db.service.ts b/ui/src/app/services/patch-db/patch-db.service.ts index 9f0f1db62..c3d4dfebf 100644 --- a/ui/src/app/services/patch-db/patch-db.service.ts +++ b/ui/src/app/services/patch-db/patch-db.service.ts @@ -10,7 +10,7 @@ import { tap, withLatestFrom, } from 'rxjs/operators' -import { pauseFor } from 'src/app/util/misc.util' +import { isEmptyObject, pauseFor } from 'src/app/util/misc.util' import { ApiService } from '../api/embassy-api.service' import { AuthService } from '../auth.service' import { DataModel } from './data-model' @@ -48,6 +48,10 @@ export class PatchDbService { return this.patchDb.store.cache.data } + get loaded (): boolean { + return this.patchDb?.store?.cache?.data && !isEmptyObject(this.patchDb.store.cache.data) + } + constructor ( @Inject(PATCH_SOURCE) private readonly wsSource: Source, @Inject(PATCH_SOURCE) private readonly pollSource: Source,