Skip to content

Commit a87ca33

Browse files
authored
Merge branch 'main' into customSelect-forwardRef-warning
2 parents 8fafb25 + 0784aba commit a87ca33

File tree

39 files changed

+382
-153
lines changed

39 files changed

+382
-153
lines changed

client/packages/lowcoder/src/pages/setting/theme/themeConstant.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export const themeTemplateList = [
3030
borderRadius: "4px",
3131
chart: JSON.stringify(ChartTheme, null, 2),
3232
gridColumns: "24", //Added By Aqib Mirza
33+
margin: "3px",
34+
padding: "3px",
3335
},
3436
},
3537
{
@@ -45,6 +47,8 @@ export const themeTemplateList = [
4547
borderRadius: "4px",
4648
chart: JSON.stringify(ChartYellowTheme, null, 2),
4749
gridColumns: "24", //Added By Aqib Mirza
50+
margin: "3px",
51+
padding: "3px",
4852
},
4953
},
5054
{
@@ -60,6 +64,8 @@ export const themeTemplateList = [
6064
borderRadius: "4px",
6165
chart: JSON.stringify(ChartGreenTheme, null, 2),
6266
gridColumns: "24", //Added By Aqib Mirza
67+
margin: "3px",
68+
padding: "3px",
6369
},
6470
},
6571
];

