Property Pane for Widget
This commit is contained in:
parent
5a0f92c508
commit
de55ec8f8e
|
|
@ -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<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient) {
|
||||
super(accessTokenResponseClient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Authentication> authenticate(Authentication authentication) {
|
||||
boolean val = true;
|
||||
if(val) {
|
||||
return Mono.error(new Exception("something"));
|
||||
}
|
||||
return super.authenticate(authentication);
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<PropertyPaneService, PropertyPane, String> {
|
||||
public PropertyPaneController(PropertyPaneService service) {
|
||||
super(service);
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<String, List<WidgetSectionProperty>> config;
|
||||
|
||||
String configVersion;
|
||||
}
|
||||
|
|
@ -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<WidgetOption> options;
|
||||
String inputType;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package com.appsmith.server.domains;
|
||||
|
||||
public enum WidgetSectionName {
|
||||
General, Actions
|
||||
}
|
||||
|
|
@ -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<WidgetChildProperty> children;
|
||||
}
|
||||
|
|
@ -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<PropertyPane, String> {
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -127,11 +127,11 @@ public class ActionServiceImpl extends BaseService<ActionRepository, Action, Str
|
|||
|
||||
// 3. Execute the query
|
||||
return actionMono.flatMap(action -> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
package com.appsmith.server.services;
|
||||
|
||||
import com.appsmith.server.domains.PropertyPane;
|
||||
|
||||
public interface PropertyPaneService extends CrudService<PropertyPane, String> {
|
||||
}
|
||||
|
|
@ -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<PropertyPaneRepository, PropertyPane, String> implements PropertyPaneService {
|
||||
public PropertyPaneServiceImpl(Scheduler scheduler, Validator validator, MongoConverter mongoConverter, ReactiveMongoTemplate reactiveMongoTemplate, PropertyPaneRepository repository) {
|
||||
super(scheduler, validator, mongoConverter, reactiveMongoTemplate, repository);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<PropertyPane> create (PropertyPane propertyPane) {
|
||||
if (propertyPane.getId() != null) {
|
||||
return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "id"));
|
||||
}
|
||||
if (propertyPane.getConfig() != null) {
|
||||
Map<String, List<WidgetSectionProperty>> configMap = propertyPane.getConfig();
|
||||
configMap.forEach((key, sectionProperty) -> {
|
||||
List<WidgetSectionProperty> widgetSectionProperties = sectionProperty;
|
||||
for (WidgetSectionProperty widgetSectionProperty : widgetSectionProperties) {
|
||||
widgetSectionProperty.setId(new ObjectId().toString());
|
||||
List<WidgetChildProperty> 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user