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
795dd8e5
Commit
795dd8e5
authored
Sep 19, 2022
by
jiangzijing
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-20220801' into 'release'
Feat 20220801 See merge request
!104
parents
4827d395
e1902451
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
135 additions
and
15 deletions
+135
-15
MyTooltip.tsx
src/components/mui/MyTooltip.tsx
+1
-0
useWindowSize.ts
src/hooks/useWindowSize.ts
+32
-0
index.module.css
src/views/Project/ProjectJobDetail/LogView/index.module.css
+15
-1
index.tsx
src/views/Project/ProjectJobDetail/LogView/index.tsx
+87
-14
No files found.
src/components/mui/MyTooltip.tsx
View file @
795dd8e5
...
@@ -19,6 +19,7 @@ const theme = createTheme({
...
@@ -19,6 +19,7 @@ const theme = createTheme({
styleOverrides
:
{
styleOverrides
:
{
tooltip
:
{
tooltip
:
{
backgroundColor
:
"rgba(7, 19, 38, .8)"
,
backgroundColor
:
"rgba(7, 19, 38, .8)"
,
padding
:
'8px 16px'
,
color
:
"#fff"
,
color
:
"#fff"
,
},
},
arrow
:
{
arrow
:
{
...
...
src/hooks/useWindowSize.ts
0 → 100644
View file @
795dd8e5
import
{
useEffect
,
useState
}
from
'react'
interface
WindowSize
{
width
:
number
height
:
number
}
function
useWindowSize
():
WindowSize
{
const
[
windowSize
,
setWindowSize
]
=
useState
<
WindowSize
>
({
width
:
0
,
height
:
0
,
})
useEffect
(()
=>
{
const
handler
=
()
=>
{
setWindowSize
({
width
:
window
.
innerWidth
,
height
:
window
.
innerHeight
})
}
handler
()
window
.
addEventListener
(
'resize'
,
handler
)
return
()
=>
{
window
.
removeEventListener
(
'resize'
,
handler
)
}
},[])
return
windowSize
}
export
default
useWindowSize
\ No newline at end of file
src/views/Project/ProjectJobDetail/LogView/index.module.css
View file @
795dd8e5
...
@@ -58,10 +58,11 @@
...
@@ -58,10 +58,11 @@
overflow
:
hidden
;
overflow
:
hidden
;
}
}
.middleDynamic
{
.middleDynamic
{
display
:
flex
;
display
:
flex
;
position
:
absolute
;
position
:
absolute
;
left
:
0
;
left
:
0
;
transition
:
left
.4s
ease-in-out
;
}
}
.logTitle
{
.logTitle
{
...
@@ -78,6 +79,10 @@
...
@@ -78,6 +79,10 @@
border-right
:
1px
solid
#10141A
;
border-right
:
1px
solid
#10141A
;
}
}
.logTitle
:hover
{
background-color
:
#23272E
;
}
.logName
{
.logName
{
max-width
:
90px
;
max-width
:
90px
;
overflow
:
hidden
;
overflow
:
hidden
;
...
@@ -128,4 +133,12 @@
...
@@ -128,4 +133,12 @@
justify-content
:
end
;
justify-content
:
end
;
height
:
76px
;
height
:
76px
;
padding-right
:
24px
;
padding-right
:
24px
;
}
.gradientBox
{
position
:
absolute
;
right
:
49px
;
width
:
28px
;
height
:
32px
;
background
:
linear-gradient
(
90deg
,
rgba
(
29
,
33
,
38
,
0
)
0%
,
#1D2126
100%
);
}
}
\ No newline at end of file
src/views/Project/ProjectJobDetail/LogView/index.tsx
View file @
795dd8e5
import
{
useState
,
useCallback
,
useEffect
,
useMemo
}
from
"react"
;
import
{
useState
,
useCallback
,
useEffect
,
useMemo
}
from
"react"
;
import
classnames
from
"classnames"
;
import
classnames
from
"classnames"
;
import
style
from
"./index.module.css"
;
import
style
from
"./index.module.css"
;
import
CloseIcon
from
"@mui/icons-material/Close"
;
import
MyButton
from
"@/components/mui/MyButton"
;
import
MyButton
from
"@/components/mui/MyButton"
;
import
MyTooltip
from
"@/components/mui/MyTooltip"
;
import
InsertDriveFileOutlinedIcon
from
"@mui/icons-material/InsertDriveFileOutlined"
;
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"
;
...
@@ -10,6 +10,7 @@ import { toJS } from "mobx";
...
@@ -10,6 +10,7 @@ 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'
type
LogViewProps
=
{
type
LogViewProps
=
{
...
@@ -20,6 +21,7 @@ type LogViewProps = {
...
@@ -20,6 +21,7 @@ type LogViewProps = {
const
LogView
=
(
props
:
LogViewProps
)
=>
{
const
LogView
=
(
props
:
LogViewProps
)
=>
{
const
{
logs
,
setShowLogView
}
=
props
;
const
{
logs
,
setShowLogView
}
=
props
;
const
{
currentProjectStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
const
{
width
,
height
}
=
useWindowSize
();
const
fileToken
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
filetoken
);
const
fileToken
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
filetoken
);
const
projectId
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
const
projectId
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
// 当前选择的日志
// 当前选择的日志
...
@@ -29,6 +31,13 @@ const LogView = (props: LogViewProps) => {
...
@@ -29,6 +31,13 @@ const LogView = (props: LogViewProps) => {
// 当前日志路径
// 当前日志路径
const
[
logPath
,
setLogPath
]
=
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
(()
=>
{
useEffect
(()
=>
{
setLogPath
(
logs
[
logCurrent
]?.
logPath
)
setLogPath
(
logs
[
logCurrent
]?.
logPath
)
},
[
logs
]);
},
[
logs
]);
...
@@ -54,6 +63,29 @@ const LogView = (props: LogViewProps) => {
...
@@ -54,6 +63,29 @@ const LogView = (props: LogViewProps) => {
setLogPath
(
logs
[
logCurrent
]?.
logPath
)
setLogPath
(
logs
[
logCurrent
]?.
logPath
)
},
[
logCurrent
]);
},
[
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
handleDownLoad
=
()
=>
{
const
path
=
logPath
.
slice
(
12
)
const
path
=
logPath
.
slice
(
12
)
...
@@ -64,29 +96,70 @@ const LogView = (props: LogViewProps) => {
...
@@ -64,29 +96,70 @@ const LogView = (props: LogViewProps) => {
);
);
}
}
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
(
return
(
<
FullScreenDrawer
handleClose=
{
setShowLogView
}
zIndex=
{
1002
}
>
<
FullScreenDrawer
handleClose=
{
setShowLogView
}
zIndex=
{
1002
}
>
<
div
className=
{
style
.
logViewBox
}
>
<
div
className=
{
style
.
logViewBox
}
>
<
div
className=
{
style
.
logViewContentMask
}
></
div
>
<
div
className=
{
style
.
logViewContentMask
}
></
div
>
<
div
className=
{
style
.
logViewTop
}
>
<
div
className=
{
style
.
logViewTop
}
>
<
div
className=
{
style
.
leftButton
}
><
ChevronLeftIcon
/></
div
>
<
div
className=
{
style
.
leftButton
}
onClick=
{
leftClick
}
style=
{
{
color
:
leftButtonColor
,
cursor
:
leftButtonColor
===
'#585D62'
?
'default'
:
'pointer'
}
}
>
<
ChevronLeftIcon
/>
</
div
>
<
div
className=
{
style
.
middleFixed
}
>
<
div
className=
{
style
.
middleFixed
}
>
<
div
className=
{
style
.
middleDynamic
}
>
<
div
className=
{
style
.
middleDynamic
}
id=
'middleDynamic'
style=
{
{
left
:
`${displacement}px`
}
}
>
{
logs
.
map
((
item
:
any
,
index
:
number
)
=>
{
{
logs
.
map
((
item
:
any
,
index
:
number
)
=>
{
return
<
div
return
<
MyTooltip
key=
{
index
}
title=
{
item
.
logName
}
onClick=
{
()
=>
{
setLogCurrent
(
index
)
}
}
placement=
"bottom"
className=
{
classnames
({
arrow=
{
false
}
[
style
.
logTitle
]:
true
,
enterDelay=
{
1000
}
[
style
.
logTitleSelected
]:
index
===
logCurrent
,
>
})
}
>
<
div
<
InsertDriveFileOutlinedIcon
className=
{
style
.
fileIcon
}
/>
key=
{
index
}
<
span
className=
{
style
.
logName
}
>
{
item
.
logName
}
</
span
>
onClick=
{
()
=>
{
setLogCurrent
(
index
)
}
}
</
div
>
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
>
</
div
>
<
div
className=
{
style
.
rightButton
}
><
ChevronRightIcon
/></
div
>
<
div
className=
{
style
.
gradientBox
}
></
div
>
<
div
className=
{
style
.
rightButton
}
onClick=
{
rightClick
}
style=
{
{
color
:
rightButtonColor
,
cursor
:
rightButtonColor
===
'#585D62'
?
'default'
:
'pointer'
}
}
>
<
ChevronRightIcon
/>
</
div
>
</
div
>
</
div
>
<
div
className=
{
style
.
logViewContent
}
>
<
div
className=
{
style
.
logViewContent
}
>
{
logText
}
{
logText
}
...
...
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