Skip to content

Commit

Permalink
Merge branch 'appsmithorg:release' into fix/35949-duplicate-page-name…
Browse files Browse the repository at this point in the history
…-error-does-not-disappear
  • Loading branch information
a6hishekpandey authored Sep 17, 2024
2 parents 437bc85 + 74933fc commit 577c74b
Show file tree
Hide file tree
Showing 29 changed files with 310 additions and 512 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ jobs:
id: set_base_tag
run: |
if [[ "${{ inputs.pr }}" != 0 || "${{ github.ref_name }}" != master ]]; then
if [[ ${{ inputs.is-pg-build }} == 'true' || "${{ github.ref_name }}" == pg ]]; then
base_tag=pg
else
base_tag=release
fi
base_tag=release
else
base_tag=nightly
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@ public void stopAndLogTimeInMillis() {
log.debug("Execute time: {}, Time elapsed: {}ms", this.flow, this.watch.getTime(TimeUnit.MILLISECONDS));
}

/**
* This is a temporary function created to log stopwatch timer within the plugin package
* Due to this bug https://github.com/appsmithorg/appsmith/issues/36073 logging is not working in the plugin package
*/
public void stopAndLogTimeInMillisWithSysOut() {
if (!this.watch.isStopped()) {
this.watch.stop();
}
System.out.println(String.format(
"Execute time: %s, Time elapsed: %dms", this.flow, this.watch.getTime(TimeUnit.MILLISECONDS)));
}

