Skip to content

Commit 31b7d99

Browse files
authored
Merge pull request #488 from lowcoder-org/dev
Dev -> Main for v2.1.5
2 parents 445f960 + 05c0cc8 commit 31b7d99

File tree

65 files changed

+2122
-637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2122
-637
lines changed

client/packages/lowcoder-cli/client.d.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ declare module "*.svg" {
88
React.SVGProps<SVGSVGElement> & { title?: string }
99
>;
1010

11-
const src: string;
12-
export default src;
11+
// const src: string;
12+
// export default src;
1313
}
1414

1515
declare module "*.md" {
@@ -31,10 +31,6 @@ declare var REACT_APP_LANGUAGES: string;
3131
declare var REACT_APP_COMMIT_ID: string;
3232
declare var REACT_APP_API_HOST: string;
3333
declare var LOWCODER_NODE_SERVICE_URL: string;
34-
declare var REACT_APP_LOWCODER_SHOW_BRAND: string;
35-
declare var REACT_APP_LOWCODER_CUSTOM_LOGO: string;
36-
declare var REACT_APP_LOWCODER_CUSTOM_LOGO_SQUARE: string;
37-
declare var REACT_APP_LOWCODER_CUSTOM_AUTH_WELCOME_TEXT: string;
3834
declare var REACT_APP_ENV: string;
3935
declare var REACT_APP_BUILD_ID: string;
4036
declare var REACT_APP_LOG_LEVEL: string;

client/packages/lowcoder-dev-utils/buildVars.js

-16
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@ export const buildVars = [
1919
name: "REACT_APP_API_HOST",
2020
defaultValue: "",
2121
},
22-
{
23-
name: "REACT_APP_LOWCODER_SHOW_BRAND",
24-
defaultValue: 'false',
25-
},
26-
{
27-
name: "REACT_APP_LOWCODER_CUSTOM_LOGO",
28-
defaultValue: '',
29-
},
30-
{
31-
name: "REACT_APP_LOWCODER_CUSTOM_LOGO_SQUARE",
32-
defaultValue: '',
33-
},
34-
{
35-
name: "REACT_APP_LOWCODER_CUSTOM_AUTH_WELCOME_TEXT",
36-
defaultValue: '',
37-
},
3822
{
3923
name: "LOWCODER_NODE_SERVICE_URL",
4024
defaultValue: "",

client/packages/lowcoder/index.html

-6
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,5 @@
9696
<div id="root"></div>
9797
<script type="module" src="/src/index.ts"></script>
9898
<!-- <%- browserCheckScript %> -->
99-
<script>
100-
window.lowcoder_show_brand = "<%= process.env.REACT_APP_LOWCODER_SHOW_BRAND %>";
101-
window.lowcoder_custom_auth_welcome_text = "<%= process.env.REACT_APP_LOWCODER_CUSTOM_AUTH_WELCOME_TEXT %>";
102-
window.lowcoder_custom_logo = "<%= process.env.REACT_APP_LOWCODER_CUSTOM_LOGO %>";
103-
window.lowcoder_custom_logo_square = "<%= process.env.REACT_APP_LOWCODER_CUSTOM_LOGO_SQUARE %>";
104-
</script>
10599
</body>
106100
</html>

client/packages/lowcoder/src/app-env.d.ts

-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ declare var REACT_APP_LANGUAGES: string;
3434
declare var REACT_APP_COMMIT_ID: string;
3535
declare var REACT_APP_API_HOST: string;
3636
declare var LOWCODER_NODE_SERVICE_URL: string;
37-
declare var REACT_APP_LOWCODER_SHOW_BRAND: string;
38-
declare var REACT_APP_LOWCODER_CUSTOM_LOGO: string;
39-
declare var REACT_APP_LOWCODER_CUSTOM_LOGO_SQUARE: string;
40-
declare var REACT_APP_LOWCODER_CUSTOM_AUTH_WELCOME_TEXT: string;
4137
declare var REACT_APP_ENV: string;
4238
declare var REACT_APP_BUILD_ID: string;
4339
declare var REACT_APP_LOG_LEVEL: string;

client/packages/lowcoder/src/app.tsx

+3-24
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,13 @@ import { CodeEditorTooltipContainer } from "base/codeEditor/codeEditor";
3939
import { ProductLoading } from "components/ProductLoading";
4040
import { language, trans } from "i18n";
4141
import { loadComps } from "comps";
42-
import { fetchHomeData } from "redux/reduxActions/applicationActions";
4342
import { initApp } from "util/commonUtils";
4443
import ApplicationHome from "./pages/ApplicationV2";
4544
import { favicon } from "@lowcoder-ee/assets/images";
4645
import { hasQueryParam } from "util/urlUtils";
4746
import { isFetchUserFinished } from "redux/selectors/usersSelectors";
4847
import { SystemWarning } from "./components/SystemWarning";
49-
import { getBrandingConfig, getSystemConfigFetching } from "./redux/selectors/configSelectors";
48+
import { getBrandingConfig } from "./redux/selectors/configSelectors";
5049
import { buildMaterialPreviewURL } from "./util/materialUtils";
5150
import GlobalInstances from 'components/GlobalInstances';
5251

@@ -71,35 +70,22 @@ const Wrapper = (props: { children: React.ReactNode }) => (
7170

7271
type AppIndexProps = {
7372
isFetchUserFinished: boolean;
74-
isFetchHomeFinished: boolean;
75-
// isFetchingConfig: boolean;
7673
currentOrgId?: string;
7774
orgDev: boolean;
7875
defaultHomePage: string | null | undefined;
7976
fetchConfig: (orgId?: string) => void;
8077
getCurrentUser: () => void;
81-
fetchHome: () => void;
8278
favicon: string;
8379
brandName: string;
8480
};
8581

8682
class AppIndex extends React.Component<AppIndexProps, any> {
8783
componentDidMount() {
8884
this.props.getCurrentUser();
89-
const { pathname } = history.location;
90-
91-
this.props.fetchConfig(this.props.currentOrgId);
92-
93-
if (pathname === BASE_URL) {
94-
this.props.fetchHome();
95-
}
9685
}
9786

9887
componentDidUpdate(prevProps: AppIndexProps) {
99-
if (history.location.pathname === BASE_URL) {
100-
this.props.fetchHome();
101-
}
102-
if(prevProps.currentOrgId !== this.props.currentOrgId) {
88+
if(prevProps.currentOrgId !== this.props.currentOrgId && this.props.currentOrgId !== '') {
10389
this.props.fetchConfig(this.props.currentOrgId);
10490
}
10591
}
@@ -108,11 +94,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
10894
const isTemplate = hasQueryParam("template");
10995
const pathname = history.location.pathname;
11096
// make sure all users in this app have checked login info
111-
if (
112-
!this.props.isFetchUserFinished ||
113-
// this.props.isFetchingConfig ||
114-
(pathname === BASE_URL && !this.props.isFetchHomeFinished)
115-
) {
97+
if (!this.props.isFetchUserFinished) {
11698
const hideLoadingHeader = isTemplate || isAuthUnRequired(pathname);
11799
return <ProductLoading hideHeader={hideLoadingHeader} />;
118100
}
@@ -185,11 +167,9 @@ class AppIndex extends React.Component<AppIndexProps, any> {
185167

186168
const mapStateToProps = (state: AppState) => ({
187169
isFetchUserFinished: isFetchUserFinished(state),
188-
// isFetchingConfig: getSystemConfigFetching(state),
189170
orgDev: state.ui.users.user.orgDev,
190171
currentOrgId: state.ui.users.user.currentOrgId,
191172
defaultHomePage: state.ui.application.homeOrg?.commonSettings.defaultHomePage,
192-
isFetchHomeFinished: state.ui.application.loadingStatus.fetchHomeDataFinished,
193173
favicon: getBrandingConfig(state)?.favicon
194174
? buildMaterialPreviewURL(getBrandingConfig(state)?.favicon!)
195175
: favicon,
@@ -201,7 +181,6 @@ const mapDispatchToProps = (dispatch: any) => ({
201181
dispatch(fetchUserAction());
202182
},
203183
fetchConfig: (orgId?: string) => dispatch(fetchConfigAction(orgId)),
204-
fetchHome: () => dispatch(fetchHomeData({})),
205184
});
206185

207186
const AppIndexWithProps = connect(mapStateToProps, mapDispatchToProps)(AppIndex);

client/packages/lowcoder/src/assets/images/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches
2-
import { ReactComponent as LogoIcon } from "./logo.svg";
3-
import { ReactComponent as LogoWithNameIcon } from "./logo-with-name.svg";
2+
import { ReactComponent as LogoIcon } from "./logo-with-name-home.svg";
3+
import { ReactComponent as LogoWithNameIcon } from "./logo-with-name-home.svg";
44
import { ReactComponent as LogoHomeIcon } from "./logo-with-name-home.svg";
55

66
export { default as favicon } from "./favicon.ico";

client/packages/lowcoder/src/components/PageSkeleton.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,13 @@ export default function PageSkeleton(props: IProps) {
7878
</SkeletonWrapper>
7979
);
8080

81+
// {/* headerStart={REACT_APP_LOWCODER_SHOW_BRAND === 'true' ? REACT_APP_LOWCODER_CUSTOM_LOGO !== "" ? <img src={REACT_APP_LOWCODER_CUSTOM_LOGO} alt="logo" /> :<StyledLogoWithName branding={true} /> : <StyledLogoHome branding={true} />} */}
82+
8183
return (
8284
<Layout>
8385
{!hideHeader && isHeaderReady && (
84-
<Header
85-
headerStart={
86-
REACT_APP_LOWCODER_SHOW_BRAND === 'true' ?
87-
REACT_APP_LOWCODER_CUSTOM_LOGO !== "" ? <img src={REACT_APP_LOWCODER_CUSTOM_LOGO} alt="logo" /> :<StyledLogoWithName branding={true} /> :
88-
<StyledLogoHome branding={true} />
89-
}
86+
<Header
87+
headerStart={<StyledLogoWithName branding={true} />}
9088
style={{ backgroundColor: brandingConfig?.headerColor, ...props.headStyle }}
9189
/>
9290
)}
@@ -95,5 +93,6 @@ export default function PageSkeleton(props: IProps) {
9593
<MainContent>{!hideContent && skeleton}</MainContent>
9694
</Layout>
9795
</Layout>
96+
9897
);
9998
}

client/packages/lowcoder/src/comps/comps/dateComp/dateCompUtil.ts

+4
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ export const getStyle = (style: DateTimeStyleType) => {
9999
: style.text};
100100
}
101101
102+
.ant-picker-clear {
103+
inset-inline-end: 18px
104+
}
105+
102106
.ant-picker-clear:hover {
103107
color: ${style.text === "#222222"
104108
? "#8B8FA3"

client/packages/lowcoder/src/comps/controls/labelControl.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ const LabelWrapper = styled.div<{
6969
}>`
7070
display: flex;
7171
align-items: center;
72-
line-height: 100%;
7372
margin-right: 8px;
7473
margin-bottom: ${(props) => (props.position === "row" ? 0 : "3.5px")};
7574
justify-content: ${(props) => (props.align === "left" ? "start" : "end")};

client/packages/lowcoder/src/index.ts

-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ debug(`REACT_APP_LANGUAGES:, ${REACT_APP_LANGUAGES}`);
3434
debug(`REACT_APP_API_HOST:, ${REACT_APP_API_HOST}`);
3535
debug(`REACT_APP_ENV:, ${REACT_APP_ENV}`);
3636
debug(`REACT_APP_LOG_LEVEL:, ${REACT_APP_LOG_LEVEL}`);
37-
debug(`REACT_APP_LOWCODER_SHOW_BRAND:, ${REACT_APP_LOWCODER_SHOW_BRAND}`);
38-
debug(`REACT_APP_LOWCODER_CUSTOM_AUTH_WELCOME_TEXT:, ${REACT_APP_LOWCODER_CUSTOM_AUTH_WELCOME_TEXT}`);
39-
debug(`LOWCODER_CUSTOM_LOGO:, ${REACT_APP_LOWCODER_CUSTOM_LOGO}`);
40-
debug(`LOWCODER_CUSTOM_LOGO_SQUARE:, ${REACT_APP_LOWCODER_CUSTOM_LOGO_SQUARE}`);
4137

4238
try {
4339
bootstrap();

client/packages/lowcoder/src/pages/ApplicationV2/HomeView.tsx

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
1-
import { useDispatch, useSelector } from "react-redux";
1+
import { useSelector } from "react-redux";
22
import { HomeLayout } from "./HomeLayout";
3-
import { useEffect } from "react";
4-
import { fetchFolderElements } from "../../redux/reduxActions/folderActions";
53
import { getUser } from "../../redux/selectors/usersSelectors";
64
import { folderElementsSelector } from "../../redux/selectors/folderSelector";
75

86
export function HomeView() {
9-
const dispatch = useDispatch();
10-
117
const elements = useSelector(folderElementsSelector)[""];
128
const user = useSelector(getUser);
139

14-
useEffect(() => {
15-
dispatch(fetchFolderElements({}));
16-
}, []);
17-
1810
if (!user.currentOrgId) {
1911
return null;
2012
}

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

+4-6
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,8 @@ export default function Header(props: HeaderProps) {
290290
const headerStart = (
291291
<>
292292
<StyledLink onClick={() => history.push(ALL_APPLICATIONS_URL)}>
293-
{REACT_APP_LOWCODER_SHOW_BRAND === 'true' ?
294-
REACT_APP_LOWCODER_CUSTOM_LOGO_SQUARE !== "" ? <img src={REACT_APP_LOWCODER_CUSTOM_LOGO_SQUARE } height={24} width={24} alt="logo" /> :<LogoIcon /> :
295-
<LogoHome />}
293+
{/* {REACT_APP_LOWCODER_SHOW_BRAND === 'true' ? REACT_APP_LOWCODER_CUSTOM_LOGO_SQUARE !== "" ? <img src={REACT_APP_LOWCODER_CUSTOM_LOGO_SQUARE } height={24} width={24} alt="logo" /> :<LogoIcon /> : <LogoHome />} */}
294+
<LogoHome />
296295
</StyledLink>
297296
{editName ? (
298297
<Wrapper>
@@ -434,9 +433,8 @@ export function AppHeader() {
434433
const brandingConfig = useSelector(getBrandingConfig);
435434
const headerStart = (
436435
<StyledLink onClick={() => history.push(ALL_APPLICATIONS_URL)}>
437-
{REACT_APP_LOWCODER_SHOW_BRAND === 'true' ?
438-
REACT_APP_LOWCODER_CUSTOM_LOGO !== "" ? <img src={REACT_APP_LOWCODER_CUSTOM_LOGO} height={28} alt="logo" /> :<LogoWithName branding={!user.orgDev} /> :
439-
<LogoHome />}
436+
{/* {REACT_APP_LOWCODER_SHOW_BRAND === 'true' ? REACT_APP_LOWCODER_CUSTOM_LOGO !== "" ? <img src={REACT_APP_LOWCODER_CUSTOM_LOGO} height={28} alt="logo" /> :<LogoWithName branding={!user.orgDev} /> : <LogoHome />} */}
437+
<LogoHome />
440438
</StyledLink>
441439
);
442440
const headerEnd = <HeaderProfile user={user} />;

client/packages/lowcoder/src/pages/userAuth/authUtils.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ import {
2121
ThirdPartyAuthType,
2222
ThirdPartyConfigType,
2323
} from "constants/authConstants";
24+
import history from "util/history";
2425

2526
export const AuthContext = createContext<{
2627
systemConfig?: SystemConfig;
2728
inviteInfo?: AuthInviteInfo;
2829
thirdPartyAuthError?: boolean;
30+
fetchUserAfterAuthSuccess?: () => void;
2931
}>(undefined as any);
3032

3133
export const getSafeAuthRedirectURL = (redirectUrl: string | null) => {
@@ -39,15 +41,21 @@ export const getSafeAuthRedirectURL = (redirectUrl: string | null) => {
3941
export function useAuthSubmit(
4042
requestFunc: () => AxiosPromise<ApiResponse>,
4143
infoCompleteCheck: boolean,
42-
redirectUrl: string | null
44+
redirectUrl: string | null,
45+
onAuthSuccess?: () => void,
4346
) {
4447
const [loading, setLoading] = useState(false);
4548
return {
4649
loading: loading,
4750
onSubmit: () => {
4851
setLoading(true);
4952
requestFunc()
50-
.then((resp) => authRespValidate(resp, infoCompleteCheck, redirectUrl))
53+
.then((resp) => authRespValidate(
54+
resp,
55+
infoCompleteCheck,
56+
redirectUrl,
57+
onAuthSuccess,
58+
))
5159
.catch((e) => {
5260
messageInstance.error(e.message);
5361
})
@@ -66,7 +74,8 @@ export function useAuthSubmit(
6674
export function authRespValidate(
6775
resp: AxiosResponse<ApiResponse>,
6876
infoCompleteCheck: boolean,
69-
redirectUrl: string | null
77+
redirectUrl: string | null,
78+
onAuthSuccess?: () => void
7079
) {
7180
let replaceUrl = redirectUrl || BASE_URL;
7281
if (infoCompleteCheck) {
@@ -76,7 +85,8 @@ export function authRespValidate(
7685
: USER_INFO_COMPLETION;
7786
}
7887
if (doValidResponse(resp)) {
79-
window.location.replace(replaceUrl);
88+
onAuthSuccess?.();
89+
history.replace(replaceUrl);
8090
} else if (
8191
resp.data.code === SERVER_ERROR_CODES.EXCEED_MAX_USER_ORG_COUNT ||
8292
resp.data.code === SERVER_ERROR_CODES.ALREADY_IN_ORGANIZATION

client/packages/lowcoder/src/pages/userAuth/formLogin.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function FormLogin(props: FormLoginProps) {
3232
const [account, setAccount] = useState("");
3333
const [password, setPassword] = useState("");
3434
const redirectUrl = useRedirectUrl();
35-
const { systemConfig, inviteInfo } = useContext(AuthContext);
35+
const { systemConfig, inviteInfo, fetchUserAfterAuthSuccess } = useContext(AuthContext);
3636
const invitationId = inviteInfo?.invitationId;
3737
const authId = systemConfig?.form.id;
3838
const location = useLocation();
@@ -49,7 +49,8 @@ export default function FormLogin(props: FormLoginProps) {
4949
authId,
5050
}),
5151
false,
52-
redirectUrl
52+
redirectUrl,
53+
fetchUserAfterAuthSuccess,
5354
);
5455

5556
return (

client/packages/lowcoder/src/pages/userAuth/index.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { AuthRoutes } from "@lowcoder-ee/constants/authConstants";
88
import { AuthLocationState } from "constants/authConstants";
99
import { ProductLoading } from "components/ProductLoading";
1010
import { fetchConfigAction } from "redux/reduxActions/configActions";
11+
import { fetchUserAction } from "redux/reduxActions/userActions";
1112
import _ from "lodash";
1213

1314
export default function UserAuth() {
@@ -34,12 +35,17 @@ export default function UserAuth() {
3435
return <ProductLoading hideHeader />;
3536
}
3637

38+
const fetchUserAfterAuthSuccess = () => {
39+
dispatch(fetchUserAction());
40+
}
41+
3742
return (
3843
<AuthContext.Provider
3944
value={{
4045
systemConfig: systemConfig,
4146
inviteInfo: location.state?.inviteInfo,
4247
thirdPartyAuthError: location.state?.thirdPartyAuthError,
48+
fetchUserAfterAuthSuccess,
4349
}}
4450
>
4551
<Switch location={location}>

client/packages/lowcoder/src/pages/userAuth/login.tsx

+3-8
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,15 @@ function Login() {
131131
loginCardView = thirdPartyLoginView;
132132
}
133133

134-
const loginHeading = REACT_APP_LOWCODER_CUSTOM_AUTH_WELCOME_TEXT !== ""
135-
? REACT_APP_LOWCODER_CUSTOM_AUTH_WELCOME_TEXT
136-
: getLoginTitle(inviteInfo?.createUserName, systemConfig?.branding?.brandName)
137-
138-
const loginSubHeading = REACT_APP_LOWCODER_CUSTOM_AUTH_WELCOME_TEXT !== ""
139-
? trans("userAuth.poweredByLowcoder")
140-
: ''
134+
const loginHeading = getLoginTitle(inviteInfo?.createUserName, systemConfig?.branding?.brandName)
135+
const loginSubHeading = '' // REACT_APP_LOWCODER_CUSTOM_AUTH_WELCOME_TEXT !== "" ? trans("userAuth.poweredByLowcoder") : ''
141136

142137
return (
143138
<AuthContainer
144139
heading={loginHeading}
145140
subHeading={loginSubHeading}
146141
>
147-
{loginCardView}
142+
<FormLogin organizationId={organizationId} />
148143
</AuthContainer>
149144
);
150145
}

0 commit comments

Comments
 (0)