mplace service install refactor

This commit is contained in:
Drew Ansbacher
2022-02-25 09:54:48 -07:00
committed by Drew Ansbacher
parent e3b002f2dd
commit 0e82825da1
4 changed files with 9 additions and 8 deletions

View File

@@ -77,10 +77,9 @@ export class WizardBaker {
verb: 'beginning update for',
title,
executeAction: () =>
this.embassyApi.installPackage({
this.marketplaceService.installPackage({
id,
'version-spec': version ? `=${version}` : undefined,
'marketplace-url': this.marketplaceService.marketplaceUrl,
}),
},
},
@@ -203,10 +202,9 @@ export class WizardBaker {
verb: 'beginning downgrade for',
title,
executeAction: () =>
this.embassyApi.installPackage({
this.marketplaceService.installPackage({
id,
'version-spec': version ? `=${version}` : undefined,
'marketplace-url': this.marketplaceService.marketplaceUrl,
}),
},
},

View File

@@ -34,11 +34,10 @@ export class AppListRecComponent {
switchMap(({ id, version }) =>
// Mapping each installation to API request
from(
this.api.installPackage({
this.marketplaceService.installPackage({
id,
'version-spec': `>=${version}`,
'version-priority': 'min',
'marketplace-url': this.marketplaceService.marketplaceUrl,
}),
).pipe(
// Mapping operation to true/false loading indication

View File

@@ -210,10 +210,9 @@ export class MarketplaceShowPage {
loader.present()
try {
await this.embassyApi.installPackage({
await this.marketplaceService.installPackage({
id,
'version-spec': version ? `=${version}` : undefined,
'marketplace-url': this.marketplaceService.marketplaceUrl,
})
} catch (e) {
this.errToast.present(e)

View File

@@ -67,6 +67,11 @@ export class MarketplaceService {
}
}
async installPackage(req: Omit<RR.InstallPackageReq, 'marketplace-url'>) {
req['marketplace-url'] = this.marketplaceUrl
return this.api.installPackage(req as RR.InstallPackageReq)
}
async getUpdates(
localPkgs: Record<string, PackageDataEntry>,
): Promise<MarketplacePkg[]> {