fix moving of sub flows (#25462)

fixes: #25263

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2023-12-13 16:14:33 +01:00 committed by GitHub
parent e01827693a
commit e6b230e31b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,7 +98,7 @@ export default function FlowDetails() {
);
const executeChange = async (
ex: AuthenticationFlowRepresentation,
ex: AuthenticationFlowRepresentation | ExpandableExecution,
change: LevelChange | IndexChange,
) => {
try {
@ -111,7 +111,30 @@ export default function FlowDetails() {
});
}
try {
await adminClient.authenticationManagement.delExecution({ id });
} catch {
// skipping already deleted execution
}
if ("authenticationFlow" in ex) {
const executionFlow = ex as ExpandableExecution;
const result =
await adminClient.authenticationManagement.addFlowToFlow({
flow: change.parent?.displayName! || flow?.alias!,
alias: executionFlow.displayName!,
description: executionFlow.description!,
provider: ex.providerId!,
type: "basic-flow",
});
id = result.id!;
ex.executionList?.forEach((e, i) =>
executeChange(e, {
parent: { ...ex, id: result.id },
newIndex: i,
oldIndex: i,
}),
);
} else {
const result =
await adminClient.authenticationManagement.addExecutionToFlow({
flow: change.parent?.displayName! || flow?.alias!,
@ -129,6 +152,7 @@ export default function FlowDetails() {
id = result.id!;
}
}
const times = change.newIndex - change.oldIndex;
for (let index = 0; index < Math.abs(times); index++) {
if (times > 0) {