diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CustomReactiveAuthenticationManager.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CustomReactiveAuthenticationManager.java deleted file mode 100644 index b6ed280bcc..0000000000 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CustomReactiveAuthenticationManager.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.appsmith.server.configurations; - -import org.springframework.security.authentication.ReactiveAuthenticationManager; -import org.springframework.security.core.Authentication; -import org.springframework.security.oauth2.client.authentication.OAuth2AuthorizationCodeReactiveAuthenticationManager; -import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest; -import org.springframework.security.oauth2.client.endpoint.ReactiveOAuth2AccessTokenResponseClient; -import reactor.core.publisher.Mono; - -//@Component -public class CustomReactiveAuthenticationManager - extends OAuth2AuthorizationCodeReactiveAuthenticationManager - implements ReactiveAuthenticationManager { - - public CustomReactiveAuthenticationManager( - ReactiveOAuth2AccessTokenResponseClient accessTokenResponseClient) { - super(accessTokenResponseClient); - } - - @Override - public Mono authenticate(Authentication authentication) { - boolean val = true; - if(val) { - return Mono.error(new Exception("something")); - } - return super.authenticate(authentication); - } -} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java index 6c305a604c..2f0baa95bf 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java @@ -7,7 +7,6 @@ import com.appsmith.server.services.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; -import org.springframework.security.config.annotation.web.servlet.configuration.WebMvcSecurityConfiguration; import org.springframework.security.config.web.server.ServerHttpSecurity; import org.springframework.security.core.userdetails.MapReactiveUserDetailsService; import org.springframework.security.core.userdetails.User; @@ -17,7 +16,6 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.reactive.CorsConfigurationSource; -import org.springframework.web.cors.reactive.CorsWebFilter; import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource; import java.util.Arrays; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/Url.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/Url.java index 89764ffef8..70dbe073b1 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/Url.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/constants/Url.java @@ -14,4 +14,5 @@ public interface Url { String USER_URL = BASE_URL + VERSION + "/users"; String APPLICATION_URL = BASE_URL + VERSION + "/applications"; String PAGE_URL = BASE_URL + VERSION + "/pages"; + String PROPERTY_URL = BASE_URL + VERSION + "/properties"; } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ActionController.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ActionController.java index e731f130e4..ff77825112 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ActionController.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ActionController.java @@ -2,10 +2,8 @@ package com.appsmith.server.controllers; import com.appsmith.server.constants.Url; import com.appsmith.server.domains.Action; -import com.appsmith.server.dtos.CommandQueryParams; import com.appsmith.server.dtos.ExecuteActionDTO; import com.appsmith.server.services.ActionService; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/BaseController.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/BaseController.java index f2a94cc7ae..784cb7719b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/BaseController.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/BaseController.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseStatus; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import javax.validation.Valid; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/PropertyPaneController.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/PropertyPaneController.java new file mode 100644 index 0000000000..84cff74674 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/PropertyPaneController.java @@ -0,0 +1,15 @@ +package com.appsmith.server.controllers; + +import com.appsmith.server.constants.Url; +import com.appsmith.server.domains.PropertyPane; +import com.appsmith.server.services.PropertyPaneService; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping(Url.PROPERTY_URL) +public class PropertyPaneController extends BaseController { + public PropertyPaneController(PropertyPaneService service) { + super(service); + } +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Action.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Action.java index dab6cdcb6a..0357a6cc9c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Action.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Action.java @@ -5,7 +5,6 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; -import org.springframework.data.mongodb.core.index.Indexed; import org.springframework.data.mongodb.core.mapping.Document; @Getter diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/PropertyPane.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/PropertyPane.java new file mode 100644 index 0000000000..ff5578d118 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/PropertyPane.java @@ -0,0 +1,22 @@ +package com.appsmith.server.domains; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.List; +import java.util.Map; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@Document +public class PropertyPane extends BaseDomain { + + Map> config; + + String configVersion; +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetChildProperty.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetChildProperty.java new file mode 100644 index 0000000000..8f7802eb22 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetChildProperty.java @@ -0,0 +1,22 @@ +package com.appsmith.server.domains; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import java.util.List; + +@Getter +@Setter +@ToString +@NoArgsConstructor +public class WidgetChildProperty { + String id; + String propertyName; + String label; + String controlType; + String placeholderText; + List options; + String inputType; +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetOption.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetOption.java new file mode 100644 index 0000000000..3a99c676ad --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetOption.java @@ -0,0 +1,15 @@ +package com.appsmith.server.domains; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@NoArgsConstructor +public class WidgetOption { + String label; + String value; +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetSectionName.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetSectionName.java new file mode 100644 index 0000000000..67dc7fb0bb --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetSectionName.java @@ -0,0 +1,5 @@ +package com.appsmith.server.domains; + +public enum WidgetSectionName { + General, Actions +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetSectionProperty.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetSectionProperty.java new file mode 100644 index 0000000000..ad2b4999c8 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/WidgetSectionProperty.java @@ -0,0 +1,18 @@ +package com.appsmith.server.domains; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import java.util.List; + +@Getter +@Setter +@ToString +@NoArgsConstructor +public class WidgetSectionProperty { + WidgetSectionName sectionName; + String id; + List children; +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/PropertyPaneRepository.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/PropertyPaneRepository.java new file mode 100644 index 0000000000..d7f944e7b0 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/PropertyPaneRepository.java @@ -0,0 +1,8 @@ +package com.appsmith.server.repositories; + +import com.appsmith.server.domains.PropertyPane; +import org.springframework.stereotype.Repository; + +@Repository +public interface PropertyPaneRepository extends BaseRepository { +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ActionService.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ActionService.java index 635011ccec..6e1081bec1 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ActionService.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ActionService.java @@ -1,7 +1,6 @@ package com.appsmith.server.services; import com.appsmith.server.domains.Action; -import com.appsmith.server.dtos.CommandQueryParams; import com.appsmith.server.dtos.ExecuteActionDTO; import reactor.core.publisher.Flux; 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 09818da001..503ec4ad6c 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 @@ -127,11 +127,11 @@ public class ActionServiceImpl extends BaseService resourceMono.zipWith(pluginExecutorMono, (resource, pluginExecutor) -> - { - log.debug("*** About to invoke the plugin**"); - // TODO: The CommandParams is being passed as null here. Move it to interfaces.CommandParams - return pluginExecutor.execute(resource.getResourceConfiguration(), action.getActionConfiguration(), executeActionDTO.getParams()); - })) + { + log.debug("*** About to invoke the plugin**"); + // TODO: The CommandParams is being passed as null here. Move it to interfaces.CommandParams + return pluginExecutor.execute(resource.getResourceConfiguration(), action.getActionConfiguration(), executeActionDTO.getParams()); + })) .flatMapIterable(Flux::toIterable); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PropertyPaneService.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PropertyPaneService.java new file mode 100644 index 0000000000..fd62caeee0 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PropertyPaneService.java @@ -0,0 +1,6 @@ +package com.appsmith.server.services; + +import com.appsmith.server.domains.PropertyPane; + +public interface PropertyPaneService extends CrudService { +} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PropertyPaneServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PropertyPaneServiceImpl.java new file mode 100644 index 0000000000..92816f5e2c --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PropertyPaneServiceImpl.java @@ -0,0 +1,57 @@ +package com.appsmith.server.services; + +import com.appsmith.server.domains.PropertyPane; +import com.appsmith.server.domains.WidgetChildProperty; +import com.appsmith.server.domains.WidgetSectionProperty; +import com.appsmith.server.exceptions.AppsmithError; +import com.appsmith.server.exceptions.AppsmithException; +import com.appsmith.server.repositories.PropertyPaneRepository; +import lombok.extern.slf4j.Slf4j; +import org.bson.types.ObjectId; +import org.springframework.data.mongodb.core.ReactiveMongoTemplate; +import org.springframework.data.mongodb.core.convert.MongoConverter; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; + +import javax.validation.Validator; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +@Slf4j +@Service +public class PropertyPaneServiceImpl extends BaseService implements PropertyPaneService { + public PropertyPaneServiceImpl(Scheduler scheduler, Validator validator, MongoConverter mongoConverter, ReactiveMongoTemplate reactiveMongoTemplate, PropertyPaneRepository repository) { + super(scheduler, validator, mongoConverter, reactiveMongoTemplate, repository); + } + + @Override + public Mono create (PropertyPane propertyPane) { + if (propertyPane.getId() != null) { + return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "id")); + } + if (propertyPane.getConfig() != null) { + Map> configMap = propertyPane.getConfig(); + configMap.forEach((key, sectionProperty) -> { + List widgetSectionProperties = sectionProperty; + for (WidgetSectionProperty widgetSectionProperty : widgetSectionProperties) { + widgetSectionProperty.setId(new ObjectId().toString()); + List widgetChildProperties = widgetSectionProperty.getChildren(); + for (WidgetChildProperty widgetChildProperty : widgetChildProperties) { + widgetChildProperty.setId(new ObjectId().toString()); + } + widgetSectionProperty.setChildren(widgetChildProperties); + } + configMap.put(key, widgetSectionProperties); + }); + propertyPane.setConfig(configMap); + } + return repository + .save(propertyPane) + .flatMap(savedPropertyPane -> { + savedPropertyPane.setConfigVersion(savedPropertyPane.getId()); + return repository.save(savedPropertyPane); + }); + } +} diff --git a/app/server/appsmith-server/src/main/resources/application-docker.properties b/app/server/appsmith-server/src/main/resources/application-docker.properties index 24d6d4a9ad..37d06304be 100644 --- a/app/server/appsmith-server/src/main/resources/application-docker.properties +++ b/app/server/appsmith-server/src/main/resources/application-docker.properties @@ -2,20 +2,16 @@ spring.data.mongodb.database=mobtools spring.data.mongodb.host=mongo spring.data.mongodb.port=27017 - logging.level.root=info logging.level.com.appsmith=debug logging.pattern.console=%X - %m%n - # JDBC Postgres properties jdbc.postgres.driver=org.postgresql.Driver jdbc.postgres.url=jdbc:postgresql://localhost/mobtools jdbc.postgres.username=postgres jdbc.postgres.password=root - #Spring security spring.security.oauth2.client.registration.google.client-id=869021686091-9b84bbf7ea683t1aaefqnmefcnmk6fq6.apps.googleusercontent.com spring.security.oauth2.client.registration.google.client-secret=9dvITt4OayEY1HfeY8bHX74p - # Accounts from specific domains are allowed to login oauth2.allowed-domains=appsmith.com \ No newline at end of file diff --git a/app/server/appsmith-server/src/main/resources/application-local.properties b/app/server/appsmith-server/src/main/resources/application-local.properties index 573b245504..af183e436b 100644 --- a/app/server/appsmith-server/src/main/resources/application-local.properties +++ b/app/server/appsmith-server/src/main/resources/application-local.properties @@ -4,20 +4,16 @@ spring.data.mongodb.host=localhost spring.data.mongodb.port=27017 #spring.data.mongodb.username= #spring.data.mongodb.password= - logging.level.root=info logging.level.com.appsmith=debug logging.pattern.console=%X - %m%n - # JDBC Postgres properties jdbc.postgres.driver=org.postgresql.Driver jdbc.postgres.url=jdbc:postgresql://localhost/mobtools jdbc.postgres.username=postgres jdbc.postgres.password=root - #Spring security spring.security.oauth2.client.registration.google.client-id=869021686091-9b84bbf7ea683t1aaefqnmefcnmk6fq6.apps.googleusercontent.com spring.security.oauth2.client.registration.google.client-secret=9dvITt4OayEY1HfeY8bHX74p - # Accounts from specific domains are allowed to login oauth2.allowed-domains=appsmith.com \ No newline at end of file diff --git a/app/server/appsmith-server/src/main/resources/application-staging.properties b/app/server/appsmith-server/src/main/resources/application-staging.properties index d986eba6ef..b8d7c99727 100644 --- a/app/server/appsmith-server/src/main/resources/application-staging.properties +++ b/app/server/appsmith-server/src/main/resources/application-staging.properties @@ -2,20 +2,16 @@ spring.data.mongodb.database=mobtools spring.data.mongodb.uri=mongodb+srv://admin:Y9PuxM52gcP3Dgfo@mobtools-test-cluster-swrsq.mongodb.net/mobtools?retryWrites=true spring.data.mongodb.authentication-database=admin - logging.level.root=info logging.level.com.appsmith=debug logging.pattern.console=%X - %m%n - # JDBC Postgres properties jdbc.postgres.driver=org.postgresql.Driver jdbc.postgres.url=jdbc:postgresql://ec2-54-247-85-251.eu-west-1.compute.amazonaws.com/d266aalso50024 jdbc.postgres.username=pornlzmggggpgk jdbc.postgres.password=09275163cd7e737baf4c210b5e8db8ed88ddb7a0ee9acc82416fd75346ea4bbb - #Spring security spring.security.oauth2.client.registration.google.client-id=869021686091-9b84bbf7ea683t1aaefqnmefcnmk6fq6.apps.googleusercontent.com spring.security.oauth2.client.registration.google.client-secret=9dvITt4OayEY1HfeY8bHX74p - # Accounts from specific domains are allowed to login oauth2.allowed-domains=appsmith.com \ No newline at end of file diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/PageServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/PageServiceTest.java index 6787330a9f..c364f76545 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/PageServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/PageServiceTest.java @@ -63,7 +63,7 @@ public class PageServiceTest { StepVerifier .create(pageMono) .expectErrorMatches(throwable -> throwable instanceof AppsmithException && - throwable.getMessage().equals(AppsmithError.INVALID_PARAMETER.getMessage(FieldName.APPLICATIONID))) + throwable.getMessage().equals(AppsmithError.INVALID_PARAMETER.getMessage(FieldName.APPLICATIONID))) .verify(); } @@ -85,7 +85,7 @@ public class PageServiceTest { .assertNext(page -> { assertThat(page).isNotNull(); assertThat(page.getId()).isNotNull(); - assertThat("PageServiceTest TestApp".equals(page.getName())); + assertThat("PageServiceTest TestApp" .equals(page.getName())); }) .verifyComplete();