Skip to content

Commit e9c5fcc

Browse files
authored
Merge branch 'main' into improve_widthCalculator_and_heightCalculator
2 parents a7814e1 + 1974df2 commit e9c5fcc

File tree

20 files changed

+204
-49
lines changed

20 files changed

+204
-49
lines changed

client/packages/lowcoder-design/src/components/customSelect.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,29 @@ const SelectWrapper = styled.div<{ border?: boolean }>`
7171
}
7272
`;
7373

74-
export type CustomSelectProps = {
74+
export interface CustomSelectProps extends AntdSelectProps {
7575
children?: JSX.Element | React.ReactNode;
76-
innerRef?: React.Ref<HTMLDivElement> | undefined;
7776
border?: boolean;
7877
};
7978

80-
function CustomSelect(props: CustomSelectProps & AntdSelectProps) {
79+
interface CustomSelectInterface extends React.ForwardRefExoticComponent<
80+
CustomSelectProps & React.RefAttributes<HTMLDivElement>
81+
> {
82+
Option: any;
83+
}
84+
const CustomSelect = React.forwardRef<HTMLDivElement, CustomSelectProps>((
85+
props,
86+
ref,
87+
) => {
8188
const {
8289
children,
83-
innerRef,
8490
className,
8591
border,
8692
popupClassName = "custom-ant-select-dropdown",
8793
...restProps
8894
} = props;
8995
return (
90-
<SelectWrapper className={className} ref={innerRef} border={border}>
96+
<SelectWrapper className={className} ref={ref} border={border}>
9197
<AntdSelect
9298
popupClassName={popupClassName}
9399
popupMatchSelectWidth={false}
@@ -96,9 +102,10 @@ function CustomSelect(props: CustomSelectProps & AntdSelectProps) {
96102
>
97103
{children}
98104
</AntdSelect>
105+
<div></div>
99106
</SelectWrapper>
100107
);
101-
}
108+
}) as CustomSelectInterface;
102109

103110
CustomSelect.Option = AntdSelect.Option;
104111
export { CustomSelect };

client/packages/lowcoder/src/components/PermissionDialog/Permission.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ const PermissionSelector = (props: {
328328
<PermissionSelectWrapper>
329329
<AddPermissionsSelect
330330
open
331-
innerRef={selectRef}
331+
ref={selectRef}
332332
placeholder={trans("home.addPermissionPlaceholder")}
333333
mode="multiple"
334334
getPopupContainer={() => document.getElementById("add-app-user-permission-dropdown")!}

client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComp.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ import { RatingComp } from "./columnTypeComps/columnRatingComp";
1515
import { BadgeStatusComp } from "./columnTypeComps/columnStatusComp";
1616
import { ColumnTagsComp } from "./columnTypeComps/columnTagsComp";
1717
import { SimpleTextComp } from "./columnTypeComps/simpleTextComp";
18+
import { ColumnNumberComp } from "./columnTypeComps/ColumnNumberComp";
1819

1920
const actionOptions = [
2021
{
2122
label: trans("table.text"),
2223
value: "text",
2324
},
25+
{
26+
label: trans("table.number"),
27+
value: "number",
28+
},
2429
{
2530
label: trans("table.link"),
2631
value: "link",
@@ -73,6 +78,7 @@ const actionOptions = [
7378

7479
export const ColumnTypeCompMap = {
7580
text: SimpleTextComp,
81+
number: ColumnNumberComp,
7682
button: ButtonComp,
7783
badgeStatus: BadgeStatusComp,
7884
link: LinkComp,
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { Input } from "antd";
2+
import { NumberControl, StringControl } from "comps/controls/codeControl";
3+
import { BoolControl } from "comps/controls/boolControl";
4+
import { trans } from "i18n";
5+
import { ColumnTypeCompBuilder, ColumnTypeViewFn } from "../columnTypeCompBuilder";
6+
import { ColumnValueTooltip } from "../simpleColumnTypeComps";
7+
8+
const childrenMap = {
9+
text: NumberControl,
10+
float: BoolControl,
11+
prefix: StringControl,
12+
suffix: StringControl,
13+
};
14+
15+
let float = false;
16+
const getBaseValue: ColumnTypeViewFn<typeof childrenMap, number, number> = (
17+
props
18+
) => {
19+
return props.text
20+
};
21+
22+
export const ColumnNumberComp = (function () {
23+
return new ColumnTypeCompBuilder(
24+
childrenMap,
25+
(props, dispatch) => {
26+
float = props.float;
27+
const value = !float ? Math.floor(props.changeValue ?? getBaseValue(props, dispatch)) : props.changeValue ?? getBaseValue(props, dispatch);
28+
return props.prefix + value + props.suffix;
29+
},
30+
(nodeValue) => nodeValue.text.value,
31+
getBaseValue,
32+
)
33+
.setEditViewFn((props) => {
34+
return (
35+
<Input
36+
type="number"
37+
step={float?"0.01": "1"}
38+
defaultValue={props.value}
39+
autoFocus
40+
bordered={false}
41+
onChange={(e) => {
42+
props.onChange(!float ? Math.floor(e.target.valueAsNumber) : e.target.valueAsNumber);
43+
}}
44+
onBlur={props.onChangeEnd}
45+
onPressEnter={props.onChangeEnd}
46+
/>
47+
)})
48+
.setPropertyViewFn((children) => {
49+
return (
50+
<>
51+
{children.text.propertyView({
52+
label: trans("table.columnValue"),
53+
tooltip: ColumnValueTooltip,
54+
})}
55+
{children.prefix.propertyView({
56+
label: trans("table.prefix"),
57+
// tooltip: ColumnValueTooltip,
58+
})}
59+
{children.suffix.propertyView({
60+
label: trans("table.suffix"),
61+
// tooltip: ColumnValueTooltip,
62+
})}
63+
{children.float.propertyView({
64+
label: trans("table.float"),
65+
// tooltip: ColumnValueTooltip,
66+
})}
67+
</>
68+
);
69+
})
70+
.build();
71+
})();

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,11 @@ export const en = {
11491149
auto: "Auto",
11501150
fixed: "Fixed",
11511151
columnType: "Column type",
1152+
float: "Float",
1153+
prefix: "Prefix",
1154+
suffix: "Suffix",
11521155
text: "Text",
1156+
number: "Number",
11531157
link: "Link",
11541158
links: "Links",
11551159
tag: "Tag",

client/packages/lowcoder/src/i18n/locales/zh.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,11 @@ table: {
11301130
auto: "自动",
11311131
fixed: "固定",
11321132
columnType: "列类型",
1133+
float: "分数",
1134+
prefix: "字首",
1135+
suffix: "后缀",
11331136
text: "文本",
1137+
number: "数字",
11341138
link: "链接",
11351139
links: "多链接",
11361140
tag: "标签",

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/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)