mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
fix: implement flavor across the app
This commit is contained in:
@@ -521,7 +521,7 @@ export class MockApiService extends ApiService {
|
||||
versionRange: string,
|
||||
): Promise<GetPackageRes> {
|
||||
await pauseFor(2000)
|
||||
if (!versionRange) {
|
||||
if (!versionRange || versionRange === '=*') {
|
||||
return Mock.RegistryPackages[id]
|
||||
} else {
|
||||
return Mock.OtherPackageVersions[id][versionRange]
|
||||
|
||||
@@ -189,7 +189,6 @@ export class MarketplaceService implements AbstractMarketplaceService {
|
||||
this.marketplace$.pipe(
|
||||
switchMap(m => {
|
||||
const url = registryUrl || selected.url
|
||||
|
||||
const pkg = m[url]?.packages.find(
|
||||
p =>
|
||||
p.id === id &&
|
||||
@@ -197,9 +196,7 @@ export class MarketplaceService implements AbstractMarketplaceService {
|
||||
(!version || this.exver.compareExver(p.version, version) === 0),
|
||||
)
|
||||
|
||||
return !!pkg
|
||||
? of(pkg)
|
||||
: this.fetchPackage$(url, id, version, flavor)
|
||||
return pkg ? of(pkg) : this.fetchPackage$(url, id, version, flavor)
|
||||
}),
|
||||
),
|
||||
),
|
||||
@@ -229,7 +226,18 @@ export class MarketplaceService implements AbstractMarketplaceService {
|
||||
}
|
||||
|
||||
fetchInfo$(url: string): Observable<T.RegistryInfo> {
|
||||
return from(this.api.getRegistryInfo(url))
|
||||
return from(this.api.getRegistryInfo(url)).pipe(
|
||||
map(info => ({
|
||||
...info,
|
||||
categories: {
|
||||
all: {
|
||||
name: 'All',
|
||||
description: { short: 'All services', long: 'All services' },
|
||||
},
|
||||
...info.categories,
|
||||
},
|
||||
})),
|
||||
)
|
||||
}
|
||||
|
||||
fetchStatic$(
|
||||
@@ -269,7 +277,7 @@ export class MarketplaceService implements AbstractMarketplaceService {
|
||||
|
||||
convertToMarketplacePkg(
|
||||
id: string,
|
||||
version: string | null,
|
||||
version: string | null | undefined,
|
||||
flavor: string | null,
|
||||
pkgInfo: GetPackageRes,
|
||||
): MarketplacePkg {
|
||||
@@ -299,7 +307,12 @@ export class MarketplaceService implements AbstractMarketplaceService {
|
||||
this.api.getRegistryPackage(url, id, version ? `=${version}` : null),
|
||||
).pipe(
|
||||
map(pkgInfo =>
|
||||
this.convertToMarketplacePkg(id, version, flavor, pkgInfo),
|
||||
this.convertToMarketplacePkg(
|
||||
id,
|
||||
version === '*' ? null : version,
|
||||
flavor,
|
||||
pkgInfo,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user