chore: Remove unused eventData (#33730)
For action creation, client sends this in `eventData` field of the request body:  But the class defined for `eventData` is this:  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:
parent
9786d9b0a5
commit
4a317603fe
|
|
@ -132,7 +132,7 @@ class ActionAPI extends API {
|
||||||
static async createAction(
|
static async createAction(
|
||||||
apiConfig: Partial<Action>,
|
apiConfig: Partial<Action>,
|
||||||
): Promise<AxiosPromise<ActionCreateUpdateResponse>> {
|
): Promise<AxiosPromise<ActionCreateUpdateResponse>> {
|
||||||
return API.post(ActionAPI.url, apiConfig);
|
return API.post(ActionAPI.url, { ...apiConfig, eventData: undefined });
|
||||||
}
|
}
|
||||||
|
|
||||||
static async fetchActions(
|
static async fetchActions(
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
@ -6,7 +6,6 @@ import com.appsmith.external.dtos.LayoutExecutableUpdateDTO;
|
||||||
import com.appsmith.external.exceptions.ErrorDTO;
|
import com.appsmith.external.exceptions.ErrorDTO;
|
||||||
import com.appsmith.external.helpers.Identifiable;
|
import com.appsmith.external.helpers.Identifiable;
|
||||||
import com.appsmith.external.models.ActionConfiguration;
|
import com.appsmith.external.models.ActionConfiguration;
|
||||||
import com.appsmith.external.models.AnalyticsInfo;
|
|
||||||
import com.appsmith.external.models.CreatorContextType;
|
import com.appsmith.external.models.CreatorContextType;
|
||||||
import com.appsmith.external.models.Datasource;
|
import com.appsmith.external.models.Datasource;
|
||||||
import com.appsmith.external.models.DefaultResources;
|
import com.appsmith.external.models.DefaultResources;
|
||||||
|
|
@ -156,11 +155,6 @@ public class ActionCE_DTO implements Identifiable, Executable {
|
||||||
@JsonView(Views.Internal.class)
|
@JsonView(Views.Internal.class)
|
||||||
DefaultResources defaultResources;
|
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)
|
@JsonView(Views.Internal.class)
|
||||||
protected Instant createdAt;
|
protected Instant createdAt;
|
||||||
|
|
||||||
|
|
@ -211,7 +205,6 @@ public class ActionCE_DTO implements Identifiable, Executable {
|
||||||
|
|
||||||
public void sanitiseToExportDBObject() {
|
public void sanitiseToExportDBObject() {
|
||||||
this.resetTransientFields();
|
this.resetTransientFields();
|
||||||
this.setEventData(null);
|
|
||||||
this.setDefaultResources(null);
|
this.setDefaultResources(null);
|
||||||
this.setUpdatedAt(null);
|
this.setUpdatedAt(null);
|
||||||
this.setCacheResponse(null);
|
this.setCacheResponse(null);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import com.appsmith.external.helpers.AppsmithEventContext;
|
||||||
import com.appsmith.external.helpers.AppsmithEventContextType;
|
import com.appsmith.external.helpers.AppsmithEventContextType;
|
||||||
import com.appsmith.external.models.ActionConfiguration;
|
import com.appsmith.external.models.ActionConfiguration;
|
||||||
import com.appsmith.external.models.ActionDTO;
|
import com.appsmith.external.models.ActionDTO;
|
||||||
import com.appsmith.external.models.AnalyticsInfo;
|
|
||||||
import com.appsmith.external.models.Datasource;
|
import com.appsmith.external.models.Datasource;
|
||||||
import com.appsmith.external.models.DatasourceConfiguration;
|
import com.appsmith.external.models.DatasourceConfiguration;
|
||||||
import com.appsmith.external.models.DatasourceStorageDTO;
|
import com.appsmith.external.models.DatasourceStorageDTO;
|
||||||
|
|
@ -1567,44 +1566,4 @@ public class ActionServiceCE_Test {
|
||||||
assertThat(savedAction.getCreatedAt()).isNotNull();
|
assertThat(savedAction.getCreatedAt()).isNotNull();
|
||||||
assertThat(savedAction.getUpdatedAt()).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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user