Skip to content

Commit d0161d1

Browse files
committed
Added features that build only view
1 parent f52fd50 commit d0161d1

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ declare var numbro: any;
3333
declare var uuid: any;
3434
declare var PUBLIC_URL: string;
3535
declare var REACT_APP_EDITION: string;
36+
declare var REACT_APP_VIEW_MODE: string;
3637
declare var REACT_APP_LANGUAGES: string;
3738
declare var REACT_APP_COMMIT_ID: string;
3839
declare var REACT_APP_API_SERVICE_URL: string;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,8 @@ export const buildVars = [
5555
name: "REACT_APP_DISABLE_JS_SANDBOX",
5656
defaultValue: "",
5757
},
58+
{
59+
name: "REACT_APP_VIEW_MODE",
60+
defaultValue: "admin",
61+
},
5862
];

client/packages/lowcoder/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ debug(`REACT_APP_ENV:, ${REACT_APP_ENV}`);
4141
debug(`REACT_APP_LOG_LEVEL:, ${REACT_APP_LOG_LEVEL}`);
4242
initTranslatorDesign().then(() => {
4343
initTranslator().then(async () => {
44-
if (!window.location.href.includes("view")) {
45-
const bootstrap = await import("./bootstrap/admin/app").then(module => module.bootstrap);
46-
bootstrap();
44+
let bootstrap;
45+
if (REACT_APP_VIEW_MODE === "view") {
46+
bootstrap = await import("./bootstrap/view/app").then(module => module.bootstrap);
4747
} else {
48-
const bootstrap = await import("./bootstrap/view/app").then(module => module.bootstrap);
49-
bootstrap();
48+
bootstrap = await import("./bootstrap/admin/app").then(module => module.bootstrap);
5049
}
50+
bootstrap();
5151
})
5252
})
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
export const viewMode = () => window.location.href.includes("edit") ? "edit" : window.location.href.includes("view") ? "view" : "admin"
1+
export const viewMode = () => REACT_APP_VIEW_MODE;
2+
export const viewModeTriple = () => viewMode() === "view" ? "view" : window.location.href.includes("edit") ? "edit" : "admin";
23
export const getLanguage = (): string => {
34
return localStorage.getItem('lowcoder_uiLanguage') || 'en';
45
}

0 commit comments

Comments
 (0)