fetch _all_ packages and only filter the displayed ones
fetch _all_ packages and only filter the displayed ones so that old images can still grab info about their package
This commit is contained in:
parent
4a100cf9d4
commit
bffce99fb0
@ -46,23 +46,18 @@ export class CatalogService
|
|||||||
{
|
{
|
||||||
return this.httpClient.get(`./assets/data/packages.json`).pipe(map(prices =>
|
return this.httpClient.get(`./assets/data/packages.json`).pipe(map(prices =>
|
||||||
{
|
{
|
||||||
let filteredPackages: CatalogPackage[] = [];
|
packages.forEach(pkg =>
|
||||||
|
{
|
||||||
|
pkg.price = prices[pkg.id];
|
||||||
|
|
||||||
for (let pkg of packages)
|
let size = this.fileSizePipe.transform(pkg.memory * 1024 * 1024);
|
||||||
if (pkg.group === PackageGroupsEnum.Vm || pkg.group === PackageGroupsEnum.Infra)
|
[pkg.memorySize, pkg.memorySizeLabel] = size.split(' ');
|
||||||
{
|
|
||||||
pkg.price = prices[pkg.id];
|
|
||||||
|
|
||||||
let size = this.fileSizePipe.transform(pkg.memory * 1024 * 1024);
|
size = this.fileSizePipe.transform(pkg.disk * 1024 * 1024);
|
||||||
[pkg.memorySize, pkg.memorySizeLabel] = size.split(' ');
|
[pkg.diskSize, pkg.diskSizeLabel] = size.split(' ');
|
||||||
|
});
|
||||||
|
|
||||||
size = this.fileSizePipe.transform(pkg.disk * 1024 * 1024);
|
return packages;
|
||||||
[pkg.diskSize, pkg.diskSizeLabel] = size.split(' ');
|
|
||||||
|
|
||||||
filteredPackages.push(pkg);
|
|
||||||
}
|
|
||||||
|
|
||||||
return filteredPackages;
|
|
||||||
}))
|
}))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,8 @@ export class PackagesComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
this.catalogService.getPackages()
|
this.catalogService.getPackages()
|
||||||
.subscribe(response =>
|
.subscribe(response =>
|
||||||
{
|
{
|
||||||
this._packages = response;
|
this._packages = response.filter(pkg => pkg.group === PackageGroupsEnum.Vm ||
|
||||||
|
pkg.group === PackageGroupsEnum.Infra);
|
||||||
|
|
||||||
this.setPackagesByImageType();
|
this.setPackagesByImageType();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user