Skip to content

Commit cbd7ab4

Browse files
raheeliftikhar5ludomikula
authored andcommitted
update navigations relative to base path
1 parent ba05799 commit cbd7ab4

File tree

18 files changed

+38
-25
lines changed

18 files changed

+38
-25
lines changed

client/packages/lowcoder/src/comps/comps/appSettingsComp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { DEFAULT_ROW_COUNT } from "@lowcoder-ee/layout/calculateUtils";
2626
import { AppSettingContext } from "../utils/appSettingContext";
2727
import { currentApplication, isPublicApplication } from "@lowcoder-ee/redux/selectors/applicationSelector";
2828
import { isAggregationApp } from "util/appUtils";
29+
import history from "@lowcoder-ee/util/history";
2930

3031
const TITLE = trans("appSetting.title");
3132
const USER_DEFINE = "__USER_DEFINE";
@@ -422,7 +423,7 @@ function AppCanvasSettingsModal(props: ChildrenInstance) {
422423
preNode={() => (
423424
isPublicApp ? <></> : (
424425
<>
425-
<CreateDiv onClick={() => window.open(THEME_SETTING)}>
426+
<CreateDiv onClick={() => window.open(history.createHref({pathname: THEME_SETTING}))}>
426427
<StyledAddIcon />
427428
{trans("appSetting.themeCreate")}
428429
</CreateDiv>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { CrownFilled } from "@ant-design/icons";
3232
import { SUBSCRIPTION_SETTING } from "@lowcoder-ee/constants/routesURL";
3333
import { useSimpleSubscriptionContext } from "@lowcoder-ee/util/context/SimpleSubscriptionContext";
3434
import { SubscriptionProductsEnum } from "@lowcoder-ee/constants/subscriptionConstants";
35+
import history from "@lowcoder-ee/util/history";
3536

3637
const ButtonWrapper = styled.div`
3738
width: 100%;
@@ -397,7 +398,7 @@ export const IconPicker = (props: {
397398
title: trans("iconScout.buySubscriptionTitle"),
398399
content: trans("iconScout.buySubscriptionContent"),
399400
onConfirm: () => {
400-
window.open(SUBSCRIPTION_SETTING, "_blank");
401+
window.open(history.createHref({pathname: SUBSCRIPTION_SETTING}), "_blank");
401402
},
402403
confirmBtnType: "primary",
403404
okText: trans("iconScout.buySubscriptionButton"),

client/packages/lowcoder/src/comps/utils/gridCompOperator.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { pasteKey, undoKey } from "util/keyUtils";
2828
import { genRandomKey } from "./idGenerator";
2929
import { getLatestVersion, getRemoteCompType, parseCompType } from "./remote";
3030
import { APPLICATION_VIEW_URL } from "@lowcoder-ee/constants/routesURL";
31+
import history from "@lowcoder-ee/util/history";
3132

3233
export type CopyCompType = {
3334
layout: LayoutItem;
@@ -195,7 +196,7 @@ export class GridCompOperator {
195196
static editComp(editorState: EditorState) {
196197
const selectedComp = Object.values(editorState.selectedComps())[0];
197198
const applicationId = selectedComp.children.comp.children.appId.value
198-
window.open(APPLICATION_VIEW_URL(applicationId, "edit"))
199+
window.open(history.createHref({pathname: APPLICATION_VIEW_URL(applicationId, "edit")}))
199200
}
200201

201202
static cutComp(editorState: EditorState, compRecords: Record<string, Comp>) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { foldersSelector } from "redux/selectors/folderSelector";
1010
import { AppTypeEnum } from "constants/applicationConstants";
1111
import { TypeName } from "./headerStartDropdown";
1212
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances";
13+
import history from "@lowcoder-ee/util/history";
1314

1415
type CopyModalProps = {
1516
visible: boolean;
@@ -62,7 +63,7 @@ export function CopyModal(props: CopyModalProps) {
6263
.then(async (response) => {
6364
if (validateResponse(response) && response.data.data) {
6465
window.open(
65-
APPLICATION_VIEW_URL(response.data.data.applicationInfoView.applicationId, "edit")
66+
history.createHref({pathname: APPLICATION_VIEW_URL(response.data.data.applicationInfoView.applicationId, "edit")})
6667
);
6768
window.location.reload();
6869
return response.data.data;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ const PreviewHeaderComp = () => {
203203
onClick={() =>
204204
// redirection to app by JS will cause the problem that queries don't execute on initialization
205205
// so just open a new window.
206-
window.open(APPLICATION_VIEW_URL(applicationId, "edit"))
206+
window.open(history.createHref({pathname: APPLICATION_VIEW_URL(applicationId, "edit")}))
207207
}
208208
>
209209
<EditIcon />
@@ -215,7 +215,7 @@ const PreviewHeaderComp = () => {
215215
style={{ marginRight: !user.isAnonymous ? "24px" : "" }}
216216
buttonType="primary"
217217
onClick={() => {
218-
window.open(trans("template.cloneUrl") + templateId);
218+
window.open(history.createHref({pathname: trans("template.cloneUrl") + templateId}));
219219
}}
220220
>
221221
{trans("header.clone")}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ const AppEditorPublic = React.memo(() => {
6161
);
6262
const applicationId = useMemo(
6363
() => {
64-
const appId = params.applicationId || window.location.pathname.split("/")[2];
64+
const appId = params.applicationId || history.location.pathname.split("/")[2];
6565
return appId === 'public' ? PUBLIC_APP_ID : appId;
66-
}, [params.applicationId, window.location.pathname]
66+
}, [params.applicationId, history.location.pathname]
6767
);
6868
const paramViewMode = useMemo(
69-
() => params.viewMode || window.location.pathname.split("/")[3],
70-
[params.viewMode, window.location.pathname]
69+
() => params.viewMode || history.location.pathname.split("/")[3],
70+
[params.viewMode, history.location.pathname]
7171
);
7272
const viewMode = useMemo(
7373
() => (paramViewMode === "view" || paramViewMode === "admin")

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { getCurrentUser } from "redux/selectors/usersSelectors";
2727
import React from "react";
2828
import { isEqual } from "lodash";
2929
import { isPublicApplication } from "@lowcoder-ee/redux/selectors/applicationSelector";
30+
import history from "@lowcoder-ee/util/history";
3031

3132
/**
3233
* FIXME: optimize the logic of saving comps
@@ -187,7 +188,7 @@ export const AppEditorInternalView = React.memo((props: AppEditorInternalViewPro
187188
readOnly,
188189
appType: appInfo.appType,
189190
applicationId: appInfo.id,
190-
hideHeader: window.location.pathname.split("/")[3] === "admin",
191+
hideHeader: history.location.pathname.split("/")[3] === "admin",
191192
blockEditing,
192193
fetchApplication: fetchApplication,
193194
exportPublicAppToJson: isPublicApp ? exportPublicAppToJson : undefined,
@@ -232,7 +233,7 @@ export const AppEditorInternalView = React.memo((props: AppEditorInternalViewPro
232233
});
233234

234235
return loading ? (
235-
window.location.pathname.split("/")[3] === "admin" ? <div></div> :
236+
history.location.pathname.split("/")[3] === "admin" ? <div></div> :
236237
<EditorSkeletonView />
237238
) : (
238239
<ConfigProvider

client/packages/lowcoder/src/pages/editor/right/ModulePanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {DraggableTreeNode, DraggableTreeNodeItemRenderProps} from "@lowcoder-ee/
3131
import { EmptyContent } from "components/EmptyContent";
3232
import {deleteFolder, moveToFolder, updateFolder} from "@lowcoder-ee/redux/reduxActions/folderActions";
3333
import { isPublicApplication } from "@lowcoder-ee/redux/selectors/applicationSelector";
34+
import history from "@lowcoder-ee/util/history";
3435
const ItemWrapper = styled.div`
3536
display: flex;
3637
flex-direction: row;
@@ -736,7 +737,7 @@ export default function ModulePanel() {
736737
type={AppTypeEnum.Module}
737738
onSuccess={(app) => {
738739
const appId = app.applicationInfoView.applicationId;
739-
const url = APPLICATION_VIEW_URL(appId, "edit");
740+
const url = history.createHref({pathname: APPLICATION_VIEW_URL(appId, "edit")});
740741
window.open(url);
741742
}}
742743
/>

client/packages/lowcoder/src/pages/setting/environments/components/AppsTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ const AppsTab: React.FC<AppsTabProps> = ({ environment, workspaceId }) => {
225225
icon={<AuditOutlined />}
226226
onClick={(e) => {
227227
e.stopPropagation();
228-
const auditUrl = `/setting/audit?environmentId=${environment.environmentId}&orgId=${workspaceId}&appId=${app.applicationId}&pageSize=100&pageNum=1`;
228+
const auditUrl = history.createHref({pathname: `/setting/audit?environmentId=${environment.environmentId}&orgId=${workspaceId}&appId=${app.applicationId}&pageSize=100&pageNum=1`});
229229
window.open(auditUrl, '_blank');
230230
}}
231231
>

client/packages/lowcoder/src/pages/setting/environments/components/DataSourcesTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ const DataSourcesTab: React.FC<DataSourcesTabProps> = ({ environment, workspaceI
215215
icon={<AuditOutlined />}
216216
onClick={(e) => {
217217
e.stopPropagation();
218-
const auditUrl = `/setting/audit?environmentId=${environment.environmentId}&orgId=${workspaceId}&datasourceId=${dataSource.id}&pageSize=100&pageNum=1`;
218+
const auditUrl = history.createHref({pathname: `/setting/audit?environmentId=${environment.environmentId}&orgId=${workspaceId}&datasourceId=${dataSource.id}&pageSize=100&pageNum=1`});
219219
window.open(auditUrl, '_blank');
220220
}}
221221
>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy