Skip to content

Commit 3420dc4

Browse files
authored
Merge branch 'dev' into feat_auth_flow
2 parents b968f8b + 513cd2c commit 3420dc4

File tree

25 files changed

+123
-66
lines changed

25 files changed

+123
-66
lines changed

.github/workflows/docker-images.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
options:
1212
- latest
1313
- test
14+
- 2.4.6
1415
build_allinone:
1516
type: boolean
1617
description: 'Build the All-In-One image'

client/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.9
1+
2.4.12

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-frontend",
3-
"version": "2.4.9",
3+
"version": "2.4.12",
44
"type": "module",
55
"private": true,
66
"workspaces": [

client/packages/lowcoder-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-sdk",
3-
"version": "2.4.14",
3+
"version": "2.4.15",
44
"type": "module",
55
"files": [
66
"src",

client/packages/lowcoder/src/comps/comps/buttonComp/buttonComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const ButtonTmpComp = (function () {
136136
};
137137
return new UICompBuilder(childrenMap, (props) => {
138138
return(
139-
<ButtonCompWrapper disabled={props.disabled}>
139+
<ButtonCompWrapper $disabled={props.disabled}>
140140
<EditorContext.Consumer>
141141
{(editorState) => (
142142
<Button100

client/packages/lowcoder/src/comps/comps/buttonComp/buttonCompConstants.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@ export const Button100 = styled(Button)<{ $buttonStyle?: ButtonStyleType }>`
6868
line-height:${(props) => props.$buttonStyle?.lineHeight};
6969
`;
7070

71-
export const ButtonCompWrapper = styled.div<{ disabled: boolean }>`
71+
export const ButtonCompWrapper = styled.div<{ $disabled: boolean }>`
72+
display: flex;
73+
7274
// The button component is disabled but can respond to drag & select events
7375
${(props) =>
74-
props.disabled &&
76+
props.$disabled &&
7577
`
7678
cursor: not-allowed;
7779
button:disabled {

client/packages/lowcoder/src/comps/comps/buttonComp/dropdownComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const DropdownTmpComp = (function () {
116116
);
117117

118118
return (
119-
<ButtonCompWrapper disabled={props.disabled}>
119+
<ButtonCompWrapper $disabled={props.disabled}>
120120
{props.onlyMenu ? (
121121
<Dropdown
122122
disabled={props.disabled}

client/packages/lowcoder/src/comps/comps/buttonComp/linkComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const LinkTmpComp = (function () {
9595
// chrome86 bug: button children should not contain only empty span
9696
const hasChildren = hasIcon(props.prefixIcon) || !!props.text || hasIcon(props.suffixIcon);
9797
return (
98-
<ButtonCompWrapper disabled={props.disabled}>
98+
<ButtonCompWrapper $disabled={props.disabled}>
9999
<Link
100100
$animationStyle={props.animationStyle}
101101
ref={props.viewRef}

client/packages/lowcoder/src/comps/comps/buttonComp/scannerComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const ScannerTmpComp = (function () {
134134
};
135135

136136
return (
137-
<ButtonCompWrapper disabled={props.disabled}>
137+
<ButtonCompWrapper $disabled={props.disabled}>
138138
<Button100
139139
ref={props.viewRef}
140140
$buttonStyle={props.style}

client/packages/lowcoder/src/comps/comps/buttonComp/toggleButtonComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const ToggleTmpComp = (function () {
7272

7373
return (
7474
<ButtonCompWrapperStyled
75-
disabled={props.disabled}
75+
$disabled={props.disabled}
7676
$align={props.alignment}
7777
$showBorder={props.showBorder}
7878
$animationStyle={props.animationStyle}

client/packages/lowcoder/src/comps/utils/remote.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ export function parseCompType(compType: string) {
3939
}
4040

4141
export async function getNpmPackageMeta(packageName: string) {
42-
const res = await axios.get<NpmPackageMeta>(`${NPM_REGISTRY_URL}/none/${packageName}`);
42+
const axiosInstance = axios.create({
43+
baseURL: NPM_REGISTRY_URL,
44+
withCredentials: true,
45+
})
46+
const res = await axiosInstance.get<NpmPackageMeta>(
47+
`/none/${packageName}`,
48+
);
4349
if (res.status >= 400) {
4450
return null;
4551
}

client/packages/lowcoder/src/layout/gridLayout.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,23 +213,21 @@ class GridLayout extends React.Component<GridLayoutProps, GridLayoutState> {
213213
* @return {String} Container height in pixels.
214214
*/
215215
containerHeight(): string {
216-
const { margin, rowHeight, fixedRowCount } = this.props as Required<GridLayoutProps>;
217-
const { extraHeight, emptyRows } = this.props;
216+
const { margin, rowHeight, fixedRowCount, isCanvas } = this.props as Required<GridLayoutProps>;
217+
const { emptyRows } = this.props;
218218
const positionParams = genPositionParams(this.props);
219-
220219
const { containerPadding } = positionParams;
221220
const layout = this.getUILayout(undefined, true);
221+
222222
let nbRow = bottom(layout);
223-
if (!_.isNil(emptyRows) && (_.size(layout) === 0 || fixedRowCount)) {
224-
nbRow = emptyRows;// === Infinity ? 0 : emptyRows;
223+
if (!_.isNil(emptyRows) && (_.size(layout) === 0 || (fixedRowCount && isCanvas))) {
224+
nbRow = emptyRows;
225225
}
226226
const containerHeight = Math.max(
227227
nbRow * rowHeight + (nbRow - 1) * margin[1] + containerPadding[1] * 2
228228
);
229229
// log.debug("layout: containerHeigh=", containerHeight, " minHeight: ", this.props.minHeight);
230-
const height = extraHeight
231-
? `calc(${containerHeight}px + ${extraHeight})`
232-
: containerHeight + "px";
230+
const height = `${containerHeight}px`;
233231
// log.log( "containerHeight. nbRow: ", nbRow, " containerPadding: ", containerPadding[1], " containerHeight: ", containerHeight, " height: ", height);
234232
return height;
235233
}

client/packages/lowcoder/src/util/styleUtils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const getBackgroundStyle = (style: Record<string, string | undefined>) => {
55
return css`
66
${isValidColor(style.background) && `background-color: ${style.background}`};
77
${isValidGradient(style.background) && !Boolean(style.backgroundImage) && `background-image: ${style.background}`};
8-
${!isValidGradient(style.background) && Boolean(style.backgroundImage) && `background-image: ${style.backgroundImage}`};
8+
${!isValidGradient(style.background) && Boolean(style.backgroundImage) && `background-image: url(${style.backgroundImage})`};
99
${isValidGradient(style.background) && Boolean(style.backgroundImage) && `background-image: url(${style.backgroundImage}), ${style.background}`};
1010
1111
${style.backgroundImageRepeat && `background-repeat: ${style.backgroundImageRepeat};`};

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ private Mono<FindAuthConfig> findAuthConfig(String orgId, Function<AbstractAuthC
5353
public Flux<FindAuthConfig> findAllAuthConfigs(String orgId, boolean enableOnly) {
5454

5555
Mono<FindAuthConfig> emailAuthConfigMono = orgMemberService.doesAtleastOneAdminExist()
56-
.map(doesAtleastOneAdminExist -> {
56+
.flatMap(doesAtleastOneAdminExist -> {
5757
boolean shouldEnableRegister;
5858
if(doesAtleastOneAdminExist) {
5959
shouldEnableRegister = authProperties.getEmail().getEnableRegister();
6060
} else {
6161
shouldEnableRegister = Boolean.TRUE;
6262
}
63-
return new FindAuthConfig
64-
(new EmailAuthConfig(AuthSourceConstants.EMAIL, authProperties.getEmail().isEnable(), shouldEnableRegister), null);
63+
if(orgId == null) return Mono.just(new FindAuthConfig(new EmailAuthConfig(AuthSourceConstants.EMAIL, authProperties.getEmail().isEnable(), shouldEnableRegister), null));
64+
else return organizationService.getById(orgId).map(organization -> new FindAuthConfig(new EmailAuthConfig(AuthSourceConstants.EMAIL, !organization.getIsEmailDisabled(), shouldEnableRegister), null));
6565
});
6666

6767

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/organization/model/Organization.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ public class Organization extends HasIdAndAuditing implements BeforeMongodbWrite
5151

5252
private String contactPhoneNumber;
5353

54+
private Boolean isEmailDisabled;
55+
56+
public Boolean getIsEmailDisabled() {
57+
if(isEmailDisabled == null) return false;
58+
else return isEmailDisabled;
59+
}
60+
5461
@JsonIgnore
5562
private String logoAssetId;
5663

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/user/service/UserService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public interface UserService {
4343

4444
Mono<User> addNewConnectionAndReturnUser(String userId, AuthUser authUser);
4545

46+
Mono<User> saveUser(User user);
47+
4648
Mono<Void> deleteProfilePhoto(User visitor);
4749

4850
Mono<Boolean> updatePassword(String userId, String oldPassword, String newPassword);

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/user/service/UserServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ public Mono<User> addNewConnectionAndReturnUser(String userId, AuthUser authUser
225225
.flatMap(repository::save);
226226
}
227227

228+
@Override
229+
public Mono<User> saveUser(User user) {
230+
return repository.save(user);
231+
}
232+
228233
@Override
229234
public Mono<Void> deleteProfilePhoto(User visitor) {
230235
String userAvatar = visitor.getAvatar();

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

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public Mono<User> updateOrCreateUser(AuthUser authUser, boolean linkExistingUser
164164
if (findByAuthUserFirst.userExist()) {
165165
User user = findByAuthUserFirst.user();
166166
updateConnection(authUser, user);
167-
return userService.update(user.getId(), user);
167+
return userService.saveUser(user);
168168
}
169169

170170
//If the user connection is not found with login id, but the user is
@@ -246,9 +246,13 @@ public Mono<Boolean> enableAuthConfig(AuthConfigRequest authConfigRequest) {
246246
.then(sessionUserService.getVisitorOrgMemberCache())
247247
.flatMap(orgMember -> organizationService.getById(orgMember.getOrgId()))
248248
.doOnNext(organization -> {
249-
boolean duplicateAuthType = addOrUpdateNewAuthConfig(organization, authConfigFactory.build(authConfigRequest, true));
250-
if(duplicateAuthType) {
251-
deferredError(DUPLICATE_AUTH_CONFIG_ADDITION, "DUPLICATE_AUTH_CONFIG_ADDITION");
249+
if(authConfigRequest.getId().equals("EMAIL")) {
250+
organization.setIsEmailDisabled(false);
251+
} else {
252+
boolean duplicateAuthType = addOrUpdateNewAuthConfig(organization, authConfigFactory.build(authConfigRequest, true));
253+
if (duplicateAuthType) {
254+
deferredError(DUPLICATE_AUTH_CONFIG_ADDITION, "DUPLICATE_AUTH_CONFIG_ADDITION");
255+
}
252256
}
253257
})
254258
.flatMap(organization -> organizationService.update(organization.getId(), organization));
@@ -346,22 +350,15 @@ private Mono<Void> checkIfAdmin() {
346350
* If true, throw an exception to avoid disabling the last effective connection way.
347351
*/
348352
private Mono<Void> checkIfOnlyEffectiveCurrentUserConnections(String authId) {
349-
Mono<List<String>> userConnectionAuthConfigIdListMono = sessionUserService.getVisitor()
350-
.flatMapIterable(User::getConnections)
351-
.filter(connection -> StringUtils.isNotBlank(connection.getAuthId()))
352-
.map(Connection::getAuthId)
353-
.collectList();
354-
Mono<List<String>> orgAuthIdListMono = authenticationService.findAllAuthConfigs(null, true)
355-
.map(FindAuthConfig::authConfig)
356-
.map(AbstractAuthConfig::getId)
357-
.collectList();
358-
return Mono.zip(userConnectionAuthConfigIdListMono, orgAuthIdListMono)
359-
.delayUntil(tuple -> {
360-
List<String> userConnectionAuthConfigIds = tuple.getT1();
361-
List<String> orgAuthConfigIds = tuple.getT2();
362-
userConnectionAuthConfigIds.retainAll(orgAuthConfigIds);
363-
userConnectionAuthConfigIds.remove(authId);
364-
if (CollectionUtils.isEmpty(userConnectionAuthConfigIds)) {
353+
return sessionUserService.getVisitorOrgMemberCache()
354+
.map(OrgMember::getOrgId)
355+
.flatMap(orgId -> authenticationService.findAllAuthConfigs(orgId, true)
356+
.map(FindAuthConfig::authConfig)
357+
.map(AbstractAuthConfig::getId)
358+
.collectList())
359+
.delayUntil(orgAuthConfigIds -> {
360+
orgAuthConfigIds.remove(authId);
361+
if (CollectionUtils.isEmpty(orgAuthConfigIds)) {
365362
return Mono.error(new BizException(DISABLE_AUTH_CONFIG_FORBIDDEN, "DISABLE_AUTH_CONFIG_FORBIDDEN"));
366363
}
367364
return Mono.empty();
@@ -370,26 +367,29 @@ private Mono<Void> checkIfOnlyEffectiveCurrentUserConnections(String authId) {
370367
}
371368

372369
private void disableAuthConfig(Organization organization, String authId, boolean delete) {
373-
374-
Predicate<AbstractAuthConfig> authConfigPredicate = abstractAuthConfig -> Objects.equals(abstractAuthConfig.getId(), authId);
375-
376-
if(delete) {
377-
List<AbstractAuthConfig> abstractAuthConfigs = Optional.of(organization)
378-
.map(Organization::getAuthConfigs)
379-
.orElse(Collections.emptyList());
380-
381-
abstractAuthConfigs.removeIf(authConfigPredicate);
382-
383-
organization.getOrganizationDomain().setConfigs(abstractAuthConfigs);
384-
370+
if(authId.equals("EMAIL")) {
371+
organization.setIsEmailDisabled(true);
385372
} else {
386-
Optional.of(organization)
387-
.map(Organization::getAuthConfigs)
388-
.orElse(Collections.emptyList()).stream()
389-
.filter(authConfigPredicate)
390-
.forEach(abstractAuthConfig -> {
391-
abstractAuthConfig.setEnable(false);
392-
});
373+
Predicate<AbstractAuthConfig> authConfigPredicate = abstractAuthConfig -> Objects.equals(abstractAuthConfig.getId(), authId);
374+
375+
if (delete) {
376+
List<AbstractAuthConfig> abstractAuthConfigs = Optional.of(organization)
377+
.map(Organization::getAuthConfigs)
378+
.orElse(Collections.emptyList());
379+
380+
abstractAuthConfigs.removeIf(authConfigPredicate);
381+
382+
organization.getOrganizationDomain().setConfigs(abstractAuthConfigs);
383+
384+
} else {
385+
Optional.of(organization)
386+
.map(Organization::getAuthConfigs)
387+
.orElse(Collections.emptyList()).stream()
388+
.filter(authConfigPredicate)
389+
.forEach(abstractAuthConfig -> {
390+
abstractAuthConfig.setEnable(false);
391+
});
392+
}
393393
}
394394
}
395395

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/filter/UserSessionPersistenceFilter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ private Mono<User> refreshOauthToken(Triple<User, Connection, List<String>> trip
122122

123123
return authenticationService
124124
.findAllAuthConfigs(orgId, true)
125+
.onErrorResume(e -> Flux.empty())
125126
.filter(findAuthConfig -> findAuthConfig.authConfig().getId().equals(connection.getAuthId()))
126127
.switchIfEmpty(Mono.empty())
127128
.flatMap(findAuthConfig -> {

server/api-service/lowcoder-server/src/main/java/org/lowcoder/runner/migrations/DatabaseChangelog.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,29 @@ public void addGidIndexesUnique(MongockTemplate mongoTemplate) {
301301
ensureIndexes(mongoTemplate, LibraryQuery.class, makeIndex("gid").unique());
302302
}
303303

304+
private int getMongoDBVersion(MongockTemplate mongoTemplate) {
305+
Document buildInfo = mongoTemplate.executeCommand(new Document("buildInfo", 1));
306+
String versionString = buildInfo.getString("version");
307+
if(versionString == null) return -1;
308+
String[] versionParts = versionString.split("\\.");
309+
int majorVersion = Integer.parseInt(versionParts[0]);
310+
return majorVersion;
311+
}
312+
304313
@ChangeSet(order = "026", id = "add-time-series-snapshot-history", author = "")
305314
public void addTimeSeriesSnapshotHistory(MongockTemplate mongoTemplate, CommonConfig commonConfig) {
315+
int mongoVersion = getMongoDBVersion(mongoTemplate);
316+
if (mongoVersion < 5) {
317+
log.warn("MongoDB version is below 5. Time-series collections are not supported. Upgrade the MongoDB version.");
318+
}
319+
306320
// Create the time-series collection if it doesn't exist
307321
if (!mongoTemplate.collectionExists(ApplicationHistorySnapshotTS.class)) {
308-
mongoTemplate.createCollection(ApplicationHistorySnapshotTS.class, CollectionOptions.empty().timeSeries("createdAt"));
322+
if(mongoVersion < 5) {
323+
mongoTemplate.createCollection(ApplicationHistorySnapshotTS.class);
324+
} else {
325+
mongoTemplate.createCollection(ApplicationHistorySnapshotTS.class, CollectionOptions.empty().timeSeries("createdAt"));
326+
}
309327
}
310328
Instant thresholdDate = Instant.now().minus(commonConfig.getQuery().getAppSnapshotKeepDuration(), ChronoUnit.DAYS);
311329
List<ApplicationHistorySnapshot> snapshots = mongoTemplate.find(new Query().addCriteria(Criteria.where("createdAt").gte(thresholdDate)), ApplicationHistorySnapshot.class);

server/api-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
<properties>
15-
<revision>2.4.9</revision>
15+
<revision>2.4.12</revision>
1616
<java.version>17</java.version>
1717
<maven.compiler.source>${java.version}</maven.compiler.source>
1818
<maven.compiler.target>${java.version}</maven.compiler.target>

server/node-service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-node-server",
3-
"version": "2.4.9",
3+
"version": "2.4.12",
44
"private": true,
55
"engines": {
66
"node": "^14.18.0 || >=16.0.0"

server/node-service/src/plugins/firebase/dataSourceConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const dataSourceConfig = {
2525
label: "Private Key",
2626
type: "password",
2727
tooltip:
28-
"The [document](https://firebase.google.com/docs/admin/setup) on how to obtain the private key.",
28+
"The JSON [document](https://firebase.google.com/docs/admin/setup) on how to obtain the private key.",
2929
},
3030
{
3131
label: "Spec Version",

server/node-service/src/plugins/firebase/queryConfig.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ const queryConfig = {
108108
type: "numberInput",
109109
defaultValue: 10,
110110
},
111+
{
112+
key: "startAt",
113+
label: "Start at",
114+
type: "textInput",
115+
tooltip: "Start the query at a specific document.",
116+
}
111117
],
112118
},
113119
{

0 commit comments

Comments
 (0)