Skip to content

Commit 824cbec

Browse files
author
FalkWolsky
committed
Introducing EE Version - active Development
1 parent 6a1df31 commit 824cbec

File tree

15 files changed

+49
-33
lines changed

15 files changed

+49
-33
lines changed

client/config/test/jest.config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@ export function currentDirName(importMetaUrl) {
66
return dirname(fileURLToPath(importMetaUrl));
77
}
88

9-
109
const globals = {};
1110
buildVars.forEach(({ name, defaultValue }) => {
1211
globals[name] = process.env[name] || defaultValue;
1312
});
14-
const edition = process.env.REACT_APP_EDITION;
15-
const isEEGlobal = edition === "enterprise-global";
16-
const isEE = edition === "enterprise" || isEEGlobal;
1713
const currentDir = currentDirName(import.meta.url);
1814

1915
export default {
@@ -22,8 +18,7 @@ export default {
2218
"react-markdown": path.resolve(currentDir, "./mocks/react-markdown.js"),
2319
"\\.md\\?url$": path.resolve(currentDir, "./mocks/markdown-url-module.js"),
2420
"^@lowcoder-ee(.*)$": path.resolve(
25-
currentDir,
26-
isEE ? "../../packages/lowcoder/src/ee/$1" : "../../packages/lowcoder/src/$1"
21+
currentDir, "../../packages/lowcoder/src/$1"
2722
),
2823
"lowcoder-sdk": path.resolve(currentDir, "../../packages/lowcoder/src/index.sdk"),
2924
},

client/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"start": "yarn workspace lowcoder start",
1414
"start-win": "LOWCODER_API_SERVICE_URL=http://localhost:3000 yarn start",
1515
"start:ee": "REACT_APP_EDITION=enterprise yarn workspace lowcoder start",
16-
"start:ee-global": "REACT_APP_EDITION=enterprise-global yarn workspace lowcoder start",
1716
"build": "yarn node ./scripts/build.js",
1817
"test": "jest && yarn workspace lowcoder-comps test",
1918
"prepare": "yarn workspace lowcoder prepare",

client/packages/lowcoder-design/src/icons/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ export { ReactComponent as RecyclerIcon } from "./remix/delete-bin-line.svg";
315315
export { ReactComponent as MarketplaceIcon } from "./icon-application-marketplace.svg";
316316
export { ReactComponent as FavoritesIcon } from "./icon-application-favorites.svg";
317317
export { ReactComponent as HomeSettingIcon } from "./remix/settings-4-line.svg";
318+
export { ReactComponent as EnterpriseIcon } from "./remix/earth-line.svg";
318319

319320

320321
// new

client/packages/lowcoder/src/app.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ import {
1414
IMPORT_APP_FROM_TEMPLATE_URL,
1515
INVITE_LANDING_URL,
1616
isAuthUnRequired,
17-
MARKETPLACE_TYPE_URL,
1817
MARKETPLACE_URL,
1918
ORG_AUTH_LOGIN_URL,
2019
ORG_AUTH_REGISTER_URL,
2120
QUERY_LIBRARY_URL,
2221
SETTING,
2322
TRASH_URL,
2423
USER_AUTH_URL,
24+
ADMIN_APP_URL,
2525
} from "constants/routesURL";
26+
2627
import React from "react";
2728
import { createRoot } from "react-dom/client";
2829
import { Helmet } from "react-helmet";
@@ -38,7 +39,7 @@ import LazyRoute from "components/LazyRoute";
3839
import AppFromTemplate from "pages/ApplicationV2/AppFromTemplate";
3940
import AppEditor from "pages/editor/AppEditor";
4041
import { getAntdLocale } from "i18n/antdLocale";
41-
import { CodeEditorTooltipContainer } from "base/codeEditor/codeEditor";
42+
// import { CodeEditorTooltipContainer } from "base/codeEditor/codeEditor";
4243
import { ProductLoading } from "components/ProductLoading";
4344
import { language, trans } from "i18n";
4445
import { loadComps } from "comps";
@@ -155,6 +156,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
155156
TRASH_URL,
156157
SETTING,
157158
MARKETPLACE_URL,
159+
ADMIN_APP_URL,
158160
]}
159161
// component={ApplicationListPage}
160162
component={ApplicationHome}

client/packages/lowcoder/src/comps/comps/gridLayoutComp/canvasView.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { ScrollBar } from "lowcoder-design";
2323

2424
const UICompContainer = styled.div<{ $maxWidth?: number; readOnly?: boolean; $bgColor: string }>`
2525
height: 100%;
26+
min-height: 100vh;
2627
margin: 0 auto;
2728
max-width: ${(props) => props.$maxWidth || 1600}px;
2829
background-color: ${(props) => props.$bgColor};

client/packages/lowcoder/src/comps/comps/remoteComp/loaders.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ async function npmLoader(
1111
remoteInfo: RemoteCompInfo
1212
): Promise<CompConstructor | null> {
1313

14-
console.log("remoteInfo: ", remoteInfo);
15-
1614
// Falk: removed "packageVersion = "latest" as default value fir packageVersion - to ensure no automatic version jumping.
15+
const localPackageVersion = remoteInfo.packageVersion || "latest";
1716

1817
const { packageName, packageVersion, compName } = remoteInfo;
19-
const entry = `${NPM_PLUGIN_ASSETS_BASE_URL}/${packageName}@${packageVersion}/index.js`;
18+
const entry = `${NPM_PLUGIN_ASSETS_BASE_URL}/${packageName}@${localPackageVersion}/index.js`;
2019
// const entry = `../../../../../public/package/index.js`;
2120
// console.log("Entry", entry);
2221
try {

client/packages/lowcoder/src/constants/applicationConstants.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ export interface AppPermissionInfo {
130130
publicToMarketplace: boolean;
131131
}
132132

133-
export type AppViewMode = "edit" | "preview" | "view" | "view_marketplace";
133+
// adding viewMode for marketplace and adminMode for Admin area use
134+
export type AppViewMode = "edit" | "preview" | "view" | "view_marketplace" | "admin";
134135

135136
export type AppPathParams = {
136137
viewMode: AppViewMode;

client/packages/lowcoder/src/constants/routesURL.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const PERMISSION_SETTING_DETAIL = `${PERMISSION_SETTING}/:groupId`;
2020
export const ORGANIZATION_SETTING_DETAIL = `${ORGANIZATION_SETTING}/:orgId`;
2121

2222
export const ALL_APPLICATIONS_URL = "/apps";
23+
export const ADMIN_APP_URL = "/ee/:applicationId/:viewMode";
2324
export const APPLICATION_MARKETPLACE_URL = `https://app.lowcoder.cloud/apps`;
2425
export const MODULE_APPLICATIONS_URL = "/apps/module";
2526
export const MARKETPLACE_URL = `/marketplace`;

client/packages/lowcoder/src/i18n/locales/en.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,8 @@ export const en = {
15851585
"oauthProviders": "User Authentication",
15861586
"appUsage": "App Usage Logs",
15871587
"environments": "Environments",
1588-
"premium": "Premium"
1588+
"premium": "Premium",
1589+
"AppUsage": "Global App Usage",
15891590
},
15901591

15911592

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

+19-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
QUERY_LIBRARY_URL,
1010
SETTING,
1111
TRASH_URL,
12+
ADMIN_APP_URL
1213
} from "constants/routesURL";
1314
import { getUser, isFetchingUser } from "redux/selectors/usersSelectors";
1415
import { useDispatch, useSelector } from "react-redux";
@@ -26,7 +27,8 @@ import {
2627
PointIcon,
2728
RecyclerIcon,
2829
MarketplaceIcon,
29-
AppsIcon
30+
AppsIcon,
31+
EnterpriseIcon
3032
} from "lowcoder-design";
3133
import React, { useEffect, useState } from "react";
3234
import { fetchAllApplications, fetchHomeData } from "redux/reduxActions/applicationActions";
@@ -53,6 +55,10 @@ import { foldersSelector } from "../../redux/selectors/folderSelector";
5355
import Setting from "pages/setting";
5456
import { TypographyText } from "../../components/TypographyText";
5557
import { messageInstance } from "lowcoder-design";
58+
import { isEE } from "util/envUtils";
59+
60+
// adding App Editor, so we can show Apps inside the Admin Area
61+
import AppEditor from "../editor/AppEditor";
5662

