Skip to content

Subscription handling #2 #1137

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 30 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d4a2a2c
Search & Create Customer
Aug 10, 2024
b6e19ee
Update for Subscription Handling
Aug 12, 2024
9759a6f
Merge branch 'dev' into subscription-handling
FalkWolsky Aug 17, 2024
45b37cd
Reorganizing and cleaning up
Aug 17, 2024
19ebdc8
Reorganizing and cleaning up
Aug 21, 2024
8faa3bb
Merge branch 'dev' into subscription-handling
FalkWolsky Aug 24, 2024
79fcd60
Updating package version
Aug 24, 2024
d5e1c64
Update Home Page
Aug 24, 2024
3e0450c
Showing Support Product Page
Aug 24, 2024
b415d1e
Subscription-Check Saga
Aug 24, 2024
33c7134
Cleanup dispatchers
Aug 25, 2024
9b1e389
Merge branch 'dev' into subscription-handling
FalkWolsky Aug 31, 2024
eb7c77f
Updating Vite Build Goals
Aug 31, 2024
41affd4
Introducing Subscription Overview and Support Handling
Aug 31, 2024
07136fc
Support Tickets Table
Aug 31, 2024
25890f3
fix: enhance docker image build github action
ludomikula Sep 3, 2024
4c46225
fixed support detail route
raheeliftikhar5 Sep 6, 2024
3dbdcd6
Merge branch 'main' into subscription-handling
FalkWolsky Sep 7, 2024
7dc68d3
Merge branch 'dev' into subscription-handling
FalkWolsky Sep 7, 2024
0d68d67
Support Detail Page
Sep 7, 2024
fc55724
Merge branch 'dev' into subscription-handling
FalkWolsky Sep 14, 2024
88e61b9
Merge branch 'dev' into subscription-handling
FalkWolsky Sep 14, 2024
9f7fc35
Merge branch 'dev' into subscription-handling
FalkWolsky Sep 14, 2024
b20ed56
Update React Markdown
Sep 14, 2024
fbdf8d5
Full Support and introducing a translation management script.
Sep 14, 2024
831bcbd
Adding Language Files
Sep 14, 2024
916d55e
Cleaning up Translation Folder
Sep 14, 2024
909a030
Updated Language Files including Variables
Sep 14, 2024
86757ee
Fixed Language Files and Merge preparation
Sep 15, 2024
fe89b29
Merge branch 'dev' into subscription-handling
FalkWolsky Sep 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Showing Support Product Page
  • Loading branch information
FalkWolsky committed Aug 24, 2024
commit 3e0450cd16c5fd800b47c35aabe7034d2e268be9
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/api/subscriptionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ export enum SubscriptionProducts {
GITREPOS = 'git-repos',
}

export const checkSubscriptions = () => {
export const CheckSubscriptions = () => {
const [subscriptions, setSubscriptions] = useState<Subscription[]>([]);
const [subscriptionDataLoaded, setSubscriptionDataLoaded] = useState<boolean>(false);
const [subscriptionDataError, setSubscriptionDataError] = useState<boolean>(false);
Expand Down
4 changes: 2 additions & 2 deletions client/packages/lowcoder/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
ORG_AUTH_LOGIN_URL,
ORG_AUTH_REGISTER_URL,
QUERY_LIBRARY_URL,
SETTING,
SETTING_URL,
TRASH_URL,
USER_AUTH_URL,
ADMIN_APP_URL,
Expand Down Expand Up @@ -324,7 +324,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
FOLDERS_URL,
FOLDER_URL,
TRASH_URL,
SETTING,
SETTING_URL,
MARKETPLACE_URL,
ADMIN_APP_URL
]}
Expand Down
4 changes: 2 additions & 2 deletions client/packages/lowcoder/src/constants/routesURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const USER_PROFILE_URL = "/user/profile";
export const NEWS_URL = "/news";
export const ORG_HOME_URL = "/org/home";
export const COMPONENT_DOC_URL = "/components";
export const SETTING = "/setting";
export const SUPPORT = `/support`;
export const SETTING_URL = "/setting";
export const SUPPORT_URL = `/support`;
export const PERMISSION_SETTING = "/setting/permission";
export const ORGANIZATION_SETTING = "/setting/organization";
export const SUBSCRIPTION_SETTING = "/setting/subscription";
Expand Down
49 changes: 17 additions & 32 deletions client/packages/lowcoder/src/pages/ApplicationV2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import {
MARKETPLACE_URL,
MODULE_APPLICATIONS_URL,
QUERY_LIBRARY_URL,
SETTING,
SUPPORT,
SETTING_URL,
SUPPORT_URL,
TRASH_URL,
// ADMIN_APP_URL,
NEWS_URL,
ORG_HOME_URL,
} from "constants/routesURL";
Expand Down Expand Up @@ -47,7 +46,6 @@ import { Layout } from "../../components/layout/Layout";
import { HomeView } from "./HomeView";
import { UserProfileView } from "./UserProfileView";
import { NewsView } from "./NewsView";
// import { ApiDocView } from "./ApiDocView";
import { OrgView } from "./OrgView";
import styled, { css } from "styled-components";
import history from "../../util/history";
Expand All @@ -66,10 +64,11 @@ import Setting from "pages/setting";
import { TypographyText } from "../../components/TypographyText";
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances";
import { isEE } from "util/envUtils";
import { checkSubscriptions, SubscriptionProducts } from "@lowcoder-ee/api/subscriptionApi";
import { CheckSubscriptions, SubscriptionProducts, Subscription } from "@lowcoder-ee/api/subscriptionApi";

