diff --git a/app/client/cypress/e2e/Regression/ServerSide/QueryPane/MySQL_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/QueryPane/MySQL_Spec.ts index 873c89ff79d1..bf1b9606359e 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/QueryPane/MySQL_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/QueryPane/MySQL_Spec.ts @@ -91,7 +91,7 @@ describe( after("Verify Deletion of the datasource", () => { dataSources.DeleteDatasourceFromWithinDS(dsName, 409); agHelper.ValidateToastMessage( - "Cannot delete datasource since it has 1 action(s) using it.", + "Cannot delete datasource since it has 1 query using it.", ); //table is 1 action }); diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index 6c90656a49d4..380c23183d8d 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -897,7 +897,7 @@ export class DataSources { this.agHelper.AssertContains( responseStatus === 200 ? "datasource deleted successfully" - : "action(s) using it", + : "Cannot delete datasource", ); }); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java index 91cc1e08a634..a8666d863d9c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java @@ -806,7 +806,9 @@ public Mono archiveById(String id) { .flatMap(objects -> { final Long actionsCount = objects.getT2(); if (actionsCount > 0) { - return Mono.error(new AppsmithException(AppsmithError.DATASOURCE_HAS_ACTIONS, actionsCount)); + String queryWord = actionsCount == 1 ? "query" : "queries"; + return Mono.error( + new AppsmithException(AppsmithError.DATASOURCE_HAS_ACTIONS, actionsCount, queryWord)); } return Mono.just(objects.getT1()); }) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java index 6e386d10f3b4..eb10c512d236 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java @@ -502,7 +502,7 @@ public enum AppsmithError { DATASOURCE_HAS_ACTIONS( 409, AppsmithErrorCode.DATASOURCE_HAS_ACTIONS.getCode(), - "Cannot delete datasource since it has {0} action(s) using it.", + "Cannot delete datasource since it has {0} {1} using it.", AppsmithErrorAction.DEFAULT, "Datasource cannot be deleted", ErrorType.BAD_REQUEST, diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java index 5744932c5d0f..4da79899dfac 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/DatasourceServiceTest.java @@ -947,7 +947,8 @@ public void deleteDatasourceWithActions() { }) .flatMap(datasource -> datasourceService.archiveById(datasource.getId())); - StepVerifier.create(datasourceMono).verifyErrorMessage(AppsmithError.DATASOURCE_HAS_ACTIONS.getMessage("1")); + StepVerifier.create(datasourceMono) + .verifyErrorMessage(AppsmithError.DATASOURCE_HAS_ACTIONS.getMessage("1", "query")); } @Test