mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-25 16:52:17 +00:00
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
import { map, Observable, of, switchMap, tap } from 'rxjs';
|
|
import { WarnDialogComponent } from '../modules/warn-dialog/warn-dialog.component';
|
|
import { Environment } from './environment.service';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class ExhaustedService {
|
|
private isClosed = true;
|
|
|
|
constructor(private dialog: MatDialog) {}
|
|
|
|
public showExhaustedDialog(env$: Observable<Environment>) {
|
|
if (!this.isClosed) {
|
|
return of(undefined);
|
|
}
|
|
this.isClosed = false;
|
|
return this.dialog
|
|
.open(WarnDialogComponent, {
|
|
data: {
|
|
confirmKey: 'ACTIONS.CONTINUE',
|
|
titleKey: 'ERRORS.EXHAUSTED.TITLE',
|
|
descriptionKey: 'ERRORS.EXHAUSTED.DESCRIPTION',
|
|
},
|
|
disableClose: true,
|
|
width: '400px',
|
|
id: 'authenticated-requests-exhausted-dialog',
|
|
})
|
|
.afterClosed()
|
|
.pipe(
|
|
switchMap(() => env$),
|
|
tap((env) => {
|
|
// Just reload if there is no instance management url
|
|
location.href = env.instance_management_url || location.href;
|
|
}),
|
|
map(() => undefined),
|
|
);
|
|
}
|
|
}
|