mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
Disable view in marketplace button when side-loaded (#1471)
Disble view in marketplace button when side-loaded
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
button
|
||||
detail
|
||||
(click)="button.action()"
|
||||
[disabled]="button.disabled"
|
||||
>
|
||||
<ion-icon slot="start" [name]="button.icon"></ion-icon>
|
||||
<ion-label>
|
||||
|
||||
@@ -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<void> {
|
||||
const url = manifest['donation-url']
|
||||
if (url) {
|
||||
|
||||
Reference in New Issue
Block a user