chore: Remove unused eventData (#33730)

For action creation, client sends this in `eventData` field of the
request body:

![shot-2024-05-26-04-50-46](https://github.com/appsmithorg/appsmith/assets/120119/b876b27f-47ec-4a00-8598-33cb92120c49)

But the class defined for `eventData` is this:

![shot-2024-05-26-04-51-03](https://github.com/appsmithorg/appsmith/assets/120119/18bf46b7-597a-4b2f-8355-1b8fad30e4ce)

Clearly isn't used, or working.


/test sanity datasource

⚠️ Note that `eventData` is actually used in the analytics data sent by
client, and that's not being removed here. We're only removing the
unused server-side support here.

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9242015567>
> Commit: 30e8f455a310b3a25cf80cb6fc21da704ac0d411
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9242015567&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->
This commit is contained in:
Shrikant Sharat Kandula 2024-05-28 09:50:12 +05:30 committed by GitHub
parent 9786d9b0a5
commit 4a317603fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1 additions and 69 deletions

View File

@ -132,7 +132,7 @@ class ActionAPI extends API {
static async createAction(
apiConfig: Partial<Action>,
): Promise<AxiosPromise<ActionCreateUpdateResponse>> {
return API.post(ActionAPI.url, apiConfig);
return API.post(ActionAPI.url, { ...apiConfig, eventData: undefined });
}
static async fetchActions(

View File

@ -1,20 +0,0 @@
package com.appsmith.external.models;
import com.appsmith.external.views.FromRequest;
import com.appsmith.external.views.Views;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.util.Map;
@Getter
@Setter
@ToString
@NoArgsConstructor
public class AnalyticsInfo {
@JsonView({Views.Public.class, FromRequest.class})
private Map<String, Object> analyticsData;
}

View File

@ -6,7 +6,6 @@ import com.appsmith.external.dtos.LayoutExecutableUpdateDTO;
import com.appsmith.external.exceptions.ErrorDTO;
import com.appsmith.external.helpers.Identifiable;
import com.appsmith.external.models.ActionConfiguration;
import com.appsmith.external.models.AnalyticsInfo;
import com.appsmith.external.models.CreatorContextType;
import com.appsmith.external.models.Datasource;
import com.appsmith.external.models.DefaultResources;
@ -156,11 +155,6 @@ public class ActionCE_DTO implements Identifiable, Executable {
@JsonView(Views.Internal.class)
DefaultResources defaultResources;
// This field will be used to store analytics data related to this specific domain object. It's been introduced in
// order to track success metrics of modules. Learn more on GitHub issue#24734
@JsonView({Views.Public.class, FromRequest.class})
AnalyticsInfo eventData;
@JsonView(Views.Internal.class)
protected Instant createdAt;
@ -211,7 +205,6 @@ public class ActionCE_DTO implements Identifiable, Executable {
public void sanitiseToExportDBObject() {
this.resetTransientFields();
this.setEventData(null);
this.setDefaultResources(null);
this.setUpdatedAt(null);
this.setCacheResponse(null);

View File

@ -6,7 +6,6 @@ import com.appsmith.external.helpers.AppsmithEventContext;
import com.appsmith.external.helpers.AppsmithEventContextType;
import com.appsmith.external.models.ActionConfiguration;
import com.appsmith.external.models.ActionDTO;
import com.appsmith.external.models.AnalyticsInfo;
import com.appsmith.external.models.Datasource;
import com.appsmith.external.models.DatasourceConfiguration;
import com.appsmith.external.models.DatasourceStorageDTO;
@ -1567,44 +1566,4 @@ public class ActionServiceCE_Test {
assertThat(savedAction.getCreatedAt()).isNotNull();
assertThat(savedAction.getUpdatedAt()).isNotNull();
}
@Test
@WithUserDetails(value = "api_user")
public void createCopyActionWithAnalyticsData_validateAnalyticsDataPersistsInResponse() {
Mockito.when(pluginExecutorHelper.getPluginExecutor(Mockito.any()))
.thenReturn(Mono.just(new MockPluginExecutor()));
ActionDTO action = new ActionDTO();
action.setName("CopyOfQuery1");
action.setPageId(testPage.getId());
action.setDatasource(datasource);
ActionConfiguration actionConfiguration = new ActionConfiguration();
actionConfiguration.setPluginSpecifiedTemplates(List.of(new Property(null, true)));
AnalyticsInfo analyticsInfo = new AnalyticsInfo();
Map<String, Object> analyticsData = new HashMap<>();
String keyOriginalActionId = "originalActionId";
String valueOriginalActionId = "xyz";
analyticsData.put(keyOriginalActionId, valueOriginalActionId);
analyticsInfo.setAnalyticsData(analyticsData);
action.setEventData(analyticsInfo);
action.setActionConfiguration(actionConfiguration);
Mono<ActionDTO> actionMono =
Mono.just(action).flatMap(action1 -> layoutActionService.createSingleAction(action1, Boolean.FALSE));
StepVerifier.create(actionMono)
.assertNext(createdAction -> {
assertThat(createdAction.getId()).isNotEmpty();
assertThat(createdAction.getName()).isEqualTo(action.getName());
assertThat(createdAction.getIsValid()).isTrue();
assertThat(createdAction
.getEventData()
.getAnalyticsData()
.get(keyOriginalActionId)
.toString()
.equalsIgnoreCase(valueOriginalActionId));
})
.verifyComplete();
}
}