From b16909de6182e82a4615385fa39fa9855321963d Mon Sep 17 00:00:00 2001 From: Trisha Anand Date: Thu, 5 Dec 2019 09:19:45 +0000 Subject: [PATCH] JS functions can now be stored to an action. --- .../external/models/ActionConfiguration.java | 4 ++++ .../java/com/appsmith/server/domains/PluginType.java | 2 +- .../appsmith/server/services/ActionServiceImpl.java | 12 ++++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionConfiguration.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionConfiguration.java index c76af6d312..0d4757b441 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionConfiguration.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ActionConfiguration.java @@ -48,6 +48,10 @@ public class ActionConfiguration { */ Map query; + // JS action fields + + String jsFunction; + /* * Future plugins could require more fields that are not covered above. * They will have to represented in a key-value format where the plugin diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/PluginType.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/PluginType.java index 40df104cb6..0be6f555ca 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/PluginType.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/PluginType.java @@ -1,5 +1,5 @@ package com.appsmith.server.domains; public enum PluginType { - DB, API + DB, API, JS } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ActionServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ActionServiceImpl.java index 9153c2db21..7ec3e40448 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ActionServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ActionServiceImpl.java @@ -10,6 +10,7 @@ import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.Action; import com.appsmith.server.domains.Datasource; import com.appsmith.server.domains.Plugin; +import com.appsmith.server.domains.PluginType; import com.appsmith.server.dtos.ExecuteActionDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; @@ -185,8 +186,12 @@ public class ActionServiceImpl extends BaseService datasourceMono = actionMono .flatMap(action -> { + if (action.getPluginType() == PluginType.JS) { + return Mono.error(new AppsmithException(AppsmithError.UNSUPPORTED_OPERATION)); + } if (action.getDatasourceId() != null) { return datasourceService.findById(action.getDatasourceId()); } else if (action.getDatasource() != null && action.getDatasource().getId() != null) {