Commit 6704e629 authored by chenshouchao's avatar chenshouchao

feat: 路由调试

parent 69f74273
...@@ -56,7 +56,7 @@ const getActorenvList = (params: { ...@@ -56,7 +56,7 @@ const getActorenvList = (params: {
const deleteActorenv = (params: {id: string}) => { const deleteActorenv = (params: {id: string}) => {
return request({ return request({
url:`${Api.API_ACTORENV_DELETE}/${params.id}`, url:`${Api.API_ACTORENV_DELETE}/${params.id}`,
method: "get", method: "delete",
}); });
}; };
......
...@@ -42,12 +42,18 @@ const useMyRouter = () => { ...@@ -42,12 +42,18 @@ const useMyRouter = () => {
} }
}); });
} }
for (let item of menuInfo.res.data) { for (let item of menuInfo.res.data) {
for (let route of item.routes) { for (let route of item.routes) {
route.element = elements[route.element] || NotFound; route.element = elements[route.element] || NotFound;
route.path = `/product/${item.id}${route.path}`; route.path = `/product/${item.id}${route.path}`;
if (Array.isArray(route.children)) {
route.children.forEach((childrenItem: any, index: number) => {
route.children[index].element = elements[childrenItem.element] || NotFound;
route.children[index].path = `${route.path}${childrenItem.path}`;
})
}
} }
console.log(item.routes)
permissionStore.setAddRoutes(item.routes); permissionStore.setAddRoutes(item.routes);
} }
menuStore.initMenu(menuInfo.res.data); menuStore.initMenu(menuInfo.res.data);
......
...@@ -13,6 +13,7 @@ import MenuLayout from "@/views/MenuLayout"; ...@@ -13,6 +13,7 @@ import MenuLayout from "@/views/MenuLayout";
import * as React from "react"; import * as React from "react";
import NotFound from "@/views/404"; import NotFound from "@/views/404";
import Demo from "@/views/demo"; import Demo from "@/views/demo";
import SeeEnv from "@/views/ResourceCenter/UserResources/UserResourcesEnvironment/SeeEnv";
import ProjectSetting from "@/views/Project/ProjectSetting"; import ProjectSetting from "@/views/Project/ProjectSetting";
import ProjectData from "@/views/Project/ProjectData"; import ProjectData from "@/views/Project/ProjectData";
import ProjectWorkbench from "@/views/Project/ProjectWorkbench"; import ProjectWorkbench from "@/views/Project/ProjectWorkbench";
...@@ -54,6 +55,7 @@ export const elements: { ...@@ -54,6 +55,7 @@ export const elements: {
Demo: Demo, Demo: Demo,
SeeTemplate: Demo, SeeTemplate: Demo,
UserResources: UserResources, UserResources: UserResources,
SeeEnv: SeeEnv,
ProjectSetting: ProjectSetting, ProjectSetting: ProjectSetting,
ProjectData: ProjectData, ProjectData: ProjectData,
ProjectWorkbench: ProjectWorkbench, ProjectWorkbench: ProjectWorkbench,
......
...@@ -8,10 +8,9 @@ import CloudEController from "@/api/fileserver/CloudEController"; ...@@ -8,10 +8,9 @@ import CloudEController from "@/api/fileserver/CloudEController";
import { useStores } from "@/store"; import { useStores } from "@/store";
import { toJS } from "mobx"; import { toJS } from "mobx";
import FullScreenDrawer from "@/components/CommonComponents/FullScreenDrawer"; import FullScreenDrawer from "@/components/CommonComponents/FullScreenDrawer";
import ChevronLeftIcon from '@mui/icons-material/ChevronLeft'; import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
import ChevronRightIcon from '@mui/icons-material/ChevronRight'; import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import useWindowSize from '@/hooks/useWindowSize' import useWindowSize from "@/hooks/useWindowSize";
type LogViewProps = { type LogViewProps = {
logs: any[]; logs: any[];
...@@ -20,6 +19,7 @@ type LogViewProps = { ...@@ -20,6 +19,7 @@ type LogViewProps = {
const LogView = (props: LogViewProps) => { const LogView = (props: LogViewProps) => {
const { logs, setShowLogView } = props; const { logs, setShowLogView } = props;
console.log(logs);
const { currentProjectStore } = useStores(); const { currentProjectStore } = useStores();
const { width, height } = useWindowSize(); const { width, height } = useWindowSize();
const fileToken = toJS(currentProjectStore.currentProjectInfo.filetoken); const fileToken = toJS(currentProjectStore.currentProjectInfo.filetoken);
...@@ -27,95 +27,98 @@ const LogView = (props: LogViewProps) => { ...@@ -27,95 +27,98 @@ const LogView = (props: LogViewProps) => {
// 当前选择的日志 // 当前选择的日志
const [logCurrent, setLogCurrent] = useState<number>(0); const [logCurrent, setLogCurrent] = useState<number>(0);
// 当前日志的内容文本 // 当前日志的内容文本
const [logText, setLogText] = useState('') const [logText, setLogText] = useState("");
// 当前日志路径 // 当前日志路径
const [logPath, setLogPath] = useState('') const [logPath, setLogPath] = useState("");
const [displacement, setDisplacement] = useState(0) const [displacement, setDisplacement] = useState(0);
const [middleDynamicWidth, setMiddleDynamicWidth] = useState(0) const [middleDynamicWidth, setMiddleDynamicWidth] = useState(0);
const [leftButtonColor, setLeftButtonColor] = useState('#585D62') const [leftButtonColor, setLeftButtonColor] = useState("#585D62");
const [rightButtonColor, setRightButtonColor] = useState('#585D62') const [rightButtonColor, setRightButtonColor] = useState("#585D62");
useEffect(() => { useEffect(() => {
setLogPath(logs[logCurrent]?.logPath) setLogPath(logs[logCurrent]?.logPath);
}, [logs]); }, [logs]);
// 请求日志文本 // 请求日志文本
useEffect(() => { useEffect(() => {
if (logPath) { if (logPath) {
const path = logPath.slice(12) const path = logPath.slice(12);
CloudEController.JobFileDownloadText( CloudEController.JobFileDownloadText(
path, path,
fileToken as string, fileToken as string,
projectId as string projectId as string
)?.then((res) => { )?.then((res) => {
setLogText(res.data) setLogText(res.data);
}) });
} else { } else {
setLogText("") setLogText("");
} }
}, [logPath]); }, [logPath]);
// 选择日志时改变日志路径 // 选择日志时改变日志路径
useEffect(() => { useEffect(() => {
setLogPath(logs[logCurrent]?.logPath) setLogPath(logs[logCurrent]?.logPath);
}, [logCurrent]); }, [logCurrent]);
//获取盒子的总宽度,用于滑动效果判断 //获取盒子的总宽度,用于滑动效果判断
useEffect(() => { useEffect(() => {
const box = document.getElementById('middleDynamic') const box = document.getElementById("middleDynamic");
setMiddleDynamicWidth(box ? box.offsetWidth : 0) setMiddleDynamicWidth(box ? box.offsetWidth : 0);
}, []) }, []);
useEffect(() => { useEffect(() => {
if (middleDynamicWidth < width - 97) { if (middleDynamicWidth < width - 97) {
setLeftButtonColor('#585D62') setLeftButtonColor("#585D62");
setRightButtonColor('#585D62') setRightButtonColor("#585D62");
} }
if (displacement === 0) { if (displacement === 0) {
setLeftButtonColor('#585D62') setLeftButtonColor("#585D62");
} else { } else {
setLeftButtonColor('#C0C5CD') setLeftButtonColor("#C0C5CD");
} }
if (middleDynamicWidth > width - 97 && displacement !== -middleDynamicWidth + width - 97) { if (
setRightButtonColor('#C0C5CD') middleDynamicWidth > width - 97 &&
displacement !== -middleDynamicWidth + width - 97
) {
setRightButtonColor("#C0C5CD");
} else { } else {
setRightButtonColor('#585D62') setRightButtonColor("#585D62");
} }
}, [width, middleDynamicWidth, displacement]) }, [width, middleDynamicWidth, displacement]);
// 下载当前日志 // 下载当前日志
const handleDownLoad = () => { const handleDownLoad = () => {
const path = logPath.slice(12) const path = logPath.slice(12);
CloudEController.JobFileDownload( CloudEController.JobFileDownload(
path, path,
fileToken as string, fileToken as string,
projectId as string projectId as string
); );
} };
const rightClick = () => { const rightClick = () => {
if (middleDynamicWidth < width - 97) { if (middleDynamicWidth < width - 97) {
return return;
} }
if (-displacement > middleDynamicWidth - width * 1.8 + 97) { if (-displacement > middleDynamicWidth - width * 1.8 + 97) {
setDisplacement(-middleDynamicWidth + width - 97) setDisplacement(-middleDynamicWidth + width - 97);
return return;
} }
const newDisplacement = displacement - width * 0.8; const newDisplacement = displacement - width * 0.8;
setDisplacement(newDisplacement) setDisplacement(newDisplacement);
} };
const leftClick = () => { const leftClick = () => {
if (-displacement < width * 0.8) { if (-displacement < width * 0.8) {
setDisplacement(0) setDisplacement(0);
return return;
} }
const newDisplacement = displacement + width * 0.8; const newDisplacement = displacement + width * 0.8;
setDisplacement(newDisplacement) setDisplacement(newDisplacement);
} };
return ( return (
<FullScreenDrawer handleClose={setShowLogView} zIndex={1002}> <FullScreenDrawer handleClose={setShowLogView} zIndex={1002}>
...@@ -125,14 +128,22 @@ const LogView = (props: LogViewProps) => { ...@@ -125,14 +128,22 @@ const LogView = (props: LogViewProps) => {
<div <div
className={style.leftButton} className={style.leftButton}
onClick={leftClick} onClick={leftClick}
style={{ color: leftButtonColor, cursor: leftButtonColor === '#585D62' ? 'default' : 'pointer' }} style={{
color: leftButtonColor,
cursor: leftButtonColor === "#585D62" ? "default" : "pointer",
}}
> >
<ChevronLeftIcon /> <ChevronLeftIcon />
</div> </div>
<div className={style.middleFixed}> <div className={style.middleFixed}>
<div className={style.middleDynamic} id='middleDynamic' style={{ left: `${displacement}px` }}> <div
className={style.middleDynamic}
id="middleDynamic"
style={{ left: `${displacement}px` }}
>
{logs.map((item: any, index: number) => { {logs.map((item: any, index: number) => {
return <MyTooltip return (
<MyTooltip
title={item.logName} title={item.logName}
placement="bottom" placement="bottom"
arrow={false} arrow={false}
...@@ -140,15 +151,19 @@ const LogView = (props: LogViewProps) => { ...@@ -140,15 +151,19 @@ const LogView = (props: LogViewProps) => {
> >
<div <div
key={index} key={index}
onClick={() => { setLogCurrent(index) }} onClick={() => {
setLogCurrent(index);
}}
className={classnames({ className={classnames({
[style.logTitle]: true, [style.logTitle]: true,
[style.logTitleSelected]: index === logCurrent, [style.logTitleSelected]: index === logCurrent,
})}> })}
>
<InsertDriveFileOutlinedIcon className={style.fileIcon} /> <InsertDriveFileOutlinedIcon className={style.fileIcon} />
<span className={style.logName}>{item.logName}</span> <span className={style.logName}>{item.logName}</span>
</div> </div>
</MyTooltip> </MyTooltip>
);
})} })}
</div> </div>
</div> </div>
...@@ -156,20 +171,21 @@ const LogView = (props: LogViewProps) => { ...@@ -156,20 +171,21 @@ const LogView = (props: LogViewProps) => {
<div <div
className={style.rightButton} className={style.rightButton}
onClick={rightClick} onClick={rightClick}
style={{ color: rightButtonColor, cursor: rightButtonColor === '#585D62' ? 'default' : 'pointer' }} style={{
color: rightButtonColor,
cursor: rightButtonColor === "#585D62" ? "default" : "pointer",
}}
> >
<ChevronRightIcon /> <ChevronRightIcon />
</div> </div>
</div> </div>
<div className={style.logViewContent}> <div className={style.logViewContent}>{logText}</div>
{logText}
</div>
<div className={style.logViewBottom}> <div className={style.logViewBottom}>
<MyButton text='下载当前日志' onClick={handleDownLoad} /> <MyButton text="下载当前日志" onClick={handleDownLoad} />
</div> </div>
</div> </div>
</FullScreenDrawer> </FullScreenDrawer>
) );
} };
export default LogView export default LogView;
\ No newline at end of file
const EnvironmentDetails = () => { const SeeEnv = () => {
return <div>EnvironmentDetails</div>; return <div>EnvironmentDetails</div>;
}; };
export default EnvironmentDetails; export default SeeEnv;
// 应用环境 // 应用环境
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import style from "./index.module.css"; import style from "./index.module.css";
import SearchInput from "@/components/BusinessComponents/SearchInput"; import SearchInput from "@/components/BusinessComponents/SearchInput";
import MySelect from "@/components/mui/MySelect"; import MySelect from "@/components/mui/MySelect";
...@@ -7,6 +8,7 @@ import MyButton from "@/components/mui/MyButton"; ...@@ -7,6 +8,7 @@ import MyButton from "@/components/mui/MyButton";
import MyTable from "@/components/mui/MyTableNew"; import MyTable from "@/components/mui/MyTableNew";
import useMyRequest from "@/hooks/useMyRequest"; import useMyRequest from "@/hooks/useMyRequest";
import { getActorenvList } from "@/api/resourceCenter"; import { getActorenvList } from "@/api/resourceCenter";
import Add from "@mui/icons-material/Add";
import moment from "moment"; import moment from "moment";
import jobFail from "@/assets/project/jobFail.svg"; import jobFail from "@/assets/project/jobFail.svg";
import jobRun from "@/assets/project/jobRun.svg"; import jobRun from "@/assets/project/jobRun.svg";
...@@ -15,6 +17,7 @@ import AddEnvironment from "./AddEnvironment"; ...@@ -15,6 +17,7 @@ import AddEnvironment from "./AddEnvironment";
import DeleteEnvironment from "./DeleteEnvironment"; import DeleteEnvironment from "./DeleteEnvironment";
const UserResourcesEnvironment = () => { const UserResourcesEnvironment = () => {
const navigate = useNavigate();
const [addOpen, setAddopen] = useState(false); const [addOpen, setAddopen] = useState(false);
const [title, setTitle] = useState(""); const [title, setTitle] = useState("");
const [type, setType] = useState<"BATCH" | "FLOW" | "">(""); const [type, setType] = useState<"BATCH" | "FLOW" | "">("");
...@@ -126,6 +129,16 @@ const UserResourcesEnvironment = () => { ...@@ -126,6 +129,16 @@ const UserResourcesEnvironment = () => {
setDeleteOpen(true); setDeleteOpen(true);
}; };
const hanleToSeeEnv = (item: any) => {
console.log("hanleToSeeEnv");
console.log(item.id);
// /product/userCenter/userInformation
// navigate("/product/resourceCenter/userResources/seeEnv", {
navigate("/product/userCenter/userInformation", {
state: { id: item.id },
});
};
const renderButtons = (item: any) => { const renderButtons = (item: any) => {
if (item.status === "FAILED") { if (item.status === "FAILED") {
return ( return (
...@@ -141,6 +154,7 @@ const UserResourcesEnvironment = () => { ...@@ -141,6 +154,7 @@ const UserResourcesEnvironment = () => {
}} }}
variant="text" variant="text"
size="medium" size="medium"
onClick={() => hanleToSeeEnv(item)}
/> />
<MyButton <MyButton
onClick={() => handleDelete(item)} onClick={() => handleDelete(item)}
...@@ -171,7 +185,7 @@ const UserResourcesEnvironment = () => { ...@@ -171,7 +185,7 @@ const UserResourcesEnvironment = () => {
}} }}
variant="text" variant="text"
size="medium" size="medium"
// onClick={() => hanleDownloadFile(item)} onClick={() => hanleToSeeEnv(item)}
/> />
); );
} }
...@@ -212,13 +226,8 @@ const UserResourcesEnvironment = () => { ...@@ -212,13 +226,8 @@ const UserResourcesEnvironment = () => {
<div className={style.topRight}> <div className={style.topRight}>
<MyButton <MyButton
text="构建应用环境" text="构建应用环境"
img={
<span
style={{ fontSize: "14px", marginRight: "8px" }}
className="iconfont icon-dianzan"
></span>
}
onClick={() => setAddopen(true)} onClick={() => setAddopen(true)}
startIcon={<Add />}
></MyButton> ></MyButton>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment