in desktop/src/app/components/account/details/account-cost-card/account-cost-card.component.ts [52:97]
public ngOnInit() {
const currentAccountObs = this.accountService.currentAccount.pipe(
filter((account) => {
this.isArmBatchAccount = account instanceof ArmBatchAccount;
if (account instanceof ArmBatchAccount) {
this.costMangementUrl = Constants.ExternalLinks.costManagementUrl.format(account.subscriptionId);
this._updateUsages();
} else {
this.costMangementUrl = null;
this.unsupportedSubscription = false;
}
this.changeDetector.markForCheck();
return this.isArmBatchAccount;
}),
);
const obs = combineLatest(
this.timeRange.valueChanges.pipe(startWith(this.timeRange.value)),
currentAccountObs,
).pipe(
switchMap(([timeRange, _]) => {
return this.costService.getCost(timeRange).pipe(
catchError((error) => {
if (error instanceof UsageDetailsUnsupportedSubscription) {
this.unsupportedSubscription = true;
this.changeDetector.markForCheck();
} else {
log.error("Error retrieving cost", error);
}
return of(null);
}),
);
}),
);
combineLatest(obs, this.themeService.currentTheme).pipe(
takeUntil(this._destroy),
).subscribe({
next: ([usages, theme]) => {
if (usages) {
this.unsupportedSubscription = false;
this._computeDataSets(usages, theme);
}
},
});
this._setChartOptions();
}