deploy/docker/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Image can be configured by setting environment variables.
3737
| `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` |
3838
| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` |
3939
| `LOWCODER_MAX_REQUEST_SIZE` | Lowcoder max request size | `20m` |
40+
| `LOWCODER_MAX_QUERY_TIMEOUT` | Lowcoder max query timeout (in seconds) | `120` |
4041
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
4142
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |
4243
| `DEFAULT_ORGS_PER_USER` | Default maximum organizations per user | `100` |
@@ -77,6 +78,8 @@ Image can be configured by setting environment variables.
7778
| `DEFAULT_ORG_GROUP_COUNT` | Default maximum groups per organization | `100` |
7879
| `DEFAULT_ORG_APP_COUNT` | Default maximum applications per organization | `1000` |
7980
| `DEFAULT_DEVELOPER_COUNT` | Default maximum developers | `100` |
81+
| `LOWCODER_MAX_QUERY_TIMEOUT` | Lowcoder max query timeout (in seconds) | `120` |
82+
| `LOWCODER_MAX_REQUEST_SIZE` | Lowcoder max request size | `20m` |
8083

8184

8285

@@ -122,6 +125,7 @@ Image can be configured by setting environment variables.
122125
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- |
123126
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
124127
| `PGID` | ID of group of the user running services. | `9001` |
128+
| `LOWCODER_MAX_QUERY_TIMEOUT` | Lowcoder max query timeout (in seconds) | `120` |
125129
| `LOWCODER_MAX_REQUEST_SIZE` | Lowcoder max request size | `20m` |
126130
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
127131
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |

deploy/docker/docker-compose-multi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ services:
3636
MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
3737
REDIS_URL: "redis://redis:6379"
3838
LOWCODER_NODE_SERVICE_URL: "http://lowcoder-node-service:6060"
39+
LOWCODER_MAX_QUERY_TIMEOUT: 120
3940
ENABLE_USER_SIGN_UP: "true"
4041
ENCRYPTION_PASSWORD: "lowcoder.org"
4142
ENCRYPTION_SALT: "lowcoder.org"
@@ -76,6 +77,7 @@ services:
7677
PUID: "9001"
7778
PGID: "9001"
7879
LOWCODER_MAX_REQUEST_SIZE: 20m
80+
LOWCODER_MAX_QUERY_TIMEOUT: 120
7981
LOWCODER_API_SERVICE_URL: "http://lowcoder-api-service:8080"
8082
LOWCODER_NODE_SERVICE_URL: "http://lowcoder-node-service:6060"
8183
restart: unless-stopped

deploy/docker/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ services:
3838
LOWCODER_NODE_SERVICE_URL: "http://localhost:6060"
3939
# frontend parameters
4040
LOWCODER_MAX_REQUEST_SIZE: 20m
41+
LOWCODER_MAX_QUERY_TIMEOUT: 120
4142
volumes:
4243
- ./lowcoder-stacks:/lowcoder-stacks
4344
restart: unless-stopped

deploy/docker/frontend/01-update-nginx-conf.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ else
1818
ln -s /etc/nginx/nginx-http.conf /etc/nginx/nginx.conf
1919
fi;
2020

21+
sed -i "s@__LOWCODER_MAX_QUERY_TIMEOUT__@${LOWCODER_MAX_QUERY_TIMEOUT:=120}@" /etc/nginx/nginx.conf
2122
sed -i "s@__LOWCODER_MAX_REQUEST_SIZE__@${LOWCODER_MAX_REQUEST_SIZE:=20m}@" /etc/nginx/nginx.conf
2223
sed -i "s@__LOWCODER_API_SERVICE_URL__@${LOWCODER_API_SERVICE_URL:=http://localhost:8080}@" /etc/nginx/nginx.conf
2324
sed -i "s@__LOWCODER_NODE_SERVICE_URL__@${LOWCODER_NODE_SERVICE_URL:=http://localhost:6060}@" /etc/nginx/nginx.conf

deploy/docker/frontend/nginx-http.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ http {
3535
listen 3000 default_server;
3636
root /lowcoder/client;
3737

38+
proxy_connect_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
39+
proxy_send_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
40+
proxy_read_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
3841

3942
location / {
4043
try_files $uri /index.html;

deploy/docker/frontend/nginx-https.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ http {
3838
include /etc/nginx/ssl-certificate.conf;
3939
include /etc/nginx/ssl-params.conf;
4040

41+
proxy_connect_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
42+
proxy_send_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
43+
proxy_read_timeout __LOWCODER_MAX_QUERY_TIMEOUT__;
44+
4145
location / {
4246
try_files $uri /index.html;
4347

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/authentication/AuthenticationService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public interface AuthenticationService {
1010

1111
EmailAuthConfig DEFAULT_AUTH_CONFIG = new EmailAuthConfig(AuthSourceConstants.EMAIL, true, true);
1212

13-
Mono<FindAuthConfig> findAuthConfigByAuthId(String authId);
13+
Mono<FindAuthConfig> findAuthConfigByAuthId(String orgId, String authId);
1414

15-
Mono<FindAuthConfig> findAuthConfigBySource(String source);
15+
Mono<FindAuthConfig> findAuthConfigBySource(String orgId, String source);
1616

17-
Flux<FindAuthConfig> findAllAuthConfigs(boolean enableOnly);
17+
Flux<FindAuthConfig> findAllAuthConfigs(String orgId, boolean enableOnly);
1818
}

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/authentication/AuthenticationServiceImpl.java

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
package org.lowcoder.domain.authentication;
22

3-
import static org.lowcoder.sdk.exception.BizError.LOG_IN_SOURCE_NOT_SUPPORTED;
4-
import static org.lowcoder.sdk.util.ExceptionUtils.ofError;
5-
6-
import java.util.Objects;
7-
import java.util.function.Function;
8-
import java.util.stream.Collectors;
9-
3+
import lombok.extern.slf4j.Slf4j;
104
import org.lowcoder.domain.organization.service.OrganizationService;
115
import org.lowcoder.sdk.auth.AbstractAuthConfig;
126
import org.lowcoder.sdk.config.AuthProperties;
137
import org.lowcoder.sdk.config.CommonConfig;
148
import org.lowcoder.sdk.constants.WorkspaceMode;
159
import org.springframework.beans.factory.annotation.Autowired;
1610
import org.springframework.stereotype.Service;
17-
18-
import lombok.extern.slf4j.Slf4j;
1911
import reactor.core.publisher.Flux;
2012
import reactor.core.publisher.Mono;
2113

14+
import java.util.Objects;
15+
import java.util.function.Function;
16+
import java.util.stream.Collectors;
17+
18+
import static org.lowcoder.sdk.exception.BizError.LOG_IN_SOURCE_NOT_SUPPORTED;
19+
import static org.lowcoder.sdk.util.ExceptionUtils.ofError;
20+
2221
@Slf4j
2322
@Service
2423
public class AuthenticationServiceImpl implements AuthenticationService {
@@ -31,35 +30,35 @@ public class AuthenticationServiceImpl implements AuthenticationService {
3130
private AuthProperties authProperties;
3231

3332
@Override
34-
public Mono<FindAuthConfig> findAuthConfigByAuthId(String authId) {
35-
return findAuthConfig(abstractAuthConfig -> Objects.equals(authId, abstractAuthConfig.getId()));
33+
public Mono<FindAuthConfig> findAuthConfigByAuthId(String orgId, String authId) {
34+
return findAuthConfig(orgId, abstractAuthConfig -> Objects.equals(authId, abstractAuthConfig.getId()));
3635
}
3736

3837
@Override
3938
@Deprecated
40-
public Mono<FindAuthConfig> findAuthConfigBySource(String source) {
41-
return findAuthConfig(abstractAuthConfig -> Objects.equals(source, abstractAuthConfig.getSource()));
39+
public Mono<FindAuthConfig> findAuthConfigBySource(String orgId, String source) {
40+
return findAuthConfig(orgId, abstractAuthConfig -> Objects.equals(source, abstractAuthConfig.getSource()));
4241
}
4342

44-
private Mono<FindAuthConfig> findAuthConfig(Function<AbstractAuthConfig, Boolean> condition) {
45-
return findAllAuthConfigs(true)
43+
private Mono<FindAuthConfig> findAuthConfig(String orgId, Function<AbstractAuthConfig, Boolean> condition) {
44+
return findAllAuthConfigs(orgId,true)
4645
.filter(findAuthConfig -> condition.apply(findAuthConfig.authConfig()))
4746
.next()
4847
.switchIfEmpty(ofError(LOG_IN_SOURCE_NOT_SUPPORTED, "LOG_IN_SOURCE_NOT_SUPPORTED"));
4948
}
5049

5150
@Override
52-
public Flux<FindAuthConfig> findAllAuthConfigs(boolean enableOnly) {
51+
public Flux<FindAuthConfig> findAllAuthConfigs(String orgId, boolean enableOnly) {
5352
return findAllAuthConfigsByDomain()
5453
.switchIfEmpty(findAllAuthConfigsForEnterpriseMode())
55-
.switchIfEmpty(findAllAuthConfigsForSaasMode())
54+
.switchIfEmpty(findAllAuthConfigsForSaasMode(orgId))
5655
.filter(findAuthConfig -> {
5756
if (enableOnly) {
5857
return findAuthConfig.authConfig().isEnable();
5958
}
6059
return true;
6160
})
62-
.defaultIfEmpty(new FindAuthConfig(DEFAULT_AUTH_CONFIG, null));
61+
.concatWithValues(new FindAuthConfig(DEFAULT_AUTH_CONFIG, null));
6362
}
6463

6564
private Flux<FindAuthConfig> findAllAuthConfigsByDomain() {
@@ -85,10 +84,20 @@ protected Flux<FindAuthConfig> findAllAuthConfigsForEnterpriseMode() {
8584
);
8685
}
8786

88-
private Flux<FindAuthConfig> findAllAuthConfigsForSaasMode() {
87+
private Flux<FindAuthConfig> findAllAuthConfigsForSaasMode(String orgId) {
8988
if (commonConfig.getWorkspace().getMode() == WorkspaceMode.SAAS) {
90-
return Flux.fromIterable(authProperties.getAuthConfigs())
91-
.map(abstractAuthConfig -> new FindAuthConfig(abstractAuthConfig, null));
89+
90+
// Get the auth configs for the current org
91+
if(orgId != null) {
92+
return organizationService.getById(orgId)
93+
.flatMapIterable(organization ->
94+
organization.getAuthConfigs()
95+
.stream()
96+
.map(abstractAuthConfig -> new FindAuthConfig(abstractAuthConfig, organization))
97+
.collect(Collectors.toList())
98+
);
99+
}
100+
92101
}
93102
return Flux.empty();
94103
}

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/service/QueryExecutionService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.lowcoder.domain.plugin.client.DatasourcePluginClient;
1717
import org.lowcoder.domain.plugin.service.DatasourceMetaInfoService;
1818
import org.lowcoder.domain.query.util.QueryTimeoutUtils;
19+
import org.lowcoder.sdk.config.CommonConfig;
1920
import org.lowcoder.sdk.exception.BizException;
2021
import org.lowcoder.sdk.exception.PluginException;
2122
import org.lowcoder.sdk.models.QueryExecutionResult;
@@ -40,10 +41,14 @@ public class QueryExecutionService {
4041
@Autowired
4142
private DatasourcePluginClient datasourcePluginClient;
4243

44+
@Autowired
45+
private CommonConfig common;
46+
4347
public Mono<QueryExecutionResult> executeQuery(Datasource datasource, Map<String, Object> queryConfig, Map<String, Object> requestParams,
4448
String timeoutStr, QueryVisitorContext queryVisitorContext) {
4549

46-
int timeoutMs = QueryTimeoutUtils.parseQueryTimeoutMs(timeoutStr, requestParams);
50+
int timeoutMs = QueryTimeoutUtils.parseQueryTimeoutMs(timeoutStr, requestParams, common.getMaxQueryTimeout());
51+
queryConfig.putIfAbsent("timeoutMs", timeoutMs);
4752

4853
return Mono.defer(() -> {
4954
if (datasourceMetaInfoService.isJsDatasourcePlugin(datasource.getType())) {

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/util/QueryTimeoutUtils.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717
public final class QueryTimeoutUtils {
1818

1919
private static final int DEFAULT_QUERY_TIMEOUT_MILLIS = 10000;
20-
private static final int MAX_QUERY_TIMEOUT_SECONDS = 120;
2120

22-
public static int parseQueryTimeoutMs(String timeoutStr, Map<String, Object> paramMap) {
23-
return parseQueryTimeoutMs(renderMustacheString(timeoutStr, paramMap));
21+
public static int parseQueryTimeoutMs(String timeoutStr, Map<String, Object> paramMap, int maxQueryTimeout) {
22+
return parseQueryTimeoutMs(renderMustacheString(timeoutStr, paramMap), maxQueryTimeout);
2423
}
2524

2625
@VisibleForTesting
27-
public static int parseQueryTimeoutMs(String timeoutStr) {
26+
public static int parseQueryTimeoutMs(String timeoutStr, int maxQueryTimeout) {
2827
if (StringUtils.isBlank(timeoutStr)) {
2928
return DEFAULT_QUERY_TIMEOUT_MILLIS;
3029
}
@@ -44,10 +43,10 @@ public static int parseQueryTimeoutMs(String timeoutStr) {
4443
if (value < 0) {
4544
throw new PluginException(QUERY_ARGUMENT_ERROR, "INVALID_TIMEOUT_SETTING", timeoutStr);
4645
}
47-
46+
4847
int millis = convertToMs(value, unit);
49-
if (millis > Duration.ofSeconds(MAX_QUERY_TIMEOUT_SECONDS).toMillis()) {
50-
throw new PluginException(EXCEED_MAX_QUERY_TIMEOUT, "EXCEED_MAX_QUERY_TIMEOUT", MAX_QUERY_TIMEOUT_SECONDS);
48+
if (millis > Duration.ofSeconds(maxQueryTimeout).toMillis()) {
49+
throw new PluginException(EXCEED_MAX_QUERY_TIMEOUT, "EXCEED_MAX_QUERY_TIMEOUT", maxQueryTimeout);
5150
}
5251

5352
return millis;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy