From 2f16c1a1fe67a518fb46ff987a910c3689d7fb4e Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 3 Nov 2022 14:06:10 +0200 Subject: [PATCH] UI: Fixed calculate action index in other page --- .../widget/action/manage-widget-actions.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.ts b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.ts index 5b746e95bc..ad9b2d12f2 100644 --- a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.ts @@ -172,8 +172,11 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni first() ).subscribe((actions) => { const action = actions.data; - const startActionSourceIndex = action.findIndex(element => element.actionSourceId === droppedAction.actionSourceId); + let startActionSourceIndex = action.findIndex(element => element.actionSourceId === droppedAction.actionSourceId); const targetActions = this.getOrCreateTargetActions(droppedAction.actionSourceId); + if (startActionSourceIndex === 0) { + startActionSourceIndex -= targetActions.findIndex(element => element.id === action[0].id); + } moveItemInArray(targetActions, event.previousIndex - startActionSourceIndex, event.currentIndex - startActionSourceIndex); this.onActionsUpdated(); });