Skip to content

Commit acf9828

Browse files
committed
App versions and publish dialog
1 parent a8c3c04 commit acf9828

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import StepModal from "../StepModal";
3636
import { AddIcon } from "icons";
3737
import { GreyTextColor } from "constants/style";
3838
import { VersionDataForm } from "@lowcoder-ee/pages/common/versionDataForm";
39-
import { SocialShareButtons } from "components/SocialShareButtons";
4039

4140
const BottomWrapper = styled.div`
4241
margin: 12px 16px 0 16px;
@@ -77,11 +76,12 @@ export const AppPermissionDialog = React.memo(
7776
applicationId: string;
7877
visible: boolean;
7978
onVisibleChange: (visible: boolean) => void;
79+
publishedVersion?: string | undefined;
8080
}) => {
8181
const [form] = Form.useForm();
8282
const { appType } = useContext(ExternalEditorContext);
8383
const isModule = appType === AppTypeEnum.Module;
84-
const { applicationId } = props;
84+
const { applicationId, publishedVersion } = props;
8585

8686
const dispatch = useDispatch();
8787
const appPermissionInfo = useSelector(getAppPermissionInfo);
@@ -249,6 +249,7 @@ export const AppPermissionDialog = React.memo(
249249
applicationId={applicationId}
250250
permissionInfo={appPermissionInfo!}
251251
form={form}
252+
publishedVersion={publishedVersion}
252253
/>
253254
),
254255
footerRender: (modalProps) => (
@@ -338,8 +339,15 @@ function AppShareView(props: {
338339
permissionInfo: AppPermissionInfo;
339340
isModule: boolean;
340341
form: any;
342+
publishedVersion?: string;
341343
}) {
342-
const { applicationId, permissionInfo, isModule, form } = props;
344+
const {
345+
applicationId,
346+
permissionInfo,
347+
isModule,
348+
form,
349+
publishedVersion,
350+
} = props;
343351
const [isPublic, setPublic] = useState(permissionInfo.publicToAll);
344352
const [isPublicToMarketplace, setPublicToMarketplace] = useState(
345353
permissionInfo.publicToMarketplace
@@ -351,7 +359,6 @@ function AppShareView(props: {
351359
useEffect(() => {
352360
setPublicToMarketplace(permissionInfo.publicToMarketplace);
353361
}, [permissionInfo.publicToMarketplace]);
354-
const inviteLink = window.location.origin + APPLICATION_VIEW_URL(props.applicationId, "view");
355362

356363
return (
357364
<div style={{ marginBottom: "22px" }}>
@@ -424,7 +431,7 @@ function AppShareView(props: {
424431
{isPublic && <AppInviteView appId={applicationId} />}
425432
<Divider />
426433

427-
<VersionDataForm form={form} preserve={false} />
434+
<VersionDataForm form={form} preserve={false} latestVersion={publishedVersion} />
428435

429436
<div>
430437
<Typography.Text type="secondary">

client/packages/lowcoder/src/constants/applicationConstants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ export interface ApplicationMeta {
107107
applicationStatus: "NORMAL" | "RECYCLED" | "DELETED";
108108
editingUserId: string | null;
109109
lastEditedAt: number;
110+
publishedVersion?: string;
111+
lastPublishedTime?: number;
110112
}
111113

112114
export interface FolderMeta {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4012,6 +4012,7 @@ export const en = {
40124012
"fileUploadError": "File upload error",
40134013
"fileFormatError": "File format error",
40144014
"groupWithSquareBrackets": "[Group] ",
4015+
"managePermissions": "Manage permissions",
40154016
"allPermissions": "Owner",
40164017
"appSharingDialogueTitle" : "App Sharing and Permissions",
40174018
"appSocialSharing" : "Share Your App and Experience on:",
@@ -4022,6 +4023,8 @@ export const en = {
40224023
"appPublicMessage": "Make the app public. Anyone can view.",
40234024
"modulePublicMessage": "Make the module public. Anyone can view.",
40244025
"marketplaceURL": "https://api-service.lowcoder.cloud",
4026+
"appMemberMessage": "All shared members can view this app.",
4027+
"moduleMemberMessage": "All shared members can view this module.",
40254028
"appMarketplaceMessage": "Publish your App on the Public Marketplace. Anyone can view and copy it from there.",
40264029
"moduleMarketplaceMessage": "Publish your Module on the Public Marketplace. Anyone can view and copy it from there.",
40274030
"marketplaceGoodPublishing": "Please make sure your app is well-named and easy to use. Remove any sensitive information before publishing. Also, remove local datasources and replace by static built-in temporary data.",
@@ -4044,6 +4047,8 @@ export const en = {
40444047
"createNavigation": "Create Navigation",
40454048
"howToUseAPI": "How to use the Open Rest API",
40464049
"support": "Support",
4050+
"versions": "Versions",
4051+
"publishVersionDescription": "By publishing, your users will see the current state of your app. Further editing will not be visible until you publish again",
40474052
},
40484053

40494054
"support" : {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ export default function Header(props: HeaderProps) {
625625
onVisibleChange={(visible) =>
626626
!visible && setPermissionDialogVisible(false)
627627
}
628+
publishedVersion={application?.publishedVersion}
628629
/>
629630
)}
630631
{canManageApp(user, application) && (

client/packages/lowcoder/src/redux/sagas/applicationSagas.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export function* updateApplicationMetaSaga(action: ReduxAction<UpdateAppMetaPayl
179179

180180
export function* publishApplicationSaga(action: ReduxAction<PublishApplicationPayload>) {
181181
try {
182-
const response: AxiosResponse<ApiResponse> = yield call(
182+
const response: AxiosResponse<ApplicationResp> = yield call(
183183
ApplicationApi.publishApplication,
184184
action.payload
185185
);
@@ -189,6 +189,20 @@ export function* publishApplicationSaga(action: ReduxAction<PublishApplicationPa
189189
type: ReduxActionTypes.PUBLISH_APPLICATION_SUCCESS,
190190
payload: action.payload,
191191
});
192+
if (response.data.data && response.data.data.applicationInfoView) {
193+
const appInfo = response.data.data.applicationInfoView;
194+
yield put({
195+
type: ReduxActionTypes.UPDATE_APPLICATION_META_SUCCESS,
196+
payload: {
197+
applicationId: appInfo.applicationId,
198+
name: appInfo.name,
199+
folderId: appInfo.folderId,
200+
publishedVersion: appInfo.publishedVersion,
201+
lastPublishedTime: appInfo.lastPublishedTime,
202+
},
203+
});
204+
}
205+
192206
messageInstance.success(trans("api.publishSuccess"));
193207
window.open(APPLICATION_VIEW_URL(action.payload.applicationId, "view"));
194208
}

0 commit comments

Comments
 (0)