5763
const TabLabel = styled.div`
5864
font-weight: 500;
@@ -408,6 +414,18 @@ export default function ApplicationHome() {
408414
},
409415
],
410416
},
417+
isEE() ? {
418+
items: [
419+
{
420+
text: <TabLabel>{trans("settings.AppUsage")}</TabLabel>,
421+
routePath: "/ee/6600ae8724a23f365ba2ed4c/admin",
422+
routePathExact: false,
423+
routeComp: AppEditor,
424+
icon: ({ selected, ...otherProps }) => selected ? ( <EnterpriseIcon {...otherProps} width={"24px"}/> ) : ( <EnterpriseIcon {...otherProps} width={"24px"}/> ),
425+
visible: ({ user }) => user.orgDev,
426+
},
427+
],
428+
} : { items: [] },
411429
]}
412430
/>
413431
{user.orgDev && (

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

+10-8
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ import { DatasourceApi } from "api/datasourceApi";
3030

3131
export default function AppEditor() {
3232
const showAppSnapshot = useSelector(showAppSnapshotSelector);
33-
const isUserViewMode = useUserViewMode();
3433
const params = useParams<AppPathParams>();
35-
const applicationId = params.applicationId;
36-
const viewMode = params.viewMode === "view" ? "published" : params.viewMode === "view_marketplace" ? "view_marketplace" : "editing";
34+
const isUserViewModeCheck = useUserViewMode();
35+
const isUserViewMode = params.viewMode ? isUserViewModeCheck : true;
36+
const applicationId = params.applicationId || window.location.pathname.split("/")[2];
37+
const paramViewMode = params.viewMode || window.location.pathname.split("/")[3];
38+
const viewMode = (paramViewMode === "view" || paramViewMode === "admin") ? "published" : paramViewMode === "view_marketplace" ? "view_marketplace" : "editing";
3739
const currentUser = useSelector(getUser);
3840
const dispatch = useDispatch();
3941
const fetchOrgGroupsFinished = useSelector(getFetchOrgGroupsFinished);
@@ -42,7 +44,7 @@ export default function AppEditor() {
4244
const firstRendered = useRef(false);
4345
const [isDataSourcePluginRegistered, setIsDataSourcePluginRegistered] = useState(false);
4446

45-
setGlobalSettings({ applicationId, isViewMode: params.viewMode === "view" });
47+
setGlobalSettings({ applicationId, isViewMode: paramViewMode === "view" });
4648

4749
if (!firstRendered.current) {
4850
perfClear();
@@ -69,19 +71,19 @@ export default function AppEditor() {
6971

7072
// fetch dataSource and plugin
7173
useEffect(() => {
72-
if (!orgId || params.viewMode !== "edit") {
74+
if (!orgId || paramViewMode !== "edit") {
7375
return;
7476
}
7577
dispatch(fetchDataSourceTypes({ organizationId: orgId }));
7678
dispatch(fetchFolderElements({}));
77-
}, [dispatch, orgId, params.viewMode]);
79+
}, [dispatch, orgId, paramViewMode]);
7880

7981
useEffect(() => {
80-
if (applicationId && params.viewMode === "edit") {
82+
if (applicationId && paramViewMode === "edit") {
8183
dispatch(fetchDataSourceByApp({ applicationId: applicationId }));
8284
dispatch(fetchQueryLibraryDropdown());
8385
}
84-
}, [dispatch, applicationId, params.viewMode]);
86+
}, [dispatch, applicationId, paramViewMode]);
8587

8688
useEffect(() => {
8789
DatasourceApi.fetchJsDatasourceByApp(applicationId).then((res) => {

client/packages/lowcoder/src/pages/editor/appEditorInternal.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export function AppEditorInternalView(props: AppEditorInternalViewProps) {
132132
readOnly,
133133
appType: appInfo.appType,
134134
applicationId: appInfo.id,
135+
hideHeader: window.location.pathname.split("/")[3] === "admin",
135136
...extraExternalEditorState,
136137
}));
137138
}, [compInstance?.history, extraExternalEditorState, readOnly, appInfo.appType, appInfo.id]);
@@ -146,8 +147,10 @@ export function AppEditorInternalView(props: AppEditorInternalViewProps) {
146147
!compInstance || !compInstance.comp || !compInstance.comp.preloaded || props.loading;
147148

148149
return loading ? (
150+
window.location.pathname.split("/")[3] === "admin" ? <div></div> :
149151
<EditorSkeletonView />
150152
) : (
153+
// Falk - here we could add the language choise?
151154
<ConfigProvider locale={getAntdLocale()}>
152155
<ExternalEditorContext.Provider value={externalEditorState}>
153156
{compInstance?.comp?.getView()}

client/packages/lowcoder/src/util/envUtils.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export function developEnv(): boolean {
1313
/**
1414
* is enterprise edition
1515
*/
16+
// Falk: TODO: check EE by API Call
1617
export function isEE(): boolean {
1718
return REACT_APP_EDITION === "enterprise" || REACT_APP_EDITION === "enterprise-global";
1819
}

client/packages/lowcoder/vite.config.mts

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ dotenv.config();
1717
const apiProxyTarget = process.env.LOWCODER_API_SERVICE_URL;
1818
const nodeServiceApiProxyTarget = process.env.NODE_SERVICE_API_PROXY_TARGET;
1919
const nodeEnv = process.env.NODE_ENV ?? "development";
20-
const edition = process.env.REACT_APP_EDITION;
21-
const isEEGlobal = edition === "enterprise-global";
22-
const isEE = edition === "enterprise" || isEEGlobal;
2320
const isDev = nodeEnv === "development";
2421
const isVisualizerEnabled = !!process.env.ENABLE_VISUALIZER;
2522
// the file was never created
@@ -61,8 +58,7 @@ export const viteConfig: UserConfig = {
6158
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"],
6259
alias: {
6360
"@lowcoder-ee": path.resolve(
64-
__dirname,
65-
isEE ? `../lowcoder/src/${isEEGlobal ? "ee-global" : "ee"}` : "../lowcoder/src"
61+
__dirname, "../lowcoder/src"
6662
),
6763
},
6864
},

client/packages/lowcoder/vite.config.mts.timestamp-1702455580530-4609d841cb7.mjs

+1-5
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ dotenv.config();
173173
var apiProxyTarget = process.env.LOWCODER_API_SERVICE_URL;
174174
var nodeServiceApiProxyTarget = process.env.NODE_SERVICE_API_PROXY_TARGET;
175175
var nodeEnv = process.env.NODE_ENV ?? "development";
176-
var edition = process.env.REACT_APP_EDITION;
177-
var isEEGlobal = edition === "enterprise-global";
178-
var isEE = edition === "enterprise" || isEEGlobal;
179176
var isDev = nodeEnv === "development";
180177
var isVisualizerEnabled = !!process.env.ENABLE_VISUALIZER;
181178
var browserCheckFileName = `browser-check.js`;
@@ -209,8 +206,7 @@ var viteConfig = {
209206
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"],
210207
alias: {
211208
"@lowcoder-ee": path.resolve(
212-
__vite_injected_original_dirname,
213-
isEE ? `../lowcoder/src/${isEEGlobal ? "ee-global" : "ee"}` : "../lowcoder/src"
209+
__vite_injected_original_dirname, "../lowcoder/src"
214210
)
215211
}
216212
},

0 commit comments

Comments
 (0)