Skip to content

Commit

Permalink
chore: replacing hard coded string (appsmithorg#25132)
Browse files Browse the repository at this point in the history
## Description
> TL;DR replacing hardcoded strings to use the same macros in EE
implementation


#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

#### How Has This Been Tested?
- [x] Manual

## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
  • Loading branch information
sondermanish authored Jul 6, 2023
1 parent 8e868b3 commit 820beae
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.appsmith.server.constants;

import com.appsmith.server.constants.ce.AnalyticsConstantsCE;

/**
* Class to store instrumentation constants only
*/
public class AnalyticsConstants extends AnalyticsConstantsCE {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.appsmith.server.constants.ce;

public class AnalyticsConstantsCE {
public static final String ENVIRONMENT_ID_SHORTNAME = "envId";
public static final String DATASOURCE_ID_SHORTNAME = "dsId";
public static final String DATASOURCE_NAME_SHORTNAME = "dsName";
public static final String DATASOURCE_IS_TEMPLATE_SHORTNAME = "dsIsTemplate";
public static final String DATASOURCE_IS_MOCK_SHORTNAME = "dsIsMock";
public static final String DATASOURCE_CREATED_AT_SHORTNAME = "dsCreatedAt";
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
import static com.appsmith.external.constants.spans.ActionSpan.ACTION_EXECUTION_REQUEST_PARSING;
import static com.appsmith.external.constants.spans.ActionSpan.ACTION_EXECUTION_SERVER_EXECUTION;
import static com.appsmith.external.helpers.DataTypeStringUtils.getDisplayDataTypes;
import static com.appsmith.server.constants.AnalyticsConstants.DATASOURCE_CREATED_AT_SHORTNAME;
import static com.appsmith.server.constants.AnalyticsConstants.DATASOURCE_ID_SHORTNAME;
import static com.appsmith.server.constants.AnalyticsConstants.DATASOURCE_IS_MOCK_SHORTNAME;
import static com.appsmith.server.constants.AnalyticsConstants.DATASOURCE_IS_TEMPLATE_SHORTNAME;
import static com.appsmith.server.constants.AnalyticsConstants.DATASOURCE_NAME_SHORTNAME;
import static com.appsmith.server.constants.AnalyticsConstants.ENVIRONMENT_ID_SHORTNAME;
import static com.appsmith.server.helpers.WidgetSuggestionHelper.getSuggestedWidgets;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
Expand Down Expand Up @@ -952,12 +958,12 @@ private Mono<ActionExecutionRequest> sendExecuteAnalyticsEvent(
}

data.putAll(Map.of(
"dsId", ObjectUtils.defaultIfNull(datasourceStorage.getDatasourceId(), ""),
"envId", ObjectUtils.defaultIfNull(datasourceStorage.getEnvironmentId(), ""),
"dsName", datasourceStorage.getName(),
"dsIsTemplate", ObjectUtils.defaultIfNull(datasourceStorage.getIsTemplate(), ""),
"dsIsMock", ObjectUtils.defaultIfNull(datasourceStorage.getIsMock(), ""),
"dsCreatedAt", dsCreatedAt
DATASOURCE_ID_SHORTNAME, ObjectUtils.defaultIfNull(datasourceStorage.getDatasourceId(), ""),
ENVIRONMENT_ID_SHORTNAME, ObjectUtils.defaultIfNull(datasourceStorage.getEnvironmentId(), ""),
DATASOURCE_NAME_SHORTNAME, datasourceStorage.getName(),
DATASOURCE_IS_TEMPLATE_SHORTNAME, ObjectUtils.defaultIfNull(datasourceStorage.getIsTemplate(), ""),
DATASOURCE_IS_MOCK_SHORTNAME, ObjectUtils.defaultIfNull(datasourceStorage.getIsMock(), ""),
DATASOURCE_CREATED_AT_SHORTNAME, dsCreatedAt
));

// Add the error message in case of erroneous execution
Expand Down

0 comments on commit 820beae

Please sign in to comment.