Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ee06e9

Browse files
committed
Remove page components
1 parent ddca1a2 commit 2ee06e9

22 files changed

+29
-1804
lines changed

viewer/packages/lowcoder/src/api/apiUtils.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
ERROR_500,
88
SERVER_API_TIMEOUT_ERROR,
99
} from "constants/messages";
10-
import { AUTH_BIND_URL, OAUTH_REDIRECT } from "constants/routesURL";
10+
import { OAUTH_REDIRECT } from "constants/routesURL";
1111
import log from "loglevel";
1212
import history from "util/history";
1313
import axios, { AxiosError, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from "axios";
@@ -63,11 +63,6 @@ const notAuthRequiredPath = (requestUrl: string | undefined) => {
6363
);
6464
};
6565

66-
const notNeedBindPath = () => {
67-
const pathName = window.location.pathname;
68-
return pathName === AUTH_BIND_URL || pathName === OAUTH_REDIRECT;
69-
};
70-
7166
export const apiRequestInterceptor = (config: InternalAxiosRequestConfig): AxiosRequestConfigWithTimer => ({
7267
...config,
7368
timer: performance.now(),
@@ -137,14 +132,6 @@ export const apiFailureResponseInterceptor = (error: any) => {
137132
});
138133
}
139134
}
140-
if (error.response?.data?.code === SERVER_ERROR_CODES.NEED_BIND && !notNeedBindPath()) {
141-
history.push(AUTH_BIND_URL);
142-
return Promise.reject({
143-
code: ERROR_CODES.SERVER_ERROR,
144-
message: trans("apiMessage.verifyAccount"),
145-
show: false,
146-
});
147-
}
148135
if (
149136
error.response?.data?.code === SERVER_ERROR_CODES.CURRENT_EDITION_NOT_SUPPORT_THIS_FEATURE
150137
) {

viewer/packages/lowcoder/src/app.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import {
77
BASE_URL,
88
isAuthUnRequired,
99
ORG_AUTH_LOGIN_URL,
10-
ORG_AUTH_REGISTER_URL,
1110
USER_AUTH_URL,
12-
ORG_AUTH_FORGOT_PASSWORD_URL,
13-
ORG_AUTH_RESET_PASSWORD_URL,
1411
} from "constants/routesURL";
1512
import React from "react";
1613
import { createRoot } from "react-dom/client";
@@ -285,18 +282,6 @@ class AppIndex extends React.Component<AppIndexProps, any> {
285282
path={ORG_AUTH_LOGIN_URL}
286283
component={LazyUserAuthComp}
287284
/>
288-
<LazyRoute
289-
path={ORG_AUTH_REGISTER_URL}
290-
component={LazyUserAuthComp}
291-
/>
292-
<LazyRoute
293-
path={ORG_AUTH_FORGOT_PASSWORD_URL}
294-
component={LazyUserAuthComp}
295-
/>
296-
<LazyRoute
297-
path={ORG_AUTH_RESET_PASSWORD_URL}
298-
component={LazyUserAuthComp}
299-
/>
300285

301286
{this.props.isFetchUserFinished && this.props.defaultHomePage? (
302287
<Redirect exact from={BASE_URL} to={APPLICATION_VIEW_URL(this.props.defaultHomePage || "", "view")}/>

viewer/packages/lowcoder/src/constants/authConstants.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
import {
2-
AUTH_BIND_URL,
3-
AUTH_FORGOT_PASSWORD_URL,
42
AUTH_LOGIN_URL,
5-
AUTH_REGISTER_URL,
6-
AUTH_RESET_PASSWORD_URL,
73
OAUTH_REDIRECT,
8-
ORG_AUTH_FORGOT_PASSWORD_URL,
94
ORG_AUTH_LOGIN_URL,
10-
ORG_AUTH_REGISTER_URL,
11-
ORG_AUTH_RESET_PASSWORD_URL,
125
} from "constants/routesURL";
136
import { InviteInfo } from "api/inviteApi";
14-
import Login, { ThirdPartyBindCard } from "pages/userAuth/login";
15-
import UserRegister from "pages/userAuth/register";
7+
import Login from "pages/userAuth/login";
168
import { AuthRedirect } from "pages/userAuth/thirdParty/authRedirect";
179
import React from "react";
18-
import ForgotPassword from "pages/userAuth/forgotPassword";
19-
import ResetPassword from "pages/userAuth/resetPassword";
2010

2111
export type AuthInviteInfo = InviteInfo & { invitationId: string };
2212
export type AuthLocationState = { inviteInfo?: AuthInviteInfo; thirdPartyAuthError?: boolean };
@@ -83,15 +73,8 @@ export type ThirdPartyAuthGoal = "register" | "login" | "bind" | "innerBind";
8373

8474
export const AuthRoutes: Array<{ path: string; component: React.ComponentType<any> }> = [
8575
{ path: AUTH_LOGIN_URL, component: Login },
86-
{ path: AUTH_BIND_URL, component: ThirdPartyBindCard },
87-
{ path: AUTH_REGISTER_URL, component: UserRegister },
88-
{ path: AUTH_FORGOT_PASSWORD_URL, component: ForgotPassword },
89-
{ path: AUTH_RESET_PASSWORD_URL, component: ResetPassword },
9076
{ path: OAUTH_REDIRECT, component: AuthRedirect },
9177
{ path: ORG_AUTH_LOGIN_URL, component: Login },
92-
{ path: ORG_AUTH_REGISTER_URL, component: UserRegister },
93-
{ path: ORG_AUTH_FORGOT_PASSWORD_URL, component: ForgotPassword },
94-
{ path: ORG_AUTH_RESET_PASSWORD_URL, component: ResetPassword },
9578
];
9679

9780
export type ServerAuthType = "GOOGLE" | "GITHUB" | "FORM" | "KEYCLOAK" | "ORY" | "GENERIC";

viewer/packages/lowcoder/src/constants/configConstants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ThirdPartyConfigType } from "constants/authConstants";
2-
import { QR_CODE_OAUTH_URL } from "constants/routesURL";
32
import { UserConnectionSource } from "@lowcoder-ee/constants/userConstants";
43
import {
54
isRouteLink,
@@ -83,7 +82,7 @@ export const transToSystemConfig = (responseData: ConfigResponseData): SystemCon
8382
if (isOAuthConfig(authConfig)) {
8483
const routeLinkConf: Partial<ThirdPartyConfigType> = isRouteLink(authConfig.authType)
8584
? {
86-
url: QR_CODE_OAUTH_URL,
85+
url: "",
8786
routeLink: true,
8887
}
8988
: {};
Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import { AppViewMode, MarketplaceType } from "constants/applicationConstants";
2-
import { LocationDescriptor } from "history";
3-
import { UserGuideLocationState } from "pages/tutorials/tutorialsConstant";
4-
import { DatasourceType } from "@lowcoder-ee/constants/queryConstants";
1+
import { AppViewMode } from "constants/applicationConstants";
52

63
export const BASE_URL = "/";
74
export const USER_AUTH_URL = "/user/auth";
@@ -10,24 +7,13 @@ export const ALL_APPLICATIONS_URL = "/apps";
107
export const APPLICATION_MARKETPLACE_URL = `https://app.lowcoder.cloud/apps`;
118
export const MODULE_APPLICATIONS_URL = "/apps/module";
129
export const DATASOURCE_URL = `/datasource`;
13-
export const DATASOURCE_CREATE_URL = `${DATASOURCE_URL}/new/:datasourceType`;
14-
export const DATASOURCE_EDIT_URL = `${DATASOURCE_URL}/:datasourceId`;
1510
export const QUERY_LIBRARY_URL = `/query-library`;
1611
export const FOLDER_URL_PREFIX = `/folder`;
1712
export const APP_EDITOR_URL = `${ALL_APPLICATIONS_URL}/:applicationId/:viewMode/:appPageId?`;
1813

19-
export const AUTH_BIND_URL = `${USER_AUTH_URL}/bind`;
2014
export const AUTH_LOGIN_URL = `${USER_AUTH_URL}/login`;
21-
export const AUTH_REGISTER_URL = `${USER_AUTH_URL}/register`;
22-
export const AUTH_FORGOT_PASSWORD_URL = `${USER_AUTH_URL}/forgot-password`;
23-
export const AUTH_RESET_PASSWORD_URL = `${USER_AUTH_URL}/lost-password`;
24-
export const QR_CODE_OAUTH_URL = `${USER_AUTH_URL}/oauth/qrcode`;
2515
export const OAUTH_REDIRECT = `${USER_AUTH_URL}/oauth/redirect`;
26-
export const CAS_AUTH_REDIRECT = `${USER_AUTH_URL}/cas/redirect`;
2716
export const ORG_AUTH_LOGIN_URL = `/org/:orgId/auth/login`;
28-
export const ORG_AUTH_REGISTER_URL = `/org/:orgId/auth/register`;
29-
export const ORG_AUTH_FORGOT_PASSWORD_URL = `/org/:orgId/auth/forgot-password`;
30-
export const ORG_AUTH_RESET_PASSWORD_URL = `/org/:orgId/auth/lost-password`;
3117

3218
export const APPLICATION_VIEW_URL = (appId: string, viewMode: AppViewMode) =>
3319
`${ALL_APPLICATIONS_URL}/${appId}/${viewMode}`;
@@ -47,26 +33,9 @@ export const isAuthUnRequired = (pathname: string): boolean => {
4733
);
4834
};
4935

50-
export const buildDatasourceCreateUrl = (datasourceType: DatasourceType) =>
51-
`${DATASOURCE_URL}/new/${datasourceType}`;
52-
export const buildDatasourceEditUrl = (datasourceId: string) =>
53-
`${DATASOURCE_URL}/${datasourceId}`;
54-
5536
export const buildFolderUrl = (folderId: string) =>
5637
`${FOLDER_URL_PREFIX}/${folderId}`;
5738

58-
export const buildAppRouteWithState = (
59-
appId: string,
60-
showGuide: boolean
61-
): LocationDescriptor<UserGuideLocationState> => {
62-
return {
63-
pathname: APPLICATION_VIEW_URL(appId, "edit"),
64-
state: {
65-
showNewUserGuide: showGuide,
66-
},
67-
};
68-
};
69-
7039
export function preview(applicationId: string) {
7140
window.open(APPLICATION_VIEW_URL(applicationId, "preview"));
7241
}

viewer/packages/lowcoder/src/pages/editor/AppEditor.tsx

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { AppPathParams, AppTypeEnum } from "constants/applicationConstants";
2-
import { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
2+
import { Suspense, lazy, useEffect, useMemo, useRef, useState } from "react";
33
import { useDispatch, useSelector } from "react-redux";
44
import { useParams } from "react-router";
55
import { AppSummaryInfo, fetchApplicationInfo } from "redux/reduxActions/applicationActions";
66
import { fetchDataSourceByApp, fetchDataSourceTypes } from "redux/reduxActions/datasourceActions";
77
import { getUser } from "redux/selectors/usersSelectors";
88
import { useUserViewMode } from "util/hooks";
99
import "comps/uiCompRegistry";
10-
import { showAppSnapshotSelector } from "redux/selectors/appSnapshotSelector";
1110
import { setShowAppSnapshot } from "redux/reduxActions/appSnapshotActions";
1211
import { fetchGroupsAction } from "redux/reduxActions/orgActions";
1312
import { getFetchOrgGroupsFinished } from "redux/selectors/orgSelectors";
@@ -26,23 +25,17 @@ import { fetchFolderElements } from "redux/reduxActions/folderActions";
2625
import { registryDataSourcePlugin } from "constants/queryConstants";
2726
import { DatasourceApi } from "api/datasourceApi";
2827
import { useRootCompInstance } from "./useRootCompInstance";
29-
import {ErrorBoundary, FallbackProps} from 'react-error-boundary';
28+
import {ErrorBoundary} from 'react-error-boundary';
3029
import { ALL_APPLICATIONS_URL } from "@lowcoder-ee/constants/routesURL";
3130
import history from "util/history";
3231
import Flex from "antd/es/flex";
3332

34-
const AppSnapshot = lazy(() => {
35-
return import("pages/editor/appSnapshot")
36-
.then(moduleExports => ({default: moduleExports.AppSnapshot}));
37-
});
38-
3933
const AppEditorInternalView = lazy(
4034
() => import("pages/editor/appEditorInternal")
4135
.then(moduleExports => ({default: moduleExports.AppEditorInternalView}))
4236
);
4337

4438
export default function AppEditor() {
45-
const showAppSnapshot = useSelector(showAppSnapshotSelector);
4639
const params = useParams<AppPathParams>();
4740
const isUserViewModeCheck = useUserViewMode();
4841
const isUserViewMode = params.viewMode ? isUserViewModeCheck : true;
@@ -166,27 +159,16 @@ export default function AppEditor() {
166159

167160
return (
168161
<ErrorBoundary fallback={fallbackUI}>
169-
{showAppSnapshot ? (
170-
<Suspense>
171-
<AppSnapshot
172-
currentAppInfo={{
173-
...appInfo,
174-
dsl: compInstance.comp?.toJsonValue() || {},
175-
}}
176-
/>
177-
</Suspense>
178-
) : (
179-
<Suspense>
180-
<AppEditorInternalView
181-
appInfo={appInfo}
182-
readOnly={readOnly}
183-
loading={
184-
!fetchOrgGroupsFinished || !isDataSourcePluginRegistered || isCommonSettingsFetching
185-
}
186-
compInstance={compInstance}
187-
/>
188-
</Suspense>
189-
)}
162+
<Suspense>
163+
<AppEditorInternalView
164+
appInfo={appInfo}
165+
readOnly={readOnly}
166+
loading={
167+
!fetchOrgGroupsFinished || !isDataSourcePluginRegistered || isCommonSettingsFetching
168+
}
169+
compInstance={compInstance}
170+
/>
171+
</Suspense>
190172
</ErrorBoundary>
191173
);
192174
}

0 commit comments

Comments
 (0)