Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
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
wangpeng
dinky
Commits
d1ad9c89
Unverified
Commit
d1ad9c89
authored
Dec 26, 2023
by
gaoyan
Committed by
GitHub
Dec 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix-#2756] Fix the Devops job list duration formate error (#2802)
* fix log error * Fix the Devops job list duration formate error
parent
bfbac4bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
7 deletions
+31
-7
JobOverview.tsx
...eb/src/pages/DevOps/JobDetail/JobOverview/JobOverview.tsx
+3
-3
JobHistoryList.tsx
...vOps/JobList/components/JobHistoryList/JobHistoryList.tsx
+2
-2
index.tsx
dinky-web/src/pages/DevOps/JobList/index.tsx
+2
-2
function.tsx
dinky-web/src/pages/DevOps/function.tsx
+24
-0
No files found.
dinky-web/src/pages/DevOps/JobDetail/JobOverview/JobOverview.tsx
View file @
d1ad9c89
...
@@ -25,7 +25,7 @@ import { l } from '@/utils/intl';
...
@@ -25,7 +25,7 @@ import { l } from '@/utils/intl';
import
{
ProCard
}
from
'@ant-design/pro-components'
;
import
{
ProCard
}
from
'@ant-design/pro-components'
;
import
{
Button
,
Empty
,
Result
}
from
'antd'
;
import
{
Button
,
Empty
,
Result
}
from
'antd'
;
import
{
useState
}
from
'react'
;
import
{
useState
}
from
'react'
;
import
{
is
StatusDone
}
from
'../../function'
;
import
{
is
NotFinallyStatus
}
from
'../../function'
;
const
JobConfigTab
=
(
props
:
JobProps
)
=>
{
const
JobConfigTab
=
(
props
:
JobProps
)
=>
{
const
{
jobDetail
}
=
props
;
const
{
jobDetail
}
=
props
;
...
@@ -34,7 +34,7 @@ const JobConfigTab = (props: JobProps) => {
...
@@ -34,7 +34,7 @@ const JobConfigTab = (props: JobProps) => {
return
(
return
(
<>
<>
{
is
StatusDone
(
jobDetail
?.
instance
?.
status
as
string
)
&&
!
showHistory
?
(
{
is
NotFinallyStatus
(
jobDetail
?.
instance
?.
status
as
string
)
&&
!
showHistory
?
(
<
Result
<
Result
status=
'warning'
status=
'warning'
title=
{
l
(
'devops.jobinfo.unable.obtain.status'
)
}
title=
{
l
(
'devops.jobinfo.unable.obtain.status'
)
}
...
@@ -51,7 +51,7 @@ const JobConfigTab = (props: JobProps) => {
...
@@ -51,7 +51,7 @@ const JobConfigTab = (props: JobProps) => {
}
}
/>
/>
)
:
undefined
}
)
:
undefined
}
{
showHistory
||
!
is
StatusDone
(
jobDetail
?.
instance
?.
status
as
string
)
?
(
{
showHistory
||
!
is
NotFinallyStatus
(
jobDetail
?.
instance
?.
status
as
string
)
?
(
<>
<>
<
JobDesc
jobDetail=
{
jobDetail
}
/>
<
JobDesc
jobDetail=
{
jobDetail
}
/>
<
ProCard
<
ProCard
...
...
dinky-web/src/pages/DevOps/JobList/components/JobHistoryList/JobHistoryList.tsx
View file @
d1ad9c89
...
@@ -18,10 +18,10 @@
...
@@ -18,10 +18,10 @@
*/
*/
import
StatusTag
from
'@/components/JobTags/StatusTag'
;
import
StatusTag
from
'@/components/JobTags/StatusTag'
;
import
{
getJobDuration
}
from
'@/pages/DevOps/function'
;
import
{
queryList
}
from
'@/services/api'
;
import
{
queryList
}
from
'@/services/api'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
parseSecondStr
}
from
'@/utils/function'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
type
{
ActionType
,
ProColumns
}
from
'@ant-design/pro-components'
;
import
type
{
ActionType
,
ProColumns
}
from
'@ant-design/pro-components'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
...
@@ -62,7 +62,7 @@ const JobHistoryList = (props: HistoryProps) => {
...
@@ -62,7 +62,7 @@ const JobHistoryList = (props: HistoryProps) => {
},
},
{
{
title
:
l
(
'global.table.useTime'
),
title
:
l
(
'global.table.useTime'
),
render
:
(
_
:
any
,
row
:
{
duration
:
number
})
=>
parseSecondStr
(
row
.
duration
)
render
:
(
_
:
any
,
row
:
Jobs
.
JobInstance
)
=>
getJobDuration
(
row
)
},
},
{
{
title
:
l
(
'global.table.operate'
),
title
:
l
(
'global.table.operate'
),
...
...
dinky-web/src/pages/DevOps/JobList/index.tsx
View file @
d1ad9c89
...
@@ -21,12 +21,12 @@ import JobLifeCycleTag from '@/components/JobTags/JobLifeCycleTag';
...
@@ -21,12 +21,12 @@ import JobLifeCycleTag from '@/components/JobTags/JobLifeCycleTag';
import
StatusTag
from
'@/components/JobTags/StatusTag'
;
import
StatusTag
from
'@/components/JobTags/StatusTag'
;
import
{
DevopContext
}
from
'@/pages/DevOps'
;
import
{
DevopContext
}
from
'@/pages/DevOps'
;
import
{
JOB_LIFE_CYCLE
}
from
'@/pages/DevOps/constants'
;
import
{
JOB_LIFE_CYCLE
}
from
'@/pages/DevOps/constants'
;
import
{
getJobDuration
}
from
'@/pages/DevOps/function'
;
import
JobHistoryList
from
'@/pages/DevOps/JobList/components/JobHistoryList/JobHistoryList'
;
import
JobHistoryList
from
'@/pages/DevOps/JobList/components/JobHistoryList/JobHistoryList'
;
import
{
queryList
}
from
'@/services/api'
;
import
{
queryList
}
from
'@/services/api'
;
import
{
PROTABLE_OPTIONS_PUBLIC
}
from
'@/services/constants'
;
import
{
PROTABLE_OPTIONS_PUBLIC
}
from
'@/services/constants'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
parseMilliSecondStr
}
from
'@/utils/function'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
ClockCircleTwoTone
,
EyeTwoTone
,
RedoOutlined
}
from
'@ant-design/icons'
;
import
{
ClockCircleTwoTone
,
EyeTwoTone
,
RedoOutlined
}
from
'@ant-design/icons'
;
import
type
{
ActionType
,
ProColumns
}
from
'@ant-design/pro-components'
;
import
type
{
ActionType
,
ProColumns
}
from
'@ant-design/pro-components'
;
...
@@ -77,7 +77,7 @@ const JobList = () => {
...
@@ -77,7 +77,7 @@ const JobList = () => {
{
{
title
:
l
(
'global.table.useTime'
),
title
:
l
(
'global.table.useTime'
),
hideInSearch
:
true
,
hideInSearch
:
true
,
render
:
(
_
:
any
,
row
:
Jobs
.
JobInstance
)
=>
parseMilliSecondStr
(
row
.
duration
)
render
:
(
_
:
any
,
row
:
Jobs
.
JobInstance
)
=>
getJobDuration
(
row
)
},
},
{
{
title
:
l
(
'global.table.status'
),
title
:
l
(
'global.table.status'
),
...
...
dinky-web/src/pages/DevOps/function.tsx
View file @
d1ad9c89
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
*/
*/
import
{
JOB_STATUS
}
from
'@/pages/DevOps/constants'
;
import
{
JOB_STATUS
}
from
'@/pages/DevOps/constants'
;
import
{
Jobs
}
from
'@/types/DevOps/data'
;
import
{
parseMilliSecondStr
}
from
'@/utils/function'
;
/**
/**
* Checks if a job status indicates that the job is done.
* Checks if a job status indicates that the job is done.
...
@@ -39,3 +41,25 @@ export function isStatusDone(type: string) {
...
@@ -39,3 +41,25 @@ export function isStatusDone(type: string) {
return
false
;
return
false
;
}
}
}
}
export
function
isNotFinallyStatus
(
type
:
string
)
{
if
(
!
type
)
{
return
true
;
}
switch
(
type
)
{
case
JOB_STATUS
.
RECONNECTING
:
case
JOB_STATUS
.
UNKNOWN
:
return
true
;
default
:
return
false
;
}
}
export
function
getJobDuration
(
jobInstance
:
Jobs
.
JobInstance
)
{
if
(
isStatusDone
(
jobInstance
.
status
))
{
return
parseMilliSecondStr
(
jobInstance
.
duration
);
}
else
{
const
currentTimestamp
=
Date
.
now
();
const
duration
=
currentTimestamp
-
new
Date
(
jobInstance
.
createTime
).
getTime
();
return
parseMilliSecondStr
(
duration
);
}
}
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