Skip to content

Commit b00f723

Browse files
authored
Merge branch 'dev' into doc/existing_components
2 parents 0304123 + 05a1fb3 commit b00f723

File tree

5 files changed

+236
-31
lines changed

5 files changed

+236
-31
lines changed

client/packages/lowcoder/src/pages/common/headerStartDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function HeaderStartDropdown(props: { setEdit: () => void, isViewMarketpl
100100
})}
101101
</CommonTextLabel>
102102
),
103-
visible: true,
103+
visible: !isPublicApp,
104104
},
105105
];
106106

client/packages/lowcoder/src/pages/common/previewHeader.tsx

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,22 @@ export function HeaderProfile(props: { user: User }) {
115115
const { user } = props;
116116
const fetchingUser = useSelector(isFetchingUser);
117117
const templateId = useSelector(getTemplateId);
118+
const isPublicApp = useSelector(isPublicApplication);
119+
118120
if (fetchingUser) {
119121
return <Skeleton.Avatar shape="circle" size={28} />;
120122
}
121123
return (
122124
<div>
123125
{user.isAnonymous ? (
124126
!templateId ? (
125-
<LoginBtn buttonType="primary" onClick={() => history.push(AUTH_LOGIN_URL)}>
127+
<LoginBtn buttonType="primary" onClick={() => {
128+
if (isPublicApp) {
129+
window.top?.open('https://app.lowcoder.cloud/user/auth/login');
130+
} else {
131+
history.push(AUTH_LOGIN_URL)
132+
}
133+
}}>
126134
{trans("userAuth.login")}
127135
</LoginBtn>
128136
) : null
@@ -147,7 +155,7 @@ const PreviewHeaderComp = () => {
147155

148156
const headerStart = (
149157
<>
150-
<StyledLink onClick={() => history.push(ALL_APPLICATIONS_URL)}>
158+
<StyledLink onClick={() => !isPublicApp && history.push(ALL_APPLICATIONS_URL)}>
151159
<LogoIcon branding={true} />
152160
</StyledLink>
153161
{isViewMarketplaceMode && (
@@ -204,36 +212,44 @@ const PreviewHeaderComp = () => {
204212
</Wrapper>
205213
);
206214

207-
const headerMiddle = (
208-
<>
209-
{/* Devices */}
210-
<Segmented<DeviceType>
211-
options={[
212-
{ value: 'mobile', icon: <MobileOutlined /> },
213-
{ value: 'tablet', icon: <TabletOutlined /> },
214-
{ value: 'desktop', icon: <DesktopOutlined /> },
215-
]}
216-
value={editorState.deviceType}
217-
onChange={(value) => {
218-
editorState.setDeviceType(value);
219-
}}
220-
/>
221-
222-
{/* Orientation */}
223-
{editorState.deviceType !== 'desktop' && (
224-
<Segmented<DeviceOrientation>
215+
const headerMiddle = useMemo(() => {
216+
if (isPublicApp) return null;
217+
218+
return (
219+
<>
220+
{/* Devices */}
221+
<Segmented<DeviceType>
225222
options={[
226-
{ value: 'portrait', label: "Portrait" },
227-
{ value: 'landscape', label: "Landscape" },
223+
{ value: 'mobile', icon: <MobileOutlined /> },
224+
{ value: 'tablet', icon: <TabletOutlined /> },
225+
{ value: 'desktop', icon: <DesktopOutlined /> },
228226
]}
229-
value={editorState.deviceOrientation}
227+
value={editorState.deviceType}
230228
onChange={(value) => {
231-
editorState.setDeviceOrientation(value);
229+
editorState.setDeviceType(value);
232230
}}
233231
/>
234-
)}
235-
</>
236-
);
232+
233+
{/* Orientation */}
234+
{editorState.deviceType !== 'desktop' && (
235+
<Segmented<DeviceOrientation>
236+
options={[
237+
{ value: 'portrait', label: "Portrait" },
238+
{ value: 'landscape', label: "Landscape" },
239+
]}
240+
value={editorState.deviceOrientation}
241+
onChange={(value) => {
242+
editorState.setDeviceOrientation(value);
243+
}}
244+
/>
245+
)}
246+
</>
247+
);
248+
}, [
249+
isPublicApp,
250+
editorState.deviceType,
251+
editorState.deviceOrientation,
252+
]);
237253

238254
return (
239255
<Header

server/api-service/lowcoder-infra/src/main/java/org/lowcoder/infra/event/ApplicationCommonEvent.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import lombok.Getter;
66
import lombok.experimental.SuperBuilder;
77

8+
import java.util.Set;
9+
810
@Getter
911
@SuperBuilder
1012
public class ApplicationCommonEvent extends AbstractEvent {
@@ -23,6 +25,13 @@ public class ApplicationCommonEvent extends AbstractEvent {
2325
private final String oldFolderId;
2426
@Nullable
2527
private final String oldFolderName;
28+
private final String permissionId;
29+
private final String role;
30+
private final Set<String> userIds;
31+
private final Set<String> groupIds;
32+
private final String shareType;
33+
private final String tag;
34+
private final String commitMessage;
2635

2736
@Override
2837
public EventType getEventType() {

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/application/ApplicationController.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import org.lowcoder.api.application.view.*;
55
import org.lowcoder.api.framework.view.PageResponseView;
66
import org.lowcoder.api.framework.view.ResponseView;
7-
import org.lowcoder.api.home.SessionUserService;
87
import org.lowcoder.api.home.UserHomeApiService;
98
import org.lowcoder.api.home.UserHomepageView;
109
import org.lowcoder.api.util.BusinessEventPublisher;
@@ -14,7 +13,6 @@
1413
import org.lowcoder.domain.application.model.ApplicationStatus;
1514
import org.lowcoder.domain.application.model.ApplicationType;
1615
import org.lowcoder.domain.application.service.ApplicationRecordService;
17-
import org.lowcoder.domain.folder.service.FolderElementRelationService;
1816
import org.lowcoder.domain.permission.model.ResourceRole;
1917
import org.springframework.web.bind.annotation.PathVariable;
2018
import org.springframework.web.bind.annotation.RequestBody;
@@ -37,7 +35,6 @@ public class ApplicationController implements ApplicationEndpoints {
3735
private final UserHomeApiService userHomeApiService;
3836
private final ApplicationApiService applicationApiService;
3937
private final BusinessEventPublisher businessEventPublisher;
40-
private final SessionUserService sessionUserService;
4138
private final GidService gidService;
4239
private final ApplicationRecordService applicationRecordService;
4340

@@ -152,6 +149,14 @@ public Mono<ResponseView<ApplicationView>> publish(@PathVariable String applicat
152149
return newtag;
153150
})
154151
.switchIfEmpty(Mono.just("1.0.0"))
152+
.delayUntil(newtag -> {
153+
ApplicationPublishRequest req = Objects.requireNonNullElse(applicationPublishRequest, new ApplicationPublishRequest("", newtag));
154+
return businessEventPublisher.publishApplicationPublishEvent(appId, req).then(Mono.defer(() -> {
155+
if(newtag.equals(req.tag())) {
156+
return businessEventPublisher.publishApplicationVersionChangeEvent(appId, newtag);
157+
} else return Mono.empty();
158+
}));
159+
})
155160
.flatMap(newtag -> applicationApiService.publish(appId, Objects.requireNonNullElse(applicationPublishRequest, new ApplicationPublishRequest("", newtag))))
156161
.map(ResponseView::success));
157162
}
@@ -221,6 +226,7 @@ public Mono<ResponseView<Boolean>> updatePermission(@PathVariable String applica
221226
}
222227
return gidService.convertApplicationIdToObjectId(applicationId).flatMap(appId ->
223228
applicationApiService.updatePermission(appId, permissionId, role)
229+
.delayUntil(__ -> businessEventPublisher.publishApplicationPermissionEvent(applicationId, null, null, permissionId, role.getValue()))
224230
.map(ResponseView::success));
225231
}
226232

@@ -230,6 +236,7 @@ public Mono<ResponseView<Boolean>> removePermission(
230236
@PathVariable String permissionId) {
231237
return gidService.convertApplicationIdToObjectId(applicationId).flatMap(appId ->
232238
applicationApiService.removePermission(appId, permissionId)
239+
.delayUntil(__ -> businessEventPublisher.publishApplicationPermissionEvent(applicationId, null, null, permissionId, null))
233240
.map(ResponseView::success));
234241
}
235242

@@ -246,6 +253,7 @@ public Mono<ResponseView<Boolean>> grantPermission(
246253
emptyIfNull(request.userIds()),
247254
emptyIfNull(request.groupIds()),
248255
role)
256+
.delayUntil(__ -> businessEventPublisher.publishApplicationPermissionEvent(applicationId, emptyIfNull(request.userIds()), emptyIfNull(request.groupIds()), null, role.getValue()))
249257
.map(ResponseView::success));
250258
}
251259

@@ -262,6 +270,7 @@ public Mono<ResponseView<Boolean>> setApplicationPublicToAll(@PathVariable Strin
262270
@RequestBody ApplicationPublicToAllRequest request) {
263271
return gidService.convertApplicationIdToObjectId(applicationId).flatMap(appId ->
264272
applicationApiService.setApplicationPublicToAll(appId, request.publicToAll())
273+
.delayUntil(__ -> businessEventPublisher.publishApplicationSharingEvent(applicationId, "PublicToAll"))
265274
.map(ResponseView::success));
266275
}
267276

@@ -270,6 +279,7 @@ public Mono<ResponseView<Boolean>> setApplicationPublicToMarketplace(@PathVariab
270279
@RequestBody ApplicationPublicToMarketplaceRequest request) {
271280
return gidService.convertApplicationIdToObjectId(applicationId).flatMap(appId ->
272281
applicationApiService.setApplicationPublicToMarketplace(appId, request)
282+
.delayUntil(__ -> businessEventPublisher.publishApplicationSharingEvent(applicationId, "PublicToMarketplace"))
273283
.map(ResponseView::success));
274284
}
275285

0 commit comments

Comments
 (0)