mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-06 06:12:16 +00:00
fix(console): warning for actions (#6390)
* fix: warning for actions * Update console/src/assets/i18n/de.json Co-authored-by: Fabi <[email protected]> * fix i18n * Update console/src/assets/i18n/de.json * fix: translate failed action warn --------- Co-authored-by: Fabi <[email protected]> Co-authored-by: Fabienne <[email protected]>
This commit is contained in:
co-authored by
Fabi
Fabienne
parent
aca5de8e40
commit
ff651aed07
@@ -1,4 +1,4 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import {
|
||||
MatLegacyDialog as MatDialog,
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from '@angular/material/legacy-dialog';
|
||||
|
||||
import { Duration } from 'google-protobuf/google/protobuf/duration_pb';
|
||||
import { mapTo } from 'rxjs';
|
||||
import { mapTo, Subject, takeUntil } from 'rxjs';
|
||||
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
|
||||
import { Action } from 'src/app/proto/generated/zitadel/action_pb';
|
||||
import { CreateActionRequest, UpdateActionRequest } from 'src/app/proto/generated/zitadel/management_pb';
|
||||
@@ -19,15 +19,18 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
templateUrl: './add-action-dialog.component.html',
|
||||
styleUrls: ['./add-action-dialog.component.scss'],
|
||||
})
|
||||
export class AddActionDialogComponent implements OnInit {
|
||||
export class AddActionDialogComponent implements OnInit, OnDestroy {
|
||||
public id: string = '';
|
||||
|
||||
public opened$ = this.dialogRef.afterOpened().pipe(mapTo(true));
|
||||
private destroy$: Subject<void> = new Subject();
|
||||
private showAllowedToFailWarning: boolean = true;
|
||||
|
||||
public form: FormGroup = new FormGroup({
|
||||
name: new FormControl<string>('', []),
|
||||
script: new FormControl<string>('', []),
|
||||
durationInSec: new FormControl<number>(10, []),
|
||||
allowedToFail: new FormControl<boolean>(false, []),
|
||||
allowedToFail: new FormControl<boolean>(true, []),
|
||||
});
|
||||
constructor(
|
||||
private toast: ToastService,
|
||||
@@ -47,6 +50,21 @@ export class AddActionDialogComponent implements OnInit {
|
||||
});
|
||||
this.id = action.id;
|
||||
}
|
||||
|
||||
this.form.valueChanges.pipe(takeUntil(this.destroy$)).subscribe(({ allowedToFail }) => {
|
||||
if (!allowedToFail && this.showAllowedToFailWarning) {
|
||||
this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.OK',
|
||||
titleKey: 'FLOWS.ALLOWEDTOFAILWARN.TITLE',
|
||||
descriptionKey: 'FLOWS.ALLOWEDTOFAILWARN.DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
this.showAllowedToFailWarning = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -71,6 +89,11 @@ export class AddActionDialogComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
|
||||
private showUnsavedDialog(): void {
|
||||
const unsavedChangesDialogRef = this.unsavedChangesDialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user