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
f168fa03
Commit
f168fa03
authored
Sep 09, 2022
by
wuyongsheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 查看日志优化
parent
9f898958
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
index.tsx
src/views/Project/ProjectJobDetail/LogView/index.tsx
+23
-14
No files found.
src/views/Project/ProjectJobDetail/LogView/index.tsx
View file @
f168fa03
import
{
useState
,
useCallback
,
useEffect
,
useMemo
}
from
"react"
;
/*
* @Author: 吴永生 15770852798@163.com
* @Date: 2022-09-09 14:41:47
* @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-09-09 16:48:28
* @FilePath: /bkunyun/src/views/Project/ProjectJobDetail/LogView/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
{
useState
,
useEffect
}
from
"react"
;
import
InsertDriveFileOutlinedIcon
from
"@mui/icons-material/InsertDriveFileOutlined"
;
import
{
toJS
}
from
"mobx"
;
import
classnames
from
"classnames"
;
import
classnames
from
"classnames"
;
import
style
from
"./index.module.css"
;
import
ChevronLeftIcon
from
'@mui/icons-material/ChevronLeft'
;
import
CloseIcon
from
"@mui/icons-material/Close"
;
import
ChevronRightIcon
from
'@mui/icons-material/ChevronRight'
;
import
MyButton
from
"@/components/mui/MyButton"
;
import
MyButton
from
"@/components/mui/MyButton"
;
import
InsertDriveFileOutlinedIcon
from
"@mui/icons-material/InsertDriveFileOutlined"
;
import
CloudEController
from
"@/api/fileserver/CloudEController"
;
import
CloudEController
from
"@/api/fileserver/CloudEController"
;
import
{
useStores
}
from
"@/store"
;
import
{
useStores
}
from
"@/store"
;
import
{
toJS
}
from
"mobx"
;
import
FullScreenDrawer
from
"@/components/CommonComponents/FullScreenDrawer"
;
import
FullScreenDrawer
from
"@/components/CommonComponents/FullScreenDrawer"
;
import
ChevronLeftIcon
from
'@mui/icons-material/ChevronLeft'
;
import
ChevronRightIcon
from
'@mui/icons-material/ChevronRight'
;
import
style
from
"./index.module.css"
;
type
LogViewProps
=
{
type
LogViewProps
=
{
logs
:
any
[];
logs
:
any
[];
...
@@ -29,10 +37,6 @@ const LogView = (props: LogViewProps) => {
...
@@ -29,10 +37,6 @@ const LogView = (props: LogViewProps) => {
// 当前日志路径
// 当前日志路径
const
[
logPath
,
setLogPath
]
=
useState
(
''
)
const
[
logPath
,
setLogPath
]
=
useState
(
''
)
useEffect
(()
=>
{
setLogPath
(
logs
[
logCurrent
]?.
logPath
)
},
[
logs
]);
// 请求日志文本
// 请求日志文本
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
logPath
)
{
if
(
logPath
)
{
...
@@ -47,12 +51,12 @@ const LogView = (props: LogViewProps) => {
...
@@ -47,12 +51,12 @@ const LogView = (props: LogViewProps) => {
}
else
{
}
else
{
setLogText
(
""
)
setLogText
(
""
)
}
}
},
[
logPath
]);
},
[
fileToken
,
logPath
,
projectId
]);
// 选择日志时改变日志路径
// 选择日志时改变日志路径
useEffect
(()
=>
{
useEffect
(()
=>
{
setLogPath
(
logs
[
logCurrent
]?.
logPath
)
setLogPath
(
logs
[
logCurrent
]?.
logPath
)
},
[
logCurrent
]);
},
[
logCurrent
,
logs
]);
// 下载当前日志
// 下载当前日志
const
handleDownLoad
=
()
=>
{
const
handleDownLoad
=
()
=>
{
...
@@ -64,6 +68,11 @@ const LogView = (props: LogViewProps) => {
...
@@ -64,6 +68,11 @@ const LogView = (props: LogViewProps) => {
);
);
}
}
const
handleLogTab
=
(
index
:
number
)
=>
{
setLogText
(
""
);
setLogCurrent
(
index
)
}
return
(
return
(
<
FullScreenDrawer
handleClose=
{
setShowLogView
}
zIndex=
{
1002
}
>
<
FullScreenDrawer
handleClose=
{
setShowLogView
}
zIndex=
{
1002
}
>
<
div
className=
{
style
.
logViewBox
}
>
<
div
className=
{
style
.
logViewBox
}
>
...
@@ -75,7 +84,7 @@ const LogView = (props: LogViewProps) => {
...
@@ -75,7 +84,7 @@ const LogView = (props: LogViewProps) => {
{
logs
.
map
((
item
:
any
,
index
:
number
)
=>
{
{
logs
.
map
((
item
:
any
,
index
:
number
)
=>
{
return
<
div
return
<
div
key=
{
index
}
key=
{
index
}
onClick=
{
()
=>
{
setLogCurrent
(
index
)
}
}
onClick=
{
()
=>
{
handleLogTab
(
index
)
}
}
className=
{
classnames
({
className=
{
classnames
({
[
style
.
logTitle
]:
true
,
[
style
.
logTitle
]:
true
,
[
style
.
logTitleSelected
]:
index
===
logCurrent
,
[
style
.
logTitleSelected
]:
index
===
logCurrent
,
...
...
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