mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-08 15:15:12 +00:00
feat(console-v2): secret generator settings (#3619)
* secret generator, fix project grant * secret generators
This commit is contained in:
@@ -77,6 +77,8 @@ import {
|
||||
GetPreviewLabelPolicyResponse,
|
||||
GetPrivacyPolicyRequest,
|
||||
GetPrivacyPolicyResponse,
|
||||
GetSecretGeneratorRequest,
|
||||
GetSecretGeneratorResponse,
|
||||
GetSMSProviderRequest,
|
||||
GetSMSProviderResponse,
|
||||
GetSMTPConfigRequest,
|
||||
@@ -98,6 +100,8 @@ import {
|
||||
ListLoginPolicyMultiFactorsResponse,
|
||||
ListLoginPolicySecondFactorsRequest,
|
||||
ListLoginPolicySecondFactorsResponse,
|
||||
ListSecretGeneratorsRequest,
|
||||
ListSecretGeneratorsResponse,
|
||||
ListSMSProvidersRequest,
|
||||
ListSMSProvidersResponse,
|
||||
ListViewsRequest,
|
||||
@@ -174,6 +178,8 @@ import {
|
||||
UpdatePasswordComplexityPolicyResponse,
|
||||
UpdatePrivacyPolicyRequest,
|
||||
UpdatePrivacyPolicyResponse,
|
||||
UpdateSecretGeneratorRequest,
|
||||
UpdateSecretGeneratorResponse,
|
||||
UpdateSMTPConfigPasswordRequest,
|
||||
UpdateSMTPConfigPasswordResponse,
|
||||
UpdateSMTPConfigRequest,
|
||||
@@ -579,6 +585,21 @@ export class AdminService {
|
||||
return this.grpcService.admin.getFileSystemNotificationProvider(req, null).then((resp) => resp.toObject());
|
||||
}
|
||||
|
||||
/* secrets generator */
|
||||
|
||||
public listSecretGenerators(): Promise<ListSecretGeneratorsResponse.AsObject> {
|
||||
const req = new ListSecretGeneratorsRequest();
|
||||
return this.grpcService.admin.listSecretGenerators(req, null).then((resp) => resp.toObject());
|
||||
}
|
||||
|
||||
public getSecretGenerator(req: GetSecretGeneratorRequest): Promise<GetSecretGeneratorResponse.AsObject> {
|
||||
return this.grpcService.admin.getSecretGenerator(req, null).then((resp) => resp.toObject());
|
||||
}
|
||||
|
||||
public updateSecretGenerator(req: UpdateSecretGeneratorRequest): Promise<UpdateSecretGeneratorResponse.AsObject> {
|
||||
return this.grpcService.admin.updateSecretGenerator(req, null).then((resp) => resp.toObject());
|
||||
}
|
||||
|
||||
/* org iam */
|
||||
|
||||
public getCustomOrgIAMPolicy(orgId: string): Promise<GetCustomOrgIAMPolicyResponse.AsObject> {
|
||||
|
||||
@@ -1,49 +1,61 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { MatSnackBar, MatSnackBarHorizontalPosition, MatSnackBarVerticalPosition } from '@angular/material/snack-bar';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ToastService {
|
||||
constructor(
|
||||
private snackBar: MatSnackBar,
|
||||
private translate: TranslateService,
|
||||
) {}
|
||||
horizontalPosition: MatSnackBarHorizontalPosition = 'end';
|
||||
verticalPosition: MatSnackBarVerticalPosition = 'top';
|
||||
|
||||
public showInfo(message: string, i18nkey: boolean = false): void {
|
||||
if (i18nkey) {
|
||||
this.translate
|
||||
.get(message)
|
||||
.subscribe(data => {
|
||||
this.translate.get('ACTIONS.CLOSE').pipe(take(1)).subscribe(value => {
|
||||
this.showMessage(data, value, true);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.translate.get('ACTIONS.CLOSE').pipe(take(1)).subscribe(value => {
|
||||
this.showMessage(message, value, true);
|
||||
});
|
||||
}
|
||||
constructor(private snackBar: MatSnackBar, private translate: TranslateService) {}
|
||||
|
||||
public showInfo(message: string, i18nkey: boolean = false): void {
|
||||
if (i18nkey) {
|
||||
this.translate.get(message).subscribe((data) => {
|
||||
this.translate
|
||||
.get('ACTIONS.CLOSE')
|
||||
.pipe(take(1))
|
||||
.subscribe((value) => {
|
||||
this.showMessage(data, value, true);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.translate
|
||||
.get('ACTIONS.CLOSE')
|
||||
.pipe(take(1))
|
||||
.subscribe((value) => {
|
||||
this.showMessage(message, value, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public showError(grpcError: any): void {
|
||||
const { message, code, metadata } = grpcError;
|
||||
if (code !== 16) {
|
||||
this.translate.get('ACTIONS.CLOSE').pipe(take(1)).subscribe(value => {
|
||||
this.showMessage(decodeURI(message), value, false);
|
||||
});
|
||||
}
|
||||
public showError(grpcError: any): void {
|
||||
const { message, code, metadata } = grpcError;
|
||||
if (code !== 16) {
|
||||
this.translate
|
||||
.get('ACTIONS.CLOSE')
|
||||
.pipe(take(1))
|
||||
.subscribe((value) => {
|
||||
this.showMessage(decodeURI(message), value, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private showMessage(message: string, action: string, success: boolean): Observable<void> {
|
||||
const ref = this.snackBar.open(message, action, {
|
||||
duration: 4000,
|
||||
panelClass: success ? "data-e2e-success" : "data-e2e-failure"
|
||||
});
|
||||
private showMessage(message: string, action: string, success: boolean): Observable<void> {
|
||||
const ref = this.snackBar.open(message, action, {
|
||||
data: {
|
||||
message,
|
||||
},
|
||||
duration: success ? 4000 : 5000,
|
||||
panelClass: success ? 'data-e2e-success' : 'data-e2e-failure',
|
||||
horizontalPosition: this.horizontalPosition,
|
||||
verticalPosition: this.verticalPosition,
|
||||
});
|
||||
|
||||
return ref.onAction();
|
||||
}
|
||||
return ref.onAction();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user