Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/client/src/api/ActionAPI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,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(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -211,7 +205,6 @@ public EntityReferenceType getEntityReferenceType() {

public void sanitiseToExportDBObject() {
this.resetTransientFields();
this.setEventData(null);
this.setDefaultResources(null);
this.setUpdatedAt(null);
this.setCacheResponse(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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;
Expand Down Expand Up @@ -1567,44 +1566,4 @@ public void validateAndSaveActionToRepository_ActionDTOHasCreatedAtUpdatedAtFiel
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();
}
}