public void stopTimer() {
if (!this.watch.isStopped()) {
this.watch.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,7 @@ public Mono<ActionExecutionResult> executeParameterized(
DatasourceConfiguration datasourceConfiguration,
ActionConfiguration actionConfiguration) {

String printMessage =
Thread.currentThread().getName() + ": executeParameterized() called for AmazonS3 plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": executeParameterized() called for AmazonS3 plugin.");
final Map<String, Object> formData = actionConfiguration.getFormData();
List<Map.Entry<String, String>> parameters = new ArrayList<>();

Expand Down Expand Up @@ -467,8 +465,7 @@ private Mono<ActionExecutionResult> executeCommon(
DatasourceConfiguration datasourceConfiguration,
ActionConfiguration actionConfiguration) {

String printMessage = Thread.currentThread().getName() + ": executeCommon() called for AmazonS3 plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": executeCommon() called for AmazonS3 plugin.");
final String[] query = new String[1];
Map<String, Object> requestProperties = new HashMap<>();
List<RequestParamDTO> requestParams = new ArrayList<>();
Expand Down Expand Up @@ -544,7 +541,7 @@ private Mono<ActionExecutionResult> executeCommon(
Object actionResult;
switch (s3Action) {
case LIST:
System.out.println(
log.debug(
Thread.currentThread().getName() + ": LIST action called for AmazonS3 plugin.");
String prefix = getDataValueSafelyFromFormData(formData, LIST_PREFIX, STRING_TYPE, "");
requestParams.add(new RequestParamDTO(LIST_PREFIX, prefix, null, null, null));
Expand Down Expand Up @@ -644,7 +641,7 @@ private Mono<ActionExecutionResult> executeCommon(

break;
case UPLOAD_FILE_FROM_BODY: {
System.out.println(Thread.currentThread().getName()
log.debug(Thread.currentThread().getName()
+ ": UPLOAD_FILE_FROM_BODY action called for AmazonS3 plugin.");
requestParams.add(
new RequestParamDTO(ACTION_CONFIGURATION_PATH, path, null, null, null));
Expand Down Expand Up @@ -697,7 +694,7 @@ private Mono<ActionExecutionResult> executeCommon(
break;
}
case UPLOAD_MULTIPLE_FILES_FROM_BODY: {
System.out.println(Thread.currentThread().getName()
log.debug(Thread.currentThread().getName()
+ ": UPLOAD_MULTIPLE_FILES_FROM_BODY action called for AmazonS3 plugin.");
requestParams.add(
new RequestParamDTO(ACTION_CONFIGURATION_PATH, path, null, null, null));
Expand Down Expand Up @@ -751,7 +748,7 @@ private Mono<ActionExecutionResult> executeCommon(
break;
}
case READ_FILE:
System.out.println(Thread.currentThread().getName()
log.debug(Thread.currentThread().getName()
+ ": READ_FILE action called for AmazonS3 plugin.");
requestParams.add(
new RequestParamDTO(ACTION_CONFIGURATION_PATH, path, null, null, null));
Expand All @@ -770,7 +767,7 @@ private Mono<ActionExecutionResult> executeCommon(
actionResult = Map.of("fileData", result);
break;
case DELETE_FILE:
System.out.println(Thread.currentThread().getName()
log.debug(Thread.currentThread().getName()
+ ": DELETE_FILE action called for AmazonS3 plugin.");
requestParams.add(
new RequestParamDTO(ACTION_CONFIGURATION_PATH, path, null, null, null));
Expand All @@ -783,7 +780,7 @@ private Mono<ActionExecutionResult> executeCommon(
actionResult = Map.of("status", "File deleted successfully");
break;
case DELETE_MULTIPLE_FILES:
System.out.println(Thread.currentThread().getName()
log.debug(Thread.currentThread().getName()
+ ": DELETE_MULTIPLE_FILES action called for AmazonS3 plugin.");
requestParams.add(
new RequestParamDTO(ACTION_CONFIGURATION_PATH, path, null, null, null));
Expand Down Expand Up @@ -823,7 +820,7 @@ private Mono<ActionExecutionResult> executeCommon(
ActionExecutionResult actionExecutionResult = new ActionExecutionResult();
actionExecutionResult.setBody(result);
actionExecutionResult.setIsExecutionSuccess(true);
System.out.println("In the S3 Plugin, got action execution result");
log.debug("In the S3 Plugin, got action execution result");
return Mono.just(actionExecutionResult);
})
.onErrorResume(e -> {
Expand All @@ -842,7 +839,7 @@ private Mono<ActionExecutionResult> executeCommon(
})
// Now set the request in the result to be returned to the server
.map(actionExecutionResult -> {
System.out.println(Thread.currentThread().getName()
log.debug(Thread.currentThread().getName()
+ ": Setting the actionExecutionResult for AmazonS3 plugin.");
ActionExecutionRequest actionExecutionRequest = new ActionExecutionRequest();
actionExecutionRequest.setQuery(query[0]);
Expand Down Expand Up @@ -892,8 +889,7 @@ private DeleteObjectsRequest getDeleteObjectsRequest(String bucketName, List<Str

@Override
public Mono<AmazonS3> datasourceCreate(DatasourceConfiguration datasourceConfiguration) {
String printMessage = Thread.currentThread().getName() + ": datasourceCreate() called for AmazonS3 plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": datasourceCreate() called for AmazonS3 plugin.");
try {
Class.forName(S3_DRIVER);
} catch (ClassNotFoundException e) {
Expand Down Expand Up @@ -921,17 +917,14 @@ public Mono<AmazonS3> datasourceCreate(DatasourceConfiguration datasourceConfigu

@Override
public void datasourceDestroy(AmazonS3 connection) {
String printMessage =
Thread.currentThread().getName() + ": datasourceDestroy() called for AmazonS3 plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": datasourceDestroy() called for AmazonS3 plugin.");
if (connection != null) {
Mono.fromCallable(() -> {
connection.shutdown();
return connection;
})
.onErrorResume(exception -> {
System.out.println("Error closing S3 connection.");
exception.printStackTrace();
log.error("Error closing S3 connection.", exception.getMessage());
return Mono.empty();
})
.subscribeOn(scheduler)
Expand All @@ -941,9 +934,7 @@ public void datasourceDestroy(AmazonS3 connection) {

@Override
public Set<String> validateDatasource(DatasourceConfiguration datasourceConfiguration) {
String printMessage =
Thread.currentThread().getName() + ": validateDatasource() called for AmazonS3 plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": validateDatasource() called for AmazonS3 plugin.");
Set<String> invalids = new HashSet<>();

if (datasourceConfiguration == null || datasourceConfiguration.getAuthentication() == null) {
Expand Down Expand Up @@ -1005,8 +996,7 @@ public Set<String> validateDatasource(DatasourceConfiguration datasourceConfigur

@Override
public Mono<DatasourceTestResult> testDatasource(DatasourceConfiguration datasourceConfiguration) {
String printMessage = Thread.currentThread().getName() + ": testDatasource() called for AmazonS3 plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": testDatasource() called for AmazonS3 plugin.");
if (datasourceConfiguration == null) {
return Mono.just(new DatasourceTestResult(
S3ErrorMessages.DS_AT_LEAST_ONE_MANDATORY_PARAMETER_MISSING_ERROR_MSG));
Expand All @@ -1029,7 +1019,7 @@ public Mono<DatasourceTestResult> testDatasource(DatasourceConfiguration datasou
* object with wrong credentials does not throw any exception.
* - Hence, adding a listBuckets() method call to test the connection.
*/
System.out.println(Thread.currentThread().getName()
log.debug(Thread.currentThread().getName()
+ ": listBuckets() called for AmazonS3 plugin.");
connection.listBuckets();
return new DatasourceTestResult();
Expand Down Expand Up @@ -1068,7 +1058,7 @@ private Mono<DatasourceTestResult> testGoogleCloudStorage(DatasourceConfiguratio
return datasourceCreate(datasourceConfiguration)
.flatMap(connection -> Mono.fromCallable(() -> {
connection.listObjects(defaultBucket);
System.out.println(Thread.currentThread().getName()
log.debug(Thread.currentThread().getName()
+ ": connection.listObjects() called for AmazonS3 plugin.");
return new DatasourceTestResult();
})
Expand All @@ -1095,12 +1085,11 @@ private Mono<DatasourceTestResult> testGoogleCloudStorage(DatasourceConfiguratio
public Mono<DatasourceStructure> getStructure(
AmazonS3 connection, DatasourceConfiguration datasourceConfiguration) {

String printMessage = Thread.currentThread().getName() + ": getStructure() called for AmazonS3 plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": getStructure() called for AmazonS3 plugin.");
return Mono.fromSupplier(() -> {
List<DatasourceStructure.Table> tableList;
try {
System.out.println(Thread.currentThread().getName()
log.debug(Thread.currentThread().getName()
+ ": connection.listBuckets() called for AmazonS3 plugin.");
tableList = connection.listBuckets().stream()
/* Get name of each bucket */
Expand Down Expand Up @@ -1150,9 +1139,7 @@ public Object substituteValueInInput(
Object... args) {
String jsonBody = (String) input;
Param param = (Param) args[0];
String printMessage =
Thread.currentThread().getName() + ": substituteValueInInput() called for AmazonS3 plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": substituteValueInInput() called for AmazonS3 plugin.");
return DataTypeStringUtils.jsonSmartReplacementPlaceholderWithValue(
jsonBody, value, null, insertedParams, null, param);
}
Expand Down Expand Up @@ -1198,9 +1185,8 @@ void uploadFileInS3(
@Override
public Mono<Void> sanitizeGenerateCRUDPageTemplateInfo(
List<ActionConfiguration> actionConfigurationList, Object... args) {
String printMessage = Thread.currentThread().getName()
+ ": sanitizeGenerateCRUDPageTemplateInfo() called for AmazonS3 plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName()
+ ": sanitizeGenerateCRUDPageTemplateInfo() called for AmazonS3 plugin.");
if (isEmpty(actionConfigurationList)) {
return Mono.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.appsmith.external.models.DatasourceConfiguration;
import com.appsmith.external.models.Property;
import com.external.plugins.exceptions.S3ErrorMessages;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;

import java.util.List;
Expand All @@ -26,6 +27,7 @@
import static com.external.plugins.constants.S3PluginConstants.S3_SERVICE_PROVIDER_PROPERTY_INDEX;
import static com.external.utils.DatasourceUtils.S3ServiceProvider.AMAZON;

@Slf4j
public class DatasourceUtils {

/**
Expand Down Expand Up @@ -101,7 +103,7 @@ public static S3ServiceProvider fromString(String name) throws AppsmithPluginExc
*/
public static AmazonS3ClientBuilder getS3ClientBuilder(DatasourceConfiguration datasourceConfiguration)
throws AppsmithPluginException {
System.out.println(Thread.currentThread().getName() + ": getS3ClientBuilder action called.");
log.debug(Thread.currentThread().getName() + ": getS3ClientBuilder action called.");
DBAuth authentication = (DBAuth) datasourceConfiguration.getAuthentication();
String accessKey = authentication.getUsername();
String secretKey = authentication.getPassword();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ protected AnthropicPluginExecutor(SharedConfig sharedConfig) {

@Override
public Mono<DatasourceTestResult> testDatasource(DatasourceConfiguration datasourceConfiguration) {
String printMessage = Thread.currentThread().getName() + ": testDatasource() called for Anthropic plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": testDatasource() called for Anthropic plugin.");
final ApiKeyAuth apiKeyAuth = (ApiKeyAuth) datasourceConfiguration.getAuthentication();
if (!StringUtils.hasText(apiKeyAuth.getValue())) {
return Mono.error(new AppsmithPluginException(
Expand Down Expand Up @@ -113,9 +112,7 @@ public Mono<ActionExecutionResult> executeParameterized(
DatasourceConfiguration datasourceConfiguration,
ActionConfiguration actionConfiguration) {

String printMessage =
Thread.currentThread().getName() + ": executeParameterized() called for Anthropic plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": executeParameterized() called for Anthropic plugin.");
// Get prompt from action configuration
List<Map.Entry<String, String>> parameters = new ArrayList<>();

Expand Down Expand Up @@ -254,8 +251,7 @@ private Object formatResponseBodyAsCompletionAPI(String model, byte[] response)
@Override
public Mono<TriggerResultDTO> trigger(
APIConnection connection, DatasourceConfiguration datasourceConfiguration, TriggerRequestDTO request) {
String printMessage = Thread.currentThread().getName() + ": trigger() called for Anthropic plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": trigger() called for Anthropic plugin.");
final ApiKeyAuth apiKeyAuth = (ApiKeyAuth) datasourceConfiguration.getAuthentication();
if (!StringUtils.hasText(apiKeyAuth.getValue())) {
return Mono.error(new AppsmithPluginException(
Expand Down Expand Up @@ -317,9 +313,7 @@ public Mono<TriggerResultDTO> trigger(

@Override
public Set<String> validateDatasource(DatasourceConfiguration datasourceConfiguration) {
String printMessage =
Thread.currentThread().getName() + ": validateDatasource() called for Anthropic plugin.";
System.out.println(printMessage);
log.debug(Thread.currentThread().getName() + ": validateDatasource() called for Anthropic plugin.");
return RequestUtils.validateApiKeyAuthDatasource(datasourceConfiguration);
}

Expand Down
Loading

0 comments on commit 577c74b

Please sign in to comment.