Skip to content

Commit 9a37358

Browse files
Merge branch 'dev' into charts
2 parents 3533ef9 + f2b7d10 commit 9a37358

File tree

7 files changed

+70
-24
lines changed

7 files changed

+70
-24
lines changed

client/packages/lowcoder/src/comps/comps/selectInputComp/stepControl.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ let StepControlBasicComp = (function () {
151151
const onChange = (index: number) => {
152152
if (props.selectable == false) return;
153153
const newIndex = Math.max(0, index);
154+
if (props.options[newIndex]?.disabled) {
155+
return;
156+
}
154157
setCurrent(newIndex);
155158
if (props.options[newIndex]?.value !== undefined) {
156159
props.value.onChange(newIndex + 1 + ""); // Convert back to 1-based index for display.
@@ -198,6 +201,7 @@ let StepControlBasicComp = (function () {
198201
title={option.label}
199202
subTitle={option.subTitle}
200203
description={option.description}
204+
disabled={option.disabled}
201205
status={option.status as "error" | "finish" | "wait" | "process" | undefined}
202206
icon={props.showIcons && hasIcon(option.icon) && option.icon || undefined}
203207
/>

client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComps/columnSwitchComp.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,13 @@ const childrenMap = {
6969

7070
const getBaseValue: ColumnTypeViewFn<typeof childrenMap, boolean, boolean> = (props) => props.switchState;
7171

72+
let onEvent: (eventName: string) => Promise<unknown[]>;
73+
7274
export const SwitchComp = (function () {
7375
return new ColumnTypeCompBuilder(
7476
childrenMap,
7577
(props, dispatch) => {
78+
onEvent = props.onEvent;
7679
const value = props.changeValue ?? getBaseValue(props, dispatch);
7780
const CheckBoxComp = () => {
7881
return (
@@ -106,6 +109,8 @@ export const SwitchComp = (function () {
106109
disabled={false}
107110
onChange={(checked, e) => {
108111
props.onChange(checked);
112+
onEvent?.("change");
113+
onEvent?.(checked ? "true" : "false");
109114
}}
110115
/>
111116
</Wrapper>

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

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { trans } from "i18n";
77
import { useStyle } from "comps/controls/styleControl";
88
import { ButtonStyle } from "comps/controls/styleControlConstants";
99
import { Button100 } from "comps/comps/buttonComp/buttonCompConstants";
10+
import { IconControl } from "comps/controls/iconControl";
11+
import { hasIcon } from "comps/utils";
1012

1113
export const ColumnValueTooltip = trans("table.columnValueTooltip");
1214

@@ -20,7 +22,7 @@ export const ButtonTypeOptions = [
2022
value: "default",
2123
},
2224
{
23-
label: trans("text"),
25+
label: trans("table.text"),
2426
value: "text",
2527
},
2628
] as const;
@@ -32,23 +34,36 @@ export const ButtonComp = (function () {
3234
onClick: ActionSelectorControlInContext,
3335
loading: BoolCodeControl,
3436
disabled: BoolCodeControl,
37+
prefixIcon: IconControl,
38+
suffixIcon: IconControl,
3539
};
3640
return new ColumnTypeCompBuilder(
3741
childrenMap,
3842
(props) => {
3943
const ButtonStyled = () => {
4044
const style = useStyle(ButtonStyle);
45+
const hasText = !!props.text;
46+
const hasPrefixIcon = hasIcon(props.prefixIcon);
47+
const hasSuffixIcon = hasIcon(props.suffixIcon);
48+
const iconOnly = !hasText && (hasPrefixIcon || hasSuffixIcon);
49+
4150
return (
4251
<Button100
4352
type={props.buttonType}
4453
onClick={props.onClick}
4554
loading={props.loading}
4655
disabled={props.disabled}
4756
$buttonStyle={props.buttonType === "primary" ? style : undefined}
48-
style={{margin: 0}}
57+
style={{
58+
margin: 0,
59+
width: iconOnly ? 'auto' : undefined,
60+
minWidth: iconOnly ? 'auto' : undefined,
61+
padding: iconOnly ? '0 8px' : undefined
62+
}}
63+
icon={hasPrefixIcon ? props.prefixIcon : undefined}
4964
>
50-
{/* prevent the button from disappearing */}
51-
{!props.text ? " " : props.text}
65+
{hasText ? props.text : (iconOnly ? null : " ")}
66+
{hasSuffixIcon && !props.loading && <span style={{ marginLeft: hasText ? '8px' : 0 }}>{props.suffixIcon}</span>}
5267
</Button100>
5368
);
5469
};
@@ -62,6 +77,12 @@ export const ButtonComp = (function () {
6277
label: trans("table.columnValue"),
6378
tooltip: ColumnValueTooltip,
6479
})}
80+
{children.prefixIcon.propertyView({
81+
label: trans("button.prefixIcon"),
82+
})}
83+
{children.suffixIcon.propertyView({
84+
label: trans("button.suffixIcon"),
85+
})}
6586
{children.buttonType.propertyView({
6687
label: trans("table.type"),
6788
radioButton: true,

client/packages/lowcoder/src/pages/userAuth/register.tsx

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -95,25 +95,28 @@ function UserRegister() {
9595
setSigninEnabled(LOWCODER_EMAIL_AUTH_ENABLED === 'true');
9696
}, [serverSettings]);
9797

98+
const fetchOrgsByEmail = () => {
99+
fetchOrgPaginationByEmail({
100+
email: ' ',
101+
pageNum: 1,
102+
pageSize: 10,
103+
})
104+
.then((resp) => {
105+
if (resp.success) {
106+
const orgList = resp.data || [];
107+
if (orgList.length) {
108+
// in Enterprise mode, we will get org data in different format
109+
const selectedOrgId = orgList[0]?.id || orgList[0]?.orgId;
110+
setDefaultOrgId(selectedOrgId);
111+
dispatch(fetchConfigAction(selectedOrgId));
112+
}
113+
}
114+
})
115+
}
116+
98117
useEffect(() => {
99118
if (isEnterpriseMode) {
100-
// dispatch(fetchConfigAction());
101-
fetchOrgPaginationByEmail({
102-
email: ' ',
103-
pageNum: 1,
104-
pageSize: 10,
105-
})
106-
.then((resp) => {
107-
if (resp.success) {
108-
const orgList = resp.data || [];
109-
if (orgList.length) {
110-
// in Enterprise mode, we will get org data in different format
111-
const selectedOrgId = orgList[0]?.id || orgList[0]?.orgId;
112-
setDefaultOrgId(selectedOrgId);
113-
dispatch(fetchConfigAction(selectedOrgId));
114-
}
115-
}
116-
})
119+
fetchOrgsByEmail();
117120
}
118121
}, [isEnterpriseMode]);
119122

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,23 @@ protected Mono<AuthUser> authenticate(String authId, @Deprecated String source,
9898
})
9999
.flatMap(findAuthConfig -> {
100100
context.setAuthConfig(findAuthConfig.authConfig());
101+
// Check if email/password is superadmin before checking EMAIL provider enable
101102
if (findAuthConfig.authConfig().getSource().equals("EMAIL")) {
102-
if(StringUtils.isBlank(context.getOrgId())) {
103+
if (StringUtils.isBlank(context.getOrgId())) {
103104
context.setOrgId(Optional.ofNullable(findAuthConfig.organization()).map(Organization::getId).orElse(null));
104105
}
106+
// --- Superadmin check start ---
107+
if (context instanceof FormAuthRequestContext formContext) {
108+
String email = formContext.getLoginId();
109+
String password = formContext.getPassword();
110+
String superAdminEmail = commonConfig.getSuperAdmin().getUserName();
111+
String superAdminPassword = commonConfig.getSuperAdmin().getPassword();
112+
if (StringUtils.equalsIgnoreCase(email, superAdminEmail) && StringUtils.equals(password, superAdminPassword)) {
113+
// Allow superadmin login even if EMAIL provider is disabled
114+
return Mono.just(findAuthConfig);
115+
}
116+
}
117+
// --- Superadmin check end ---
105118
if(!findAuthConfig.authConfig().getEnable()) {
106119
return Mono.error(new BizException(EMAIL_PROVIDER_DISABLED, "EMAIL_PROVIDER_DISABLED"));
107120
}

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/authentication/GenericAuthenticateTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public void testGoogleLoginSuccess(WireMockRuntimeInfo wmRuntimeInfo) {
182182
})
183183
.verifyComplete();
184184

185-
Mockito.framework().clearInlineMocks();
185+
// Mockito.framework().clearInlineMocks();
186186
}
187187

188188
private String getEmailAuthConfigId() {

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/common/TestRedisConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.concurrent.atomic.AtomicInteger;
1111

1212
@SuppressWarnings("UnstableApiUsage")
13-
//@TestConfiguration
13+
@TestConfiguration
1414
public class TestRedisConfiguration {
1515

1616
private static final AtomicInteger STATE = new AtomicInteger(0);

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