in services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts [170:206]
private checkQuoteUsed(): void {
if (!this.storage.getBillingQuoteUsed( )) {
this.healthStatusService.getQuotaStatus().pipe(take(1)).subscribe((params: Quota) => {
let checkQuotaAlert = '';
const exceedProjects = [], informProjects = [];
Object.keys(params.projectQuotas).forEach(key => {
if (params.projectQuotas[key] > this.quotesLimit && params.projectQuotas[key] < 100) {
informProjects.push(key);
} else if (params.projectQuotas[key] >= 100) {
exceedProjects.push(key);
}
});
if (informProjects.length > 0 && exceedProjects.length === 0) checkQuotaAlert = 'project_quota';
if (params.totalQuotaUsed >= this.quotesLimit && params.totalQuotaUsed < 100) checkQuotaAlert = 'total_quota';
if (exceedProjects.length > 0 && informProjects.length === 0) checkQuotaAlert = 'project_exceed';
if (informProjects.length > 0 && exceedProjects.length > 0) checkQuotaAlert = 'project_inform_and_exceed';
if (params.totalQuotaUsed >= this.quotesLimit && params.totalQuotaUsed < 100 && exceedProjects.length > 0) {
checkQuotaAlert = 'total_quota_and_project_exceed';
}
if (params.totalQuotaUsed >= this.quotesLimit && params.totalQuotaUsed < 100
&& informProjects.length > 0 && exceedProjects.length > 0) checkQuotaAlert = 'total_quota_and_project_inform_and_exceed';
if (Number(params.totalQuotaUsed) >= 100) checkQuotaAlert = 'total_exceed';
if (checkQuotaAlert === '') {
this.storage.setBillingQuoteUsed('informed');
} else {
this.storage.setBillingQuoteUsed('');
}
if (this.dialog.openDialogs.length > 0 || this.dialog.openDialogs.length > 0) return;
checkQuotaAlert && this.emitQuotes(checkQuotaAlert, params.totalQuotaUsed, exceedProjects, informProjects);
});
}
}