mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-05 22:52:46 +00:00
fix(console): add flow toasts (#4247)
fix: add flow toasts Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
parent
3c67c9756d
commit
e39d82c031
@ -70,6 +70,7 @@ export class ActionsComponent {
|
||||
this.mgmtService
|
||||
.clearFlow(this.flowType)
|
||||
.then((resp) => {
|
||||
this.toast.showInfo('FLOWS.FLOWCLEARED', true);
|
||||
this.loadFlow();
|
||||
})
|
||||
.catch((error: any) => {
|
||||
@ -94,6 +95,7 @@ export class ActionsComponent {
|
||||
this.mgmtService
|
||||
.setTriggerActions(req.getActionIdsList(), req.getFlowType(), req.getTriggerType())
|
||||
.then((resp) => {
|
||||
this.toast.showInfo('FLOWS.FLOWCHANGED', true);
|
||||
this.loadFlow();
|
||||
})
|
||||
.catch((error: any) => {
|
||||
|
@ -6,73 +6,57 @@ import { SetTriggerActionsRequest } from 'src/app/proto/generated/zitadel/manage
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-add-flow-dialog',
|
||||
templateUrl: './add-flow-dialog.component.html',
|
||||
styleUrls: ['./add-flow-dialog.component.scss'],
|
||||
selector: 'cnsl-add-flow-dialog',
|
||||
templateUrl: './add-flow-dialog.component.html',
|
||||
styleUrls: ['./add-flow-dialog.component.scss'],
|
||||
})
|
||||
export class AddFlowDialogComponent {
|
||||
public actions: Action.AsObject[] = [];
|
||||
public typesForSelection: FlowType[] = [
|
||||
FlowType.FLOW_TYPE_EXTERNAL_AUTHENTICATION,
|
||||
];
|
||||
public triggerTypesForSelection: TriggerType[] = [
|
||||
TriggerType.TRIGGER_TYPE_POST_AUTHENTICATION,
|
||||
TriggerType.TRIGGER_TYPE_POST_CREATION,
|
||||
TriggerType.TRIGGER_TYPE_PRE_CREATION,
|
||||
];
|
||||
|
||||
public form!: UntypedFormGroup;
|
||||
constructor(
|
||||
private toast: ToastService,
|
||||
private mgmtService: ManagementService,
|
||||
private fb: UntypedFormBuilder,
|
||||
public dialogRef: MatDialogRef<AddFlowDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) {
|
||||
this.form = this.fb.group({
|
||||
flowType: [data.flowType ? data.flowType : '', [Validators.required]],
|
||||
triggerType: [data.triggerType ? data.triggerType : '', [Validators.required]],
|
||||
actionIdsList: [data.actions ? (data.actions as Action.AsObject[]).map(a => a.id) : [], [Validators.required]],
|
||||
});
|
||||
this.getActionIds();
|
||||
}
|
||||
public actions: Action.AsObject[] = [];
|
||||
public typesForSelection: FlowType[] = [FlowType.FLOW_TYPE_EXTERNAL_AUTHENTICATION];
|
||||
public triggerTypesForSelection: TriggerType[] = [
|
||||
TriggerType.TRIGGER_TYPE_POST_AUTHENTICATION,
|
||||
TriggerType.TRIGGER_TYPE_POST_CREATION,
|
||||
TriggerType.TRIGGER_TYPE_PRE_CREATION,
|
||||
];
|
||||
|
||||
private getActionIds(): Promise<void> {
|
||||
return this.mgmtService.listActions().then(resp => {
|
||||
public form!: UntypedFormGroup;
|
||||
constructor(
|
||||
private toast: ToastService,
|
||||
private mgmtService: ManagementService,
|
||||
private fb: UntypedFormBuilder,
|
||||
public dialogRef: MatDialogRef<AddFlowDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) {
|
||||
this.form = this.fb.group({
|
||||
flowType: [data.flowType ? data.flowType : '', [Validators.required]],
|
||||
triggerType: [data.triggerType ? data.triggerType : '', [Validators.required]],
|
||||
actionIdsList: [data.actions ? (data.actions as Action.AsObject[]).map((a) => a.id) : [], [Validators.required]],
|
||||
});
|
||||
this.getActionIds();
|
||||
}
|
||||
|
||||
private getActionIds(): Promise<void> {
|
||||
return this.mgmtService
|
||||
.listActions()
|
||||
.then((resp) => {
|
||||
this.actions = resp.resultList;
|
||||
}).catch((error: any) => {
|
||||
})
|
||||
.catch((error: any) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
|
||||
public closeDialogWithSuccess(): void {
|
||||
// if (this.id) {
|
||||
// const req = new UpdateActionRequest();
|
||||
// req.setId(this.id);
|
||||
// req.setName(this.name);
|
||||
// req.setScript(this.script);
|
||||
public closeDialogWithSuccess(): void {
|
||||
const req = new SetTriggerActionsRequest();
|
||||
req.setActionIdsList(this.form.get('actionIdsList')?.value);
|
||||
req.setFlowType(this.form.get('flowType')?.value);
|
||||
req.setTriggerType(this.form.get('triggerType')?.value);
|
||||
|
||||
// const duration = new Duration();
|
||||
// duration.setNanos(0);
|
||||
// duration.setSeconds(this.durationInSec);
|
||||
|
||||
// req.setAllowedToFail(this.allowedToFail);
|
||||
|
||||
// req.setTimeout(duration)
|
||||
// this.dialogRef.close(req);
|
||||
// } else {
|
||||
const req = new SetTriggerActionsRequest();
|
||||
req.setActionIdsList(this.form.get('actionIdsList')?.value);
|
||||
req.setFlowType(this.form.get('flowType')?.value);
|
||||
req.setTriggerType(this.form.get('triggerType')?.value);
|
||||
|
||||
this.dialogRef.close(req);
|
||||
// }
|
||||
}
|
||||
this.dialogRef.close(req);
|
||||
}
|
||||
}
|
||||
|
@ -664,6 +664,8 @@
|
||||
"3": "Post Creation"
|
||||
},
|
||||
"ADDTRIGGER": "Trigger hinzufügen",
|
||||
"FLOWCHANGED": "Der Ablauf wurde geändert",
|
||||
"FLOWCLEARED": "Der Ablauf wurde zurückgesetzt",
|
||||
"TIMEOUT": "Timeout",
|
||||
"TIMEOUTINSEC": "Timeout in Sekunden",
|
||||
"ALLOWEDTOFAIL": "Allowed To Fail",
|
||||
|
@ -664,6 +664,8 @@
|
||||
"3": "Post Creation"
|
||||
},
|
||||
"ADDTRIGGER": "Add trigger",
|
||||
"FLOWCHANGED": "The flow was changed successfully",
|
||||
"FLOWCLEARED": "The flow was reset successfully",
|
||||
"TIMEOUT": "Timeout",
|
||||
"TIMEOUTINSEC": "Timeout in seconds",
|
||||
"ALLOWEDTOFAIL": "Allowed To Fail",
|
||||
|
@ -664,6 +664,8 @@
|
||||
"3": "Post création"
|
||||
},
|
||||
"ADDTRIGGER": "Ajouter un déclencheur",
|
||||
"FLOWCHANGED": "Le processus a été modifié",
|
||||
"FLOWCLEARED": "Le processus a été supprimé avec succès",
|
||||
"TIMEOUT": "Délai d'attente",
|
||||
"TIMEOUTINSEC": "Délai en secondes",
|
||||
"ALLOWEDTOFAIL": "Autorisé à échouer",
|
||||
|
@ -664,6 +664,8 @@
|
||||
"3": "Post creazione"
|
||||
},
|
||||
"ADDTRIGGER": "Aggiungi trigger",
|
||||
"FLOWCHANGED": "Il processo è stato modificato con successo.",
|
||||
"FLOWCLEARED": "Il processo è stato eliminato con successo.",
|
||||
"TIMEOUT": "Timeout",
|
||||
"TIMEOUTINSEC": "Timeout in secondi",
|
||||
"ALLOWEDTOFAIL": "Può fallire",
|
||||
@ -685,8 +687,8 @@
|
||||
"DELETE_SUCCESS": "Azione rimossa con successo."
|
||||
},
|
||||
"CLEAR": {
|
||||
"TITLE": "Flow zurücksetzen?",
|
||||
"DESCRIPTION": "Stai per cancellare un'azione. Questa azione non può essere annullata. Vuoi continuare?"
|
||||
"TITLE": "Elimina processo",
|
||||
"DESCRIPTION": "Stai per eliminare un processo. Questa azione non può essere annullata. Vuoi continuare?"
|
||||
}
|
||||
},
|
||||
"TOAST": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user