// adding App Editor, so we can show Apps inside the Admin Area
import AppEditor from "../editor/AppEditor";
import { set } from "lodash";

const TabLabel = styled.div`
font-weight: 500;
Expand Down Expand Up @@ -237,32 +236,22 @@ export default function ApplicationHome() {
const allFoldersCount = allFolders.length;
const orgHomeId = "root";
const isSelfHost = window.location.host !== 'app.lowcoder.cloud';

const subscriptions = useSelector(state => state.subscriptions.subscriptions);
const subscriptionDataLoaded = useSelector(state => !state.subscriptions.loading);
const subscriptionDataError = useSelector(state => state.subscriptions.error);
const [supportSubscription, setSupportSubscription] = useState(true);

// const handleFolderCreate = useCreateFolder();

const isOrgAdmin = org?.createdBy == user.id ? true : false;

// Fetch subscriptions once on component mount
useEffect(() => {
dispatch(checkSubscriptions());
}, [dispatch]);

// Calculate support subscription status
const supportSubscription = useMemo(() => {
return subscriptions.some((sub: { product: SubscriptionProducts; }) => sub.product === SubscriptionProducts.SUPPORT);
}, [subscriptions]);
// we also want to check the subscription
/* const { subscriptions: subscriptionData, subscriptionDataLoaded, subscriptionDataError } = dispatch(CheckSubscriptions());

// Early return if data is still loading or there was an error
if (fetchingUser || !subscriptionDataLoaded || subscriptionDataError) {
return <ProductLoading />;
}
if (subscriptionDataLoaded && !subscriptionDataError) {
setSupportSubscription(subscriptionData.some(sub => sub.product === SubscriptionProducts.SUPPORT));
} */

const isOrgAdmin = org?.createdBy == user.id ? true : false;

useEffect(() => {
dispatch(fetchHomeData({}));

}, [user.currentOrgId]);

useEffect(() => {
Expand Down Expand Up @@ -296,10 +285,6 @@ export default function ApplicationHome() {
return <ProductLoading />;
}

if (fetchingUser || !isPreloadCompleted || !subscriptionDataLoaded || subscriptionDataError) {
return <ProductLoading />;
}

return (
<DivStyled>
<Layout
Expand Down Expand Up @@ -392,10 +377,10 @@ export default function ApplicationHome() {
supportSubscription ? {
items: [
{
text: <TabLabel>{trans("home.trash")}</TabLabel>,
routePath: TRASH_URL,
text: <TabLabel>{trans("home.support")}</TabLabel>,
routePath: SUPPORT_URL,
routeComp: TrashView,
icon: ({ selected, ...otherProps }) => selected ? <RecyclerIcon {...otherProps} width={"24px"}/> : <RecyclerIcon {...otherProps} width={"24px"}/>,
icon: ({ selected, ...otherProps }) => selected ? <SupportIcon {...otherProps} width={"24px"}/> : <SupportIcon {...otherProps} width={"24px"}/>,
},
],
} : { items: [] },
Expand All @@ -404,7 +389,7 @@ export default function ApplicationHome() {
items: [
{
text: <TabLabel>{trans("settings.title")}</TabLabel>,
routePath: SETTING,
routePath: SETTING_URL,
routePathExact: false,
routeComp: Setting,
icon: ({ selected, ...otherProps }) => selected ? <HomeSettingIcon {...otherProps} width={"24px"}/> : <HomeSettingIcon {...otherProps} width={"24px"}/>,
Expand Down
4 changes: 2 additions & 2 deletions client/packages/lowcoder/src/pages/setting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BASE_URL, SETTING } from "constants/routesURL";
import { BASE_URL, SETTING_URL } from "constants/routesURL";
import { useSelector } from "react-redux";
import { getUser } from "redux/selectors/usersSelectors";
import { currentOrgAdminOrDev } from "util/permissionUtils";
Expand All @@ -15,7 +15,7 @@ export function Setting() {

return (
<Switch>
<Route path={[`${SETTING}/:setting`, SETTING]} component={SettingHome} />
<Route path={[`${SETTING_URL}/:setting`, SETTING_URL]} component={SettingHome} />
</Switch>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Route, Switch } from "react-router";
import PermissionList from "./permissionList";
import PermissionDetail from "./permissionDetail";
import { PERMISSION_SETTING, PERMISSION_SETTING_DETAIL, SETTING } from "constants/routesURL";
import { PERMISSION_SETTING, PERMISSION_SETTING_DETAIL, SETTING_URL } from "constants/routesURL";

export default () => {
return (
<Switch>
<Route path={[SETTING, PERMISSION_SETTING]} component={PermissionList} exact />
<Route path={[SETTING_URL, PERMISSION_SETTING]} component={PermissionList} exact />
<Route path={PERMISSION_SETTING_DETAIL} component={PermissionDetail} />
</Switch>
);
Expand Down
Loading