Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bkunyun
Commits
6704e629
Commit
6704e629
authored
Oct 19, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 路由调试
parent
69f74273
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
203 additions
and
171 deletions
+203
-171
resourceCenter.ts
src/api/resourceCenter.ts
+1
-1
useMyRouter.ts
src/components/MyRouter/useMyRouter.ts
+7
-1
index.ts
src/router/index.ts
+2
-0
index.tsx
src/views/Project/ProjectJobDetail/LogView/index.tsx
+175
-160
index.module.css
...esources/UserResourcesEnvironment/SeeEnv/index.module.css
+0
-0
index.tsx
...r/UserResources/UserResourcesEnvironment/SeeEnv/index.tsx
+2
-2
index.tsx
...ceCenter/UserResources/UserResourcesEnvironment/index.tsx
+16
-7
No files found.
src/api/resourceCenter.ts
View file @
6704e629
...
...
@@ -56,7 +56,7 @@ const getActorenvList = (params: {
const
deleteActorenv
=
(
params
:
{
id
:
string
})
=>
{
return
request
({
url
:
`
${
Api
.
API_ACTORENV_DELETE
}
/
${
params
.
id
}
`
,
method
:
"
get
"
,
method
:
"
delete
"
,
});
};
...
...
src/components/MyRouter/useMyRouter.ts
View file @
6704e629
...
...
@@ -42,12 +42,18 @@ const useMyRouter = () => {
}
});
}
for
(
let
item
of
menuInfo
.
res
.
data
)
{
for
(
let
route
of
item
.
routes
)
{
route
.
element
=
elements
[
route
.
element
]
||
NotFound
;
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
);
}
menuStore
.
initMenu
(
menuInfo
.
res
.
data
);
...
...
src/router/index.ts
View file @
6704e629
...
...
@@ -13,6 +13,7 @@ import MenuLayout from "@/views/MenuLayout";
import
*
as
React
from
"react"
;
import
NotFound
from
"@/views/404"
;
import
Demo
from
"@/views/demo"
;
import
SeeEnv
from
"@/views/ResourceCenter/UserResources/UserResourcesEnvironment/SeeEnv"
;
import
ProjectSetting
from
"@/views/Project/ProjectSetting"
;
import
ProjectData
from
"@/views/Project/ProjectData"
;
import
ProjectWorkbench
from
"@/views/Project/ProjectWorkbench"
;
...
...
@@ -54,6 +55,7 @@ export const elements: {
Demo
:
Demo
,
SeeTemplate
:
Demo
,
UserResources
:
UserResources
,
SeeEnv
:
SeeEnv
,
ProjectSetting
:
ProjectSetting
,
ProjectData
:
ProjectData
,
ProjectWorkbench
:
ProjectWorkbench
,
...
...
src/views/Project/ProjectJobDetail/LogView/index.tsx
View file @
6704e629
...
...
@@ -8,168 +8,184 @@ import CloudEController from "@/api/fileserver/CloudEController";
import
{
useStores
}
from
"@/store"
;
import
{
toJS
}
from
"mobx"
;
import
FullScreenDrawer
from
"@/components/CommonComponents/FullScreenDrawer"
;
import
ChevronLeftIcon
from
'@mui/icons-material/ChevronLeft'
;
import
ChevronRightIcon
from
'@mui/icons-material/ChevronRight'
;
import
useWindowSize
from
'@/hooks/useWindowSize'
import
ChevronLeftIcon
from
"@mui/icons-material/ChevronLeft"
;
import
ChevronRightIcon
from
"@mui/icons-material/ChevronRight"
;
import
useWindowSize
from
"@/hooks/useWindowSize"
;
type
LogViewProps
=
{
logs
:
any
[];
setShowLogView
:
any
;
logs
:
any
[];
setShowLogView
:
any
;
};
const
LogView
=
(
props
:
LogViewProps
)
=>
{
const
{
logs
,
setShowLogView
}
=
props
;
const
{
currentProjectStore
}
=
useStores
();
const
{
width
,
height
}
=
useWindowSize
();
const
fileToken
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
filetoken
);
const
projectId
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
// 当前选择的日志
const
[
logCurrent
,
setLogCurrent
]
=
useState
<
number
>
(
0
);
// 当前日志的内容文本
const
[
logText
,
setLogText
]
=
useState
(
''
)
// 当前日志路径
const
[
logPath
,
setLogPath
]
=
useState
(
''
)
const
[
displacement
,
setDisplacement
]
=
useState
(
0
)
const
[
middleDynamicWidth
,
setMiddleDynamicWidth
]
=
useState
(
0
)
const
[
leftButtonColor
,
setLeftButtonColor
]
=
useState
(
'#585D62'
)
const
[
rightButtonColor
,
setRightButtonColor
]
=
useState
(
'#585D62'
)
useEffect
(()
=>
{
setLogPath
(
logs
[
logCurrent
]?.
logPath
)
},
[
logs
]);
// 请求日志文本
useEffect
(()
=>
{
if
(
logPath
)
{
const
path
=
logPath
.
slice
(
12
)
CloudEController
.
JobFileDownloadText
(
path
,
fileToken
as
string
,
projectId
as
string
)?.
then
((
res
)
=>
{
setLogText
(
res
.
data
)
})
}
else
{
setLogText
(
""
)
}
},
[
logPath
]);
// 选择日志时改变日志路径
useEffect
(()
=>
{
setLogPath
(
logs
[
logCurrent
]?.
logPath
)
},
[
logCurrent
]);
//获取盒子的总宽度,用于滑动效果判断
useEffect
(()
=>
{
const
box
=
document
.
getElementById
(
'middleDynamic'
)
setMiddleDynamicWidth
(
box
?
box
.
offsetWidth
:
0
)
},
[])
useEffect
(()
=>
{
if
(
middleDynamicWidth
<
width
-
97
)
{
setLeftButtonColor
(
'#585D62'
)
setRightButtonColor
(
'#585D62'
)
}
if
(
displacement
===
0
)
{
setLeftButtonColor
(
'#585D62'
)
}
else
{
setLeftButtonColor
(
'#C0C5CD'
)
}
if
(
middleDynamicWidth
>
width
-
97
&&
displacement
!==
-
middleDynamicWidth
+
width
-
97
)
{
setRightButtonColor
(
'#C0C5CD'
)
}
else
{
setRightButtonColor
(
'#585D62'
)
}
},
[
width
,
middleDynamicWidth
,
displacement
])
// 下载当前日志
const
handleDownLoad
=
()
=>
{
const
path
=
logPath
.
slice
(
12
)
CloudEController
.
JobFileDownload
(
path
,
fileToken
as
string
,
projectId
as
string
);
}
const
rightClick
=
()
=>
{
if
(
middleDynamicWidth
<
width
-
97
)
{
return
}
if
(
-
displacement
>
middleDynamicWidth
-
width
*
1.8
+
97
)
{
setDisplacement
(
-
middleDynamicWidth
+
width
-
97
)
return
}
const
newDisplacement
=
displacement
-
width
*
0.8
;
setDisplacement
(
newDisplacement
)
}
const
leftClick
=
()
=>
{
if
(
-
displacement
<
width
*
0.8
)
{
setDisplacement
(
0
)
return
}
const
newDisplacement
=
displacement
+
width
*
0.8
;
setDisplacement
(
newDisplacement
)
}
return
(
<
FullScreenDrawer
handleClose=
{
setShowLogView
}
zIndex=
{
1002
}
>
<
div
className=
{
style
.
logViewBox
}
>
<
div
className=
{
style
.
logViewContentMask
}
></
div
>
<
div
className=
{
style
.
logViewTop
}
>
<
div
className=
{
style
.
leftButton
}
onClick=
{
leftClick
}
style=
{
{
color
:
leftButtonColor
,
cursor
:
leftButtonColor
===
'#585D62'
?
'default'
:
'pointer'
}
}
>
<
ChevronLeftIcon
/>
</
div
>
<
div
className=
{
style
.
middleFixed
}
>
<
div
className=
{
style
.
middleDynamic
}
id=
'middleDynamic'
style=
{
{
left
:
`${displacement}px`
}
}
>
{
logs
.
map
((
item
:
any
,
index
:
number
)
=>
{
return
<
MyTooltip
title=
{
item
.
logName
}
placement=
"bottom"
arrow=
{
false
}
enterDelay=
{
1000
}
>
<
div
key=
{
index
}
onClick=
{
()
=>
{
setLogCurrent
(
index
)
}
}
className=
{
classnames
({
[
style
.
logTitle
]:
true
,
[
style
.
logTitleSelected
]:
index
===
logCurrent
,
})
}
>
<
InsertDriveFileOutlinedIcon
className=
{
style
.
fileIcon
}
/>
<
span
className=
{
style
.
logName
}
>
{
item
.
logName
}
</
span
>
</
div
>
</
MyTooltip
>
})
}
</
div
>
</
div
>
<
div
className=
{
style
.
gradientBox
}
></
div
>
<
div
className=
{
style
.
rightButton
}
onClick=
{
rightClick
}
style=
{
{
color
:
rightButtonColor
,
cursor
:
rightButtonColor
===
'#585D62'
?
'default'
:
'pointer'
}
}
>
<
ChevronRightIcon
/>
</
div
>
</
div
>
<
div
className=
{
style
.
logViewContent
}
>
{
logText
}
</
div
>
<
div
className=
{
style
.
logViewBottom
}
>
<
MyButton
text=
'下载当前日志'
onClick=
{
handleDownLoad
}
/>
</
div
>
</
div
>
</
FullScreenDrawer
>
)
}
const
{
logs
,
setShowLogView
}
=
props
;
console
.
log
(
logs
);
const
{
currentProjectStore
}
=
useStores
();
const
{
width
,
height
}
=
useWindowSize
();
const
fileToken
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
filetoken
);
const
projectId
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
// 当前选择的日志
const
[
logCurrent
,
setLogCurrent
]
=
useState
<
number
>
(
0
);
// 当前日志的内容文本
const
[
logText
,
setLogText
]
=
useState
(
""
);
// 当前日志路径
const
[
logPath
,
setLogPath
]
=
useState
(
""
);
const
[
displacement
,
setDisplacement
]
=
useState
(
0
);
const
[
middleDynamicWidth
,
setMiddleDynamicWidth
]
=
useState
(
0
);
const
[
leftButtonColor
,
setLeftButtonColor
]
=
useState
(
"#585D62"
);
const
[
rightButtonColor
,
setRightButtonColor
]
=
useState
(
"#585D62"
);
useEffect
(()
=>
{
setLogPath
(
logs
[
logCurrent
]?.
logPath
);
},
[
logs
]);
// 请求日志文本
useEffect
(()
=>
{
if
(
logPath
)
{
const
path
=
logPath
.
slice
(
12
);
CloudEController
.
JobFileDownloadText
(
path
,
fileToken
as
string
,
projectId
as
string
)?.
then
((
res
)
=>
{
setLogText
(
res
.
data
);
});
}
else
{
setLogText
(
""
);
}
},
[
logPath
]);
// 选择日志时改变日志路径
useEffect
(()
=>
{
setLogPath
(
logs
[
logCurrent
]?.
logPath
);
},
[
logCurrent
]);
//获取盒子的总宽度,用于滑动效果判断
useEffect
(()
=>
{
const
box
=
document
.
getElementById
(
"middleDynamic"
);
setMiddleDynamicWidth
(
box
?
box
.
offsetWidth
:
0
);
},
[]);
useEffect
(()
=>
{
if
(
middleDynamicWidth
<
width
-
97
)
{
setLeftButtonColor
(
"#585D62"
);
setRightButtonColor
(
"#585D62"
);
}
if
(
displacement
===
0
)
{
setLeftButtonColor
(
"#585D62"
);
}
else
{
setLeftButtonColor
(
"#C0C5CD"
);
}
if
(
middleDynamicWidth
>
width
-
97
&&
displacement
!==
-
middleDynamicWidth
+
width
-
97
)
{
setRightButtonColor
(
"#C0C5CD"
);
}
else
{
setRightButtonColor
(
"#585D62"
);
}
},
[
width
,
middleDynamicWidth
,
displacement
]);
// 下载当前日志
const
handleDownLoad
=
()
=>
{
const
path
=
logPath
.
slice
(
12
);
CloudEController
.
JobFileDownload
(
path
,
fileToken
as
string
,
projectId
as
string
);
};
const
rightClick
=
()
=>
{
if
(
middleDynamicWidth
<
width
-
97
)
{
return
;
}
if
(
-
displacement
>
middleDynamicWidth
-
width
*
1.8
+
97
)
{
setDisplacement
(
-
middleDynamicWidth
+
width
-
97
);
return
;
}
const
newDisplacement
=
displacement
-
width
*
0.8
;
setDisplacement
(
newDisplacement
);
};
const
leftClick
=
()
=>
{
if
(
-
displacement
<
width
*
0.8
)
{
setDisplacement
(
0
);
return
;
}
const
newDisplacement
=
displacement
+
width
*
0.8
;
setDisplacement
(
newDisplacement
);
};
return
(
<
FullScreenDrawer
handleClose=
{
setShowLogView
}
zIndex=
{
1002
}
>
<
div
className=
{
style
.
logViewBox
}
>
<
div
className=
{
style
.
logViewContentMask
}
></
div
>
<
div
className=
{
style
.
logViewTop
}
>
<
div
className=
{
style
.
leftButton
}
onClick=
{
leftClick
}
style=
{
{
color
:
leftButtonColor
,
cursor
:
leftButtonColor
===
"#585D62"
?
"default"
:
"pointer"
,
}
}
>
<
ChevronLeftIcon
/>
</
div
>
<
div
className=
{
style
.
middleFixed
}
>
<
div
className=
{
style
.
middleDynamic
}
id=
"middleDynamic"
style=
{
{
left
:
`${displacement}px`
}
}
>
{
logs
.
map
((
item
:
any
,
index
:
number
)
=>
{
return
(
<
MyTooltip
title=
{
item
.
logName
}
placement=
"bottom"
arrow=
{
false
}
enterDelay=
{
1000
}
>
<
div
key=
{
index
}
onClick=
{
()
=>
{
setLogCurrent
(
index
);
}
}
className=
{
classnames
({
[
style
.
logTitle
]:
true
,
[
style
.
logTitleSelected
]:
index
===
logCurrent
,
})
}
>
<
InsertDriveFileOutlinedIcon
className=
{
style
.
fileIcon
}
/>
<
span
className=
{
style
.
logName
}
>
{
item
.
logName
}
</
span
>
</
div
>
</
MyTooltip
>
);
})
}
</
div
>
</
div
>
<
div
className=
{
style
.
gradientBox
}
></
div
>
<
div
className=
{
style
.
rightButton
}
onClick=
{
rightClick
}
style=
{
{
color
:
rightButtonColor
,
cursor
:
rightButtonColor
===
"#585D62"
?
"default"
:
"pointer"
,
}
}
>
<
ChevronRightIcon
/>
</
div
>
</
div
>
<
div
className=
{
style
.
logViewContent
}
>
{
logText
}
</
div
>
<
div
className=
{
style
.
logViewBottom
}
>
<
MyButton
text=
"下载当前日志"
onClick=
{
handleDownLoad
}
/>
</
div
>
</
div
>
</
FullScreenDrawer
>
);
};
export
default
LogView
\ No newline at end of file
export
default
LogView
;
src/views/ResourceCenter/UserResources/UserResourcesEnvironment/
EnvironmentDetails
/index.module.css
→
src/views/ResourceCenter/UserResources/UserResourcesEnvironment/
SeeEnv
/index.module.css
View file @
6704e629
File moved
src/views/ResourceCenter/UserResources/UserResourcesEnvironment/
EnvironmentDetails
/index.tsx
→
src/views/ResourceCenter/UserResources/UserResourcesEnvironment/
SeeEnv
/index.tsx
View file @
6704e629
const
EnvironmentDetails
=
()
=>
{
const
SeeEnv
=
()
=>
{
return
<
div
>
EnvironmentDetails
</
div
>;
};
export
default
EnvironmentDetails
;
export
default
SeeEnv
;
src/views/ResourceCenter/UserResources/UserResourcesEnvironment/index.tsx
View file @
6704e629
// 应用环境
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
style
from
"./index.module.css"
;
import
SearchInput
from
"@/components/BusinessComponents/SearchInput"
;
import
MySelect
from
"@/components/mui/MySelect"
;
...
...
@@ -7,6 +8,7 @@ import MyButton from "@/components/mui/MyButton";
import
MyTable
from
"@/components/mui/MyTableNew"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
{
getActorenvList
}
from
"@/api/resourceCenter"
;
import
Add
from
"@mui/icons-material/Add"
;
import
moment
from
"moment"
;
import
jobFail
from
"@/assets/project/jobFail.svg"
;
import
jobRun
from
"@/assets/project/jobRun.svg"
;
...
...
@@ -15,6 +17,7 @@ import AddEnvironment from "./AddEnvironment";
import
DeleteEnvironment
from
"./DeleteEnvironment"
;
const
UserResourcesEnvironment
=
()
=>
{
const
navigate
=
useNavigate
();
const
[
addOpen
,
setAddopen
]
=
useState
(
false
);
const
[
title
,
setTitle
]
=
useState
(
""
);
const
[
type
,
setType
]
=
useState
<
"BATCH"
|
"FLOW"
|
""
>
(
""
);
...
...
@@ -126,6 +129,16 @@ const UserResourcesEnvironment = () => {
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
)
=>
{
if
(
item
.
status
===
"FAILED"
)
{
return
(
...
...
@@ -141,6 +154,7 @@ const UserResourcesEnvironment = () => {
}
}
variant=
"text"
size=
"medium"
onClick=
{
()
=>
hanleToSeeEnv
(
item
)
}
/>
<
MyButton
onClick=
{
()
=>
handleDelete
(
item
)
}
...
...
@@ -171,7 +185,7 @@ const UserResourcesEnvironment = () => {
}
}
variant=
"text"
size=
"medium"
// onClick={() => hanleDownloadFile
(item)}
onClick=
{
()
=>
hanleToSeeEnv
(
item
)
}
/>
);
}
...
...
@@ -212,13 +226,8 @@ const UserResourcesEnvironment = () => {
<
div
className=
{
style
.
topRight
}
>
<
MyButton
text=
"构建应用环境"
img=
{
<
span
style=
{
{
fontSize
:
"14px"
,
marginRight
:
"8px"
}
}
className=
"iconfont icon-dianzan"
></
span
>
}
onClick=
{
()
=>
setAddopen
(
true
)
}
startIcon=
{
<
Add
/>
}
></
MyButton
>
</
div
>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment