Skip to content

Commit e013a68

Browse files
allow option to set FE url and org-id in embedded apps
1 parent 7584d20 commit e013a68

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

client/packages/lowcoder-sdk-webpack-bundle/index.jsx

+12
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ for (
3737
[i]?.querySelector(".locoder-backend-url")?.value ||
3838
"https://api-service.lowcoder.cloud"
3939
}
40+
webUrl={
41+
document
42+
.querySelectorAll(".lowcoder-module-container")
43+
[i]?.querySelector(".locoder-frontend-url")?.value ||
44+
"https://app.lowcoder.cloud"
45+
}
46+
orgId={
47+
document
48+
.querySelectorAll(".lowcoder-module-container")
49+
[i]?.querySelector(".locoder-org-id")?.value ||
50+
undefined
51+
}
4052
/>
4153
);
4254
}

client/packages/lowcoder/src/appView/AppViewInstance.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export interface AppViewInstanceOptions<I = any> {
3535
baseUrl?: string;
3636
webUrl?: string;
3737
moduleInputs?: I;
38+
orgId?: string;
3839
}
3940

4041
let isAuthButtonClicked = false;
@@ -55,6 +56,9 @@ export class AppViewInstance<I = any, O = any> {
5556
if (this.options.baseUrl) {
5657
sdkConfig.baseURL = this.options.baseUrl;
5758
}
59+
if (this.options.webUrl) {
60+
sdkConfig.webUrl = this.options.webUrl;
61+
}
5862

5963
this.dataPromise = this.loadData();
6064
this.render();
@@ -86,7 +90,7 @@ export class AppViewInstance<I = any, O = any> {
8690
[AuthSearchParams.redirectUrl]: encodeURIComponent(window.location.href),
8791
[AuthSearchParams.loginType]: null,
8892
})
89-
// window.location.href = `${webUrl}${AUTH_LOGIN_URL}`;
93+
9094
this.authorizedUser = false;
9195
return {
9296
data: {
@@ -155,6 +159,10 @@ export class AppViewInstance<I = any, O = any> {
155159

156160
private async render() {
157161
const data = await this.dataPromise;
162+
const loginUrl = this.options.orgId
163+
? `${this.options.webUrl}/org/${this.options.orgId}/auth/login`
164+
: `${this.options.webUrl}${AUTH_LOGIN_URL}`;
165+
158166
this.root.render(
159167
this.authorizedUser ? (
160168
<StyleSheetManager target={this.node as HTMLElement}>
@@ -177,7 +185,7 @@ export class AppViewInstance<I = any, O = any> {
177185
buttonType="primary"
178186
onClick={() => {
179187
isAuthButtonClicked = true;
180-
window.open(`${this.options.webUrl}${AUTH_LOGIN_URL}`, '_blank');
188+
window.open(loginUrl, '_blank');
181189
this.render();
182190
}}
183191
>

client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComps/columnBooleanComp.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const Wrapper = styled.div`
2020
`;
2121

2222
const IconWrapper = styled.div<{ $style: CheckboxStyleType; $ifChecked: boolean }>`
23+
pointer-events: none;
2324
height: 22px;
2425
svg {
2526
width: 14px;
@@ -87,7 +88,10 @@ export const BooleanComp = (function () {
8788
const CheckBoxComp = () => {
8889
const style = useStyle(CheckboxStyle);
8990
return (
90-
<IconWrapper $style={style} $ifChecked={value}>
91+
<IconWrapper
92+
$style={style}
93+
$ifChecked={value}
94+
>
9195
{value ? (
9296
<TableCheckedIcon />
9397
) : props.falseValues === "x" ? (
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
interface SDKConfig {
22
baseURL: string;
3+
webUrl: string;
34
}
45

56
export const sdkConfig: SDKConfig = {
67
baseURL: "",
8+
webUrl: "",
79
};

0 commit comments

Comments
 (0)