From e11729013ffaed47632f26a8e803c9de5f785f75 Mon Sep 17 00:00:00 2001
From: Benjamin B <7598058+BBlackwo@users.noreply.github.com>
Date: Thu, 2 Jun 2022 07:20:45 +1000
Subject: [PATCH] Disable view in marketplace button when side-loaded (#1471)
Disble view in marketplace button when side-loaded
---
.../app-show-menu.component.html | 1 +
.../app-show/pipes/to-buttons.pipe.ts | 29 ++++++++++++++-----
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/frontend/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-menu/app-show-menu.component.html b/frontend/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-menu/app-show-menu.component.html
index d0537b481..0be9b2258 100644
--- a/frontend/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-menu/app-show-menu.component.html
+++ b/frontend/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-menu/app-show-menu.component.html
@@ -4,6 +4,7 @@
button
detail
(click)="button.action()"
+ [disabled]="button.disabled"
>
diff --git a/frontend/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts b/frontend/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts
index 0646e9067..bc6af0b3d 100644
--- a/frontend/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts
+++ b/frontend/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts
@@ -13,6 +13,7 @@ export interface Button {
description: string
icon: string
action: Function
+ disabled?: boolean
}
@Pipe({
@@ -86,13 +87,8 @@ export class ToButtonsPipe implements PipeTransform {
icon: 'receipt-outline',
},
// view in marketplace
- {
- action: () =>
- this.navCtrl.navigateForward([`marketplace/${pkg.manifest.id}`]),
- title: 'Marketplace',
- description: 'View service in marketplace',
- icon: 'storefront-outline',
- },
+ this.viewInMarketplaceButton(pkg),
+ // donate
{
action: () => this.donate(pkg),
title: 'Donate',
@@ -116,6 +112,25 @@ export class ToButtonsPipe implements PipeTransform {
await modal.present()
}
+ private viewInMarketplaceButton(pkg: PackageDataEntry): Button {
+ return pkg.installed?.['marketplace-url']
+ ? {
+ action: () =>
+ this.navCtrl.navigateForward([`marketplace/${pkg.manifest.id}`]),
+ title: 'Marketplace',
+ description: 'View service in marketplace',
+ icon: 'storefront-outline',
+ }
+ : {
+ disabled: true,
+ action: () => {},
+ title: 'Marketplace',
+ description:
+ 'This package has been side-loaded and is not available in the Start9 Marketplace',
+ icon: 'storefront-outline',
+ }
+ }
+
private async donate({ manifest }: PackageDataEntry): Promise {
const url = manifest['donation-url']
if (url) {