Skip to content

Commit

Permalink
Merge pull request #1834 from habitat-sh/Aadesh/chef-14662-3
Browse files Browse the repository at this point in the history
fetch Current Lts excpetion handle
  • Loading branch information
sajjaphani authored Aug 6, 2024
2 parents 8a6b59b + 403a878 commit 2750719
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions components/builder-web/app/package/package/package.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ export class PackageComponent implements OnInit, OnDestroy {
this.store.dispatch(fetchOriginChannels(origin.name));
});

combineLatest(originsCurrentChannels$, target$)
combineLatest(originsCurrentChannels$)
.pipe(
takeUntil(this.isDestroyed$),
filter(([channels, target]) => channels.length > 0 && target !== undefined)
filter((channels) => channels.length > 0 )
)
.subscribe(([channel]) => {
channel.forEach((channel) => {
Expand Down Expand Up @@ -295,6 +295,10 @@ export class PackageComponent implements OnInit, OnDestroy {
}

private getLatestPlatform(target) {
if (target === undefined) {
target = 'x86_64-linux';
}

const versions = this.store.getState().packages?.versions;
if (!versions) {
return target;
Expand All @@ -305,7 +309,7 @@ export class PackageComponent implements OnInit, OnDestroy {
return target;
}

return versions[0].platforms[0];
return versions[0]?.platforms[0];
}

private fetchLatest() {
Expand All @@ -316,11 +320,15 @@ export class PackageComponent implements OnInit, OnDestroy {
}

private fetchLatestStable() {
this.store.dispatch(fetchLatestInChannel(this.origin, this.name, 'stable', this.getLatestPlatform(this.target)));
// if (this.getLatestPlatform(this.target) !== undefined) {
this.store.dispatch(fetchLatestInChannel(this.origin, this.name, 'stable', this.getLatestPlatform(this.target)));
// }
}

private fetchCurrentLts() {
this.store.dispatch(fetchLatestInChannel(this.origin, this.name, latestLTS, this.getLatestPlatform(this.target)));
if (this.getLatestPlatform(this.target) !== undefined) {
this.store.dispatch(fetchLatestInChannel(this.origin, this.name, latestLTS, this.getLatestPlatform(this.target)));
}
}

private fetchPackageSettings() {
Expand Down

0 comments on commit 2750719

Please sign in to comment.