Skip to content

Dev - update #702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 22, 2024
Merged
Prev Previous commit
Next Next commit
added switch to make as public to marketplace
  • Loading branch information
raheeliftikhar5 committed Feb 21, 2024
commit 5bce8d21259d0aaaadaea3e0f22c6b1cde51d2a2
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,33 @@ function AppShareView(props: {
}) {
const { applicationId, permissionInfo, isModule } = props;
const [isPublic, setPublic] = useState(permissionInfo.publicToAll);
const [isPublicToMarketplace, setPublicToMarketplace] = useState(permissionInfo.publicToMarketplace);
const dispatch = useDispatch();
useEffect(() => {
setPublic(permissionInfo.publicToAll);
}, [permissionInfo.publicToAll]);
useEffect(() => {
setPublicToMarketplace(permissionInfo.publicToMarketplace);
}, [permissionInfo.publicToMarketplace]);
return (
<div style={{ marginBottom: "22px" }}>
<PermissionSwitchWrapper>
<TacoSwitch
checked={isPublicToMarketplace}
onChange={(checked) => {
setPublicToMarketplace(checked);
ApplicationApi.publicToMarketplace(applicationId, checked)
.then((resp) => {
validateResponse(resp);
dispatch(updateAppPermissionInfo({ publicToMarketplace: checked }));
})
.catch((e) => {
messageInstance.error(e.message);
});
}}
label={isModule ? 'Public module to marketplace' : 'Public app to marketplace'}
/>
</PermissionSwitchWrapper>
<PermissionSwitchWrapper>
<TacoSwitch
checked={isPublic}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const AppUILayoutType: Record<AppTypeEnum, UiLayoutType> = {
[AppTypeEnum.MobileTabLayout]: "mobileTabLayout",
};

export type ApplicationDSLType = "editing" | "published";
export type ApplicationDSLType = "editing" | "published" | "view_marketplace";
export type ApplicationRoleType = "viewer" | "editor" | "owner";
export type ApplicationPermissionType = "USER" | "GROUP" | "ORG_ADMIN";

Expand All @@ -36,6 +36,7 @@ export interface ApplicationMeta {
containerSize?: { height: number; width: number };
createBy: string;
createAt: number;
creatorEmail?: string;
orgId: string;
role: ApplicationRoleType;
extra: ApplicationExtra;
Expand Down Expand Up @@ -80,9 +81,10 @@ export interface AppPermissionInfo {
permissions: PermissionItem[];
invitationCodes: AppInviteInfo[];
publicToAll: boolean;
publicToMarketplace: boolean;
}

export type AppViewMode = "edit" | "preview" | "view";
export type AppViewMode = "edit" | "preview" | "view" | "view_marketplace";

export type AppPathParams = {
viewMode: AppViewMode;
Expand Down