in desktop/src/app/components/pool/details/pool-cost-card/pool-cost-card.component.ts [59:114]
public ngOnInit() {
const currentAccountObs = this.accountService.currentAccount.pipe(
filter((account) => {
this.isArmBatchAccount = account instanceof ArmBatchAccount;
if (this.isArmBatchAccount) {
this._updateUsages();
} else {
this.unsupportedSubscription = false;
}
this.changeDetector.markForCheck();
return this.isArmBatchAccount;
}),
);
const obs = combineLatest(
this.timeRange.valueChanges.pipe(
startWith(this.timeRange.value),
tap((range) => {
this.showPartialDataWarning = range.start.getTime() < partialDataDate;
this.changeDetector.markForCheck();
}),
),
currentAccountObs,
).pipe(
switchMap(([timeRange, _]: [TimeRange, ArmBatchAccount]) => {
this.loading = true;
this.changeDetector.markForCheck();
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);
}),
);
}),
tap(() => {
this.loading = false;
this.changeDetector.markForCheck();
}),
);
combineLatest(obs, this._poolId, this.themeService.currentTheme).pipe(
takeUntil(this._destroy),
).subscribe({
next: ([accountCost, poolId, theme]) => {
if (accountCost) {
this.unsupportedSubscription = false;
this._computeDataSets(accountCost.currency, poolId, accountCost.pools[poolId], theme);
}
},
});
this._setChartOptions();
}