From 9297770ef5446177c4c0bcbb362fa9fd95855183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Csneha122=E2=80=9D?= <“sneha@appsmith.com”> Date: Mon, 25 Nov 2024 10:49:05 +0530 Subject: [PATCH 1/3] chore: removed redundant page DB calls from js action creation flow --- .../ApplicationForkingServiceCEImpl.java | 3 +- .../ActionClonePageServiceCEImpl.java | 2 +- .../services/ce/LayoutActionServiceCE.java | 4 ++- .../ce/LayoutActionServiceCEImpl.java | 36 +++++++++++-------- .../services/ce/ActionServiceCE_Test.java | 2 +- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/fork/internal/ApplicationForkingServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/fork/internal/ApplicationForkingServiceCEImpl.java index c05299753f87..1689dde9a2c2 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/fork/internal/ApplicationForkingServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/fork/internal/ApplicationForkingServiceCEImpl.java @@ -314,7 +314,8 @@ public Mono> forkApplications( new AppsmithEventContext( AppsmithEventContextType .CLONE_PAGE), - Boolean.FALSE); + Boolean.FALSE, + null); }) .map(ActionDTO::getId), Mono.justOrEmpty(originalActionId)); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java index e8b71a426425..3f431f6f3959 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java @@ -54,7 +54,7 @@ public Mono cloneEntities(ClonePageMetaDTO clonePageMetaDTO) { // Indicates that source of action creation is clone page action cloneActionDTO.setSource(ActionCreationSourceTypeEnum.CLONE_PAGE); copyNestedNonNullProperties(actionDTO, cloneActionDTO); - return layoutActionService.createAction(cloneActionDTO, eventContext, isJsAction); + return layoutActionService.createAction(cloneActionDTO, eventContext, isJsAction, null); }) .then(); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java index c46abdc38a98..c1c2476c8f26 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java @@ -2,6 +2,7 @@ import com.appsmith.external.helpers.AppsmithEventContext; import com.appsmith.external.models.ActionDTO; +import com.appsmith.server.domains.NewPage; import com.appsmith.server.dtos.ActionMoveDTO; import reactor.core.publisher.Mono; @@ -23,7 +24,8 @@ public interface LayoutActionServiceCE { Mono createSingleAction(ActionDTO actionDTO, Boolean isJsAction); - Mono createAction(ActionDTO actionDTO, AppsmithEventContext eventContext, Boolean isJsAction); + Mono createAction( + ActionDTO actionDTO, AppsmithEventContext eventContext, Boolean isJsAction, NewPage newPage); Mono deleteUnpublishedAction(String id); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java index 9ddaad682f2a..e73af106df0e 100755 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java @@ -337,25 +337,30 @@ public Mono createSingleAction(ActionDTO actionDTO, Boolean isJsActio if (!StringUtils.hasLength(actionDTO.getPageId())) { return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.PAGE_ID)); } + + AclPermission aclPermission = + isJsAction ? pagePermission.getReadPermission() : pagePermission.getActionCreatePermission(); + return newPageService - .findById(actionDTO.getPageId(), pagePermission.getActionCreatePermission()) + .findById(actionDTO.getPageId(), aclPermission) .switchIfEmpty(Mono.error( new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.PAGE, actionDTO.getPageId()))) .flatMap(newPage -> { actionDTO.setBranchName(newPage.getBranchName()); - return createAction(actionDTO, isJsAction); + return createAction(actionDTO, isJsAction, newPage); }); } - protected Mono createAction(ActionDTO actionDTO, Boolean isJsAction) { + protected Mono createAction(ActionDTO actionDTO, Boolean isJsAction, NewPage newPage) { AppsmithEventContext eventContext = new AppsmithEventContext(AppsmithEventContextType.DEFAULT); - return createAction(actionDTO, eventContext, isJsAction); + return createAction(actionDTO, eventContext, isJsAction, newPage); } @Override - public Mono createAction(ActionDTO actionDTO, AppsmithEventContext eventContext, Boolean isJsAction) { + public Mono createAction( + ActionDTO actionDTO, AppsmithEventContext eventContext, Boolean isJsAction, NewPage newPage) { - return validateAndGenerateActionDomainBasedOnContext(actionDTO, isJsAction) + return validateAndGenerateActionDomainBasedOnContext(actionDTO, isJsAction, newPage) .name(VALIDATE_AND_GENERATE_ACTION_DOMAIN_BASED_ON_CONTEXT) .tap(Micrometer.observation(observationRegistry)) .flatMap(newAction -> { @@ -412,7 +417,8 @@ public Mono createAction(ActionDTO actionDTO, AppsmithEventContext ev }); } - protected Mono validateAndGenerateActionDomainBasedOnContext(ActionDTO action, boolean isJsAction) { + protected Mono validateAndGenerateActionDomainBasedOnContext( + ActionDTO action, boolean isJsAction, NewPage newPage) { if (!StringUtils.hasLength(action.getPageId())) { return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.PAGE_ID)); } @@ -421,13 +427,15 @@ protected Mono validateAndGenerateActionDomainBasedOnContext(ActionDT AclPermission aclPermission = isJsAction ? pagePermission.getReadPermission() : pagePermission.getActionCreatePermission(); - Mono pageMono = newPageService - .findById(action.getPageId(), aclPermission) - .name(GET_PAGE_BY_ID) - .tap(Micrometer.observation(observationRegistry)) - .switchIfEmpty(Mono.error( - new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.PAGE, action.getPageId()))) - .cache(); + Mono pageMono = newPage != null + ? Mono.just(newPage) + : newPageService + .findById(action.getPageId(), aclPermission) + .name(GET_PAGE_BY_ID) + .tap(Micrometer.observation(observationRegistry)) + .switchIfEmpty(Mono.error(new AppsmithException( + AppsmithError.NO_RESOURCE_FOUND, FieldName.PAGE, action.getPageId()))) + .cache(); final NewAction newAction = newActionService.generateActionDomain(action); diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java index 86d94f1b5f10..e5322a556bd7 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java @@ -1180,7 +1180,7 @@ public void testExecuteOnLoadParamOnActionCreateWithClonePageContext() { action.setDatasource(datasource); AppsmithEventContext eventContext = new AppsmithEventContext(AppsmithEventContextType.CLONE_PAGE); - Mono actionMono = layoutActionService.createAction(action, eventContext, Boolean.FALSE); + Mono actionMono = layoutActionService.createAction(action, eventContext, Boolean.FALSE, null); StepVerifier.create(actionMono) .assertNext(createdAction -> { // executeOnLoad is expected to be set to false in case of default context From 2f2d957fd6d7efcf1029018c6ad53f20007ff841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Csneha122=E2=80=9D?= <“sneha@appsmith.com”> Date: Tue, 26 Nov 2024 14:55:19 +0530 Subject: [PATCH 2/3] meta paradigm refactor added and junit test cases --- .../server/dtos/CreateActionMetaDTO.java | 18 +++++++ .../ApplicationForkingServiceCEImpl.java | 14 +++-- .../ActionClonePageServiceCEImpl.java | 6 ++- .../services/ce/LayoutActionServiceCE.java | 6 +-- .../ce/LayoutActionServiceCEImpl.java | 20 +++++--- .../services/ActionCollectionServiceTest.java | 51 ++++++++++++++++++- .../services/ce/ActionServiceCE_Test.java | 6 ++- 7 files changed, 103 insertions(+), 18 deletions(-) create mode 100644 app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/CreateActionMetaDTO.java diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/CreateActionMetaDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/CreateActionMetaDTO.java new file mode 100644 index 000000000000..667cd81e22b3 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/CreateActionMetaDTO.java @@ -0,0 +1,18 @@ +package com.appsmith.server.dtos; + +import com.appsmith.external.helpers.AppsmithEventContext; +import com.appsmith.server.domains.NewPage; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder(toBuilder = true) +public class CreateActionMetaDTO { + Boolean isJsAction; + AppsmithEventContext eventContext; + NewPage newPage; +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/fork/internal/ApplicationForkingServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/fork/internal/ApplicationForkingServiceCEImpl.java index 1689dde9a2c2..48b66a44e1b8 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/fork/internal/ApplicationForkingServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/fork/internal/ApplicationForkingServiceCEImpl.java @@ -23,6 +23,7 @@ import com.appsmith.server.domains.Workspace; import com.appsmith.server.dtos.ActionCollectionDTO; import com.appsmith.server.dtos.ApplicationImportDTO; +import com.appsmith.server.dtos.CreateActionMetaDTO; import com.appsmith.server.dtos.ForkingMetaDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.exceptions.AppsmithError; @@ -309,13 +310,16 @@ public Mono> forkApplications( actionDTO.setSource( ActionCreationSourceTypeEnum .FORK_APPLICATION); - return layoutActionService.createAction( - actionDTO, + + CreateActionMetaDTO createActionMetaDTO = + new CreateActionMetaDTO(); + createActionMetaDTO.setIsJsAction(Boolean.FALSE); + createActionMetaDTO.setEventContext( new AppsmithEventContext( AppsmithEventContextType - .CLONE_PAGE), - Boolean.FALSE, - null); + .CLONE_PAGE)); + return layoutActionService.createAction( + actionDTO, createActionMetaDTO); }) .map(ActionDTO::getId), Mono.justOrEmpty(originalActionId)); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java index 3f431f6f3959..91990d715288 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/clonepage/ActionClonePageServiceCEImpl.java @@ -7,6 +7,7 @@ import com.appsmith.server.clonepage.ClonePageServiceCE; import com.appsmith.server.domains.NewAction; import com.appsmith.server.dtos.ClonePageMetaDTO; +import com.appsmith.server.dtos.CreateActionMetaDTO; import com.appsmith.server.newactions.base.NewActionService; import com.appsmith.server.services.LayoutActionService; import com.appsmith.server.solutions.ActionPermission; @@ -54,7 +55,10 @@ public Mono cloneEntities(ClonePageMetaDTO clonePageMetaDTO) { // Indicates that source of action creation is clone page action cloneActionDTO.setSource(ActionCreationSourceTypeEnum.CLONE_PAGE); copyNestedNonNullProperties(actionDTO, cloneActionDTO); - return layoutActionService.createAction(cloneActionDTO, eventContext, isJsAction, null); + CreateActionMetaDTO createActionMetaDTO = new CreateActionMetaDTO(); + createActionMetaDTO.setIsJsAction(isJsAction); + createActionMetaDTO.setEventContext(eventContext); + return layoutActionService.createAction(cloneActionDTO, createActionMetaDTO); }) .then(); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java index c1c2476c8f26..264c910545dd 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java @@ -1,9 +1,8 @@ package com.appsmith.server.services.ce; -import com.appsmith.external.helpers.AppsmithEventContext; import com.appsmith.external.models.ActionDTO; -import com.appsmith.server.domains.NewPage; import com.appsmith.server.dtos.ActionMoveDTO; +import com.appsmith.server.dtos.CreateActionMetaDTO; import reactor.core.publisher.Mono; public interface LayoutActionServiceCE { @@ -24,8 +23,7 @@ public interface LayoutActionServiceCE { Mono createSingleAction(ActionDTO actionDTO, Boolean isJsAction); - Mono createAction( - ActionDTO actionDTO, AppsmithEventContext eventContext, Boolean isJsAction, NewPage newPage); + Mono createAction(ActionDTO actionDTO, CreateActionMetaDTO actionMetaDTO); Mono deleteUnpublishedAction(String id); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java index e73af106df0e..c48306b239cb 100755 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java @@ -13,6 +13,7 @@ import com.appsmith.server.domains.NewAction; import com.appsmith.server.domains.NewPage; import com.appsmith.server.dtos.ActionMoveDTO; +import com.appsmith.server.dtos.CreateActionMetaDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; @@ -34,6 +35,8 @@ import reactor.core.publisher.Mono; import reactor.util.function.Tuple2; +import javax.swing.*; + import static com.appsmith.external.constants.spans.ActionSpan.GET_ACTION_BY_ID; import static com.appsmith.external.constants.spans.ActionSpan.UPDATE_ACTION_BASED_ON_CONTEXT; import static com.appsmith.external.constants.spans.ActionSpan.UPDATE_SINGLE_ACTION; @@ -353,14 +356,17 @@ public Mono createSingleAction(ActionDTO actionDTO, Boolean isJsActio protected Mono createAction(ActionDTO actionDTO, Boolean isJsAction, NewPage newPage) { AppsmithEventContext eventContext = new AppsmithEventContext(AppsmithEventContextType.DEFAULT); - return createAction(actionDTO, eventContext, isJsAction, newPage); + CreateActionMetaDTO createActionMetaDTO = new CreateActionMetaDTO(); + createActionMetaDTO.setIsJsAction(isJsAction); + createActionMetaDTO.setNewPage(newPage); + createActionMetaDTO.setEventContext(eventContext); + return createAction(actionDTO, createActionMetaDTO); } @Override - public Mono createAction( - ActionDTO actionDTO, AppsmithEventContext eventContext, Boolean isJsAction, NewPage newPage) { - - return validateAndGenerateActionDomainBasedOnContext(actionDTO, isJsAction, newPage) + public Mono createAction(ActionDTO actionDTO, CreateActionMetaDTO actionMetaDTO) { + AppsmithEventContext eventContext = actionMetaDTO.getEventContext(); + return validateAndGenerateActionDomainBasedOnContext(actionDTO, actionMetaDTO) .name(VALIDATE_AND_GENERATE_ACTION_DOMAIN_BASED_ON_CONTEXT) .tap(Micrometer.observation(observationRegistry)) .flatMap(newAction -> { @@ -418,7 +424,9 @@ public Mono createAction( } protected Mono validateAndGenerateActionDomainBasedOnContext( - ActionDTO action, boolean isJsAction, NewPage newPage) { + ActionDTO action, CreateActionMetaDTO actionMetaDTO) { + Boolean isJsAction = actionMetaDTO.getIsJsAction(); + NewPage newPage = actionMetaDTO.getNewPage(); if (!StringUtils.hasLength(action.getPageId())) { return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.PAGE_ID)); } diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceTest.java index 8c0471e7e36f..37acecfeb443 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceTest.java @@ -92,7 +92,7 @@ public class ActionCollectionServiceTest { @Autowired ApplicationPageService applicationPageService; - @Autowired + @SpyBean LayoutActionService layoutActionService; @Autowired @@ -926,4 +926,53 @@ public void testDeleteActionCollection_afterApplicationPublish_clearsActionColle assertEquals(expectedMessage, error.getMessage()); }); } + + @Test + @WithUserDetails(value = "api_user") + public void testUpdateUnpublishedActionCollection_createSingleAction_fetchesPageFromDBOnlyOnce() { + Mockito.when(pluginExecutorHelper.getPluginExecutor(Mockito.any())).thenReturn(Mono.just(pluginExecutor)); + Mockito.when(pluginExecutor.getHintMessages(Mockito.any(), Mockito.any())) + .thenReturn(Mono.zip(Mono.just(new HashSet<>()), Mono.just(new HashSet<>()))); + + ActionCollectionDTO actionCollectionDTO = new ActionCollectionDTO(); + actionCollectionDTO.setName("testCollection1"); + actionCollectionDTO.setPageId(testPage.getId()); + actionCollectionDTO.setApplicationId(testApp.getId()); + actionCollectionDTO.setWorkspaceId(workspaceId); + actionCollectionDTO.setPluginId(datasource.getPluginId()); + actionCollectionDTO.setVariables(List.of(new JSValue("test", "String", "test", true))); + actionCollectionDTO.setBody("export default {\n\t\n}"); + actionCollectionDTO.setPluginType(PluginType.JS); + + // Create Js object + ActionCollectionDTO createdActionCollectionDTO = + layoutCollectionService.createCollection(actionCollectionDTO).block(); + assert createdActionCollectionDTO != null; + assert createdActionCollectionDTO.getId() != null; + String createdActionCollectionId = createdActionCollectionDTO.getId(); + + // Update JS object to create an action with same name as previously created action + ActionDTO action1 = new ActionDTO(); + action1.setName("testAction1"); + action1.setActionConfiguration(new ActionConfiguration()); + action1.getActionConfiguration().setBody("mockBody"); + action1.getActionConfiguration().setIsValid(false); + + actionCollectionDTO.setActions(List.of(action1)); + + final Mono updatedActionCollectionDTO = + layoutCollectionService.updateUnpublishedActionCollection( + createdActionCollectionId, actionCollectionDTO); + + StepVerifier.create(updatedActionCollectionDTO) + .assertNext(actionCollectionDTO1 -> { + assertEquals(createdActionCollectionId, actionCollectionDTO1.getId()); + Mockito.verify(layoutActionService, Mockito.times(1)) + .createAction( + Mockito.any(), + Mockito.argThat(createActionMetaDTO -> + createActionMetaDTO != null && createActionMetaDTO.getNewPage() != null)); + }) + .verifyComplete(); + } } diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java index e5322a556bd7..9b496524358c 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ActionServiceCE_Test.java @@ -29,6 +29,7 @@ import com.appsmith.server.dtos.ActionViewDTO; import com.appsmith.server.dtos.ApplicationAccessDTO; import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.CreateActionMetaDTO; import com.appsmith.server.dtos.LayoutDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.exceptions.AppsmithError; @@ -1180,7 +1181,10 @@ public void testExecuteOnLoadParamOnActionCreateWithClonePageContext() { action.setDatasource(datasource); AppsmithEventContext eventContext = new AppsmithEventContext(AppsmithEventContextType.CLONE_PAGE); - Mono actionMono = layoutActionService.createAction(action, eventContext, Boolean.FALSE, null); + CreateActionMetaDTO createActionMetaDTO = new CreateActionMetaDTO(); + createActionMetaDTO.setEventContext(eventContext); + createActionMetaDTO.setIsJsAction(Boolean.FALSE); + Mono actionMono = layoutActionService.createAction(action, createActionMetaDTO); StepVerifier.create(actionMono) .assertNext(createdAction -> { // executeOnLoad is expected to be set to false in case of default context From 71f0d8e3e7f821152d67149862cc68f34e502d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Csneha122=E2=80=9D?= <“sneha@appsmith.com”> Date: Fri, 29 Nov 2024 16:55:50 +0530 Subject: [PATCH 3/3] code review comments addressed --- .../services/ce/LayoutActionServiceCEImpl.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java index c48306b239cb..6eef236d4def 100755 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java @@ -35,8 +35,6 @@ import reactor.core.publisher.Mono; import reactor.util.function.Tuple2; -import javax.swing.*; - import static com.appsmith.external.constants.spans.ActionSpan.GET_ACTION_BY_ID; import static com.appsmith.external.constants.spans.ActionSpan.UPDATE_ACTION_BASED_ON_CONTEXT; import static com.appsmith.external.constants.spans.ActionSpan.UPDATE_SINGLE_ACTION; @@ -350,19 +348,15 @@ public Mono createSingleAction(ActionDTO actionDTO, Boolean isJsActio new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.PAGE, actionDTO.getPageId()))) .flatMap(newPage -> { actionDTO.setBranchName(newPage.getBranchName()); - return createAction(actionDTO, isJsAction, newPage); + AppsmithEventContext eventContext = new AppsmithEventContext(AppsmithEventContextType.DEFAULT); + CreateActionMetaDTO createActionMetaDTO = new CreateActionMetaDTO(); + createActionMetaDTO.setIsJsAction(isJsAction); + createActionMetaDTO.setNewPage(newPage); + createActionMetaDTO.setEventContext(eventContext); + return createAction(actionDTO, createActionMetaDTO); }); } - protected Mono createAction(ActionDTO actionDTO, Boolean isJsAction, NewPage newPage) { - AppsmithEventContext eventContext = new AppsmithEventContext(AppsmithEventContextType.DEFAULT); - CreateActionMetaDTO createActionMetaDTO = new CreateActionMetaDTO(); - createActionMetaDTO.setIsJsAction(isJsAction); - createActionMetaDTO.setNewPage(newPage); - createActionMetaDTO.setEventContext(eventContext); - return createAction(actionDTO, createActionMetaDTO); - } - @Override public Mono createAction(ActionDTO actionDTO, CreateActionMetaDTO actionMetaDTO) { AppsmithEventContext eventContext = actionMetaDTO.getEventContext();