Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
04a4755e
Commit
04a4755e
authored
Oct 23, 2020
by
Kev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace formatPipelineDuration with formatTime
parent
8afccd02
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
49 deletions
+4
-49
app/assets/javascripts/pipelines/components/pipelines_list/time_ago.vue
...ascripts/pipelines/components/pipelines_list/time_ago.vue
+2
-3
app/assets/javascripts/pipelines/utils.js
app/assets/javascripts/pipelines/utils.js
+0
-19
app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue
.../projects/pipelines/charts/components/statistics_list.vue
+2
-2
spec/frontend/pipelines/pipeline_graph/utils_spec.js
spec/frontend/pipelines/pipeline_graph/utils_spec.js
+0
-25
No files found.
app/assets/javascripts/pipelines/components/pipelines_list/time_ago.vue
View file @
04a4755e
<
script
>
import
{
GlIcon
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
timeagoMixin
from
'
~/vue_shared/mixins/timeago
'
;
import
{
format
PipelineDuration
}
from
'
~/pipelines/utils
'
;
import
{
format
Time
}
from
'
~/lib/utils/datetime_utility
'
;
export
default
{
directives
:
{
...
...
@@ -28,7 +27,7 @@ export default {
return
this
.
finishedTime
!==
''
;
},
durationFormatted
()
{
return
format
PipelineDuration
(
this
.
duration
);
return
format
Time
(
this
.
duration
);
},
},
};
...
...
app/assets/javascripts/pipelines/utils.js
View file @
04a4755e
...
...
@@ -94,22 +94,3 @@ export const generateJobNeedsDict = ({ jobs }) => {
return
{
...
acc
,
[
jobs
[
value
].
id
]:
uniqueValues
};
},
{});
};
export
const
formatPipelineDuration
=
duration
=>
{
let
ss
=
duration
%
60
;
let
mm
=
Math
.
floor
(
duration
/
60
)
%
60
;
let
hh
=
Math
.
floor
(
duration
/
60
/
60
);
// left pad with 0s
if
(
hh
<
10
)
{
hh
=
`0
${
hh
}
`
;
}
if
(
mm
<
10
)
{
mm
=
`0
${
mm
}
`
;
}
if
(
ss
<
10
)
{
ss
=
`0
${
ss
}
`
;
}
return
`
${
hh
}
:
${
mm
}
:
${
ss
}
`
;
};
app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue
View file @
04a4755e
<
script
>
import
{
format
PipelineDuration
}
from
'
~/pipelines/utils
'
;
import
{
format
Time
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
s__
,
n__
}
from
'
~/locale
'
;
export
default
{
...
...
@@ -11,7 +11,7 @@ export default {
},
computed
:
{
totalDuration
()
{
return
format
PipelineDuration
(
this
.
counts
.
totalDuration
);
return
format
Time
(
this
.
counts
.
totalDuration
);
},
statistics
()
{
return
[
...
...
spec/frontend/pipelines/pipeline_graph/utils_spec.js
View file @
04a4755e
...
...
@@ -2,7 +2,6 @@ import {
preparePipelineGraphData
,
createUniqueJobId
,
generateJobNeedsDict
,
formatPipelineDuration
,
}
from
'
~/pipelines/utils
'
;
describe
(
'
utils functions
'
,
()
=>
{
...
...
@@ -210,27 +209,3 @@ describe('utils functions', () => {
});
});
});
describe
(
'
formatPipelineDuration
'
,
()
=>
{
it
.
each
`
hours | minutes | seconds | result
${
0
}
|
${
0
}
|
${
0
}
|
${
'
00:00:00
'
}
${
0
}
|
${
0
}
|
${
10
}
|
${
'
00:00:10
'
}
${
0
}
|
${
1
}
|
${
0
}
|
${
'
00:01:00
'
}
${
0
}
|
${
1
}
|
${
1
}
|
${
'
00:01:01
'
}
${
1
}
|
${
0
}
|
${
0
}
|
${
'
01:00:00
'
}
${
1
}
|
${
17
}
|
${
40
}
|
${
'
01:17:40
'
}
${
23
}
|
${
59
}
|
${
59
}
|
${
'
23:59:59
'
}
${
1
*
24
}
|
${
0
}
|
${
0
}
|
${
'
24:00:00
'
}
${
2
*
24
}
|
${
0
}
|
${
0
}
|
${
'
48:00:00
'
}
${
1
*
24
}
|
${
5
}
|
${
34
}
|
${
'
24:05:34
'
}
${
10
*
24
}
|
${
0
}
|
${
0
}
|
${
'
240:00:00
'
}
${
100
*
24
}
|
${
0
}
|
${
0
}
|
${
'
2400:00:00
'
}
`
(
'
returns $result for $hours hour(s), $minutes minute(s), $seconds second(s)
'
,
({
hours
,
minutes
,
seconds
,
result
})
=>
{
const
totalSeconds
=
60
*
60
*
hours
+
60
*
minutes
+
seconds
;
expect
(
formatPipelineDuration
(
totalSeconds
)).
toBe
(
result
);
},
);
});
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