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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
f102e45a
Commit
f102e45a
authored
Dec 27, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Humanize the units of "Showing last X KiB of log" in job trace
Closes #38613
parent
3d56d93f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
7 deletions
+12
-7
app/assets/javascripts/job.js
app/assets/javascripts/job.js
+2
-2
app/views/projects/jobs/show.html.haml
app/views/projects/jobs/show.html.haml
+1
-1
changelogs/unreleased/sh-make-kib-human.yml
changelogs/unreleased/sh-make-kib-human.yml
+5
-0
spec/javascripts/job_spec.js
spec/javascripts/job_spec.js
+4
-4
No files found.
app/assets/javascripts/job.js
View file @
f102e45a
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
{
visitUrl
}
from
'
./lib/utils/url_utility
'
;
import
{
visitUrl
}
from
'
./lib/utils/url_utility
'
;
import
bp
from
'
./breakpoints
'
;
import
bp
from
'
./breakpoints
'
;
import
{
bytesToKiB
}
from
'
./lib/utils/number_utils
'
;
import
{
numberToHumanSize
}
from
'
./lib/utils/number_utils
'
;
import
{
setCiStatusFavicon
}
from
'
./lib/utils/common_utils
'
;
import
{
setCiStatusFavicon
}
from
'
./lib/utils/common_utils
'
;
import
{
timeFor
}
from
'
./lib/utils/datetime_utility
'
;
import
{
timeFor
}
from
'
./lib/utils/datetime_utility
'
;
...
@@ -193,7 +193,7 @@ export default class Job {
...
@@ -193,7 +193,7 @@ export default class Job {
// we need to show a message warning the user about that.
// we need to show a message warning the user about that.
if
(
this
.
logBytes
<
log
.
total
)
{
if
(
this
.
logBytes
<
log
.
total
)
{
// size is in bytes, we need to calculate KiB
// size is in bytes, we need to calculate KiB
const
size
=
bytesToKiB
(
this
.
logBytes
);
const
size
=
numberToHumanSize
(
this
.
logBytes
);
$
(
'
.js-truncated-info-size
'
).
html
(
`
${
size
}
`
);
$
(
'
.js-truncated-info-size
'
).
html
(
`
${
size
}
`
);
this
.
$truncatedInfo
.
removeClass
(
'
hidden
'
);
this
.
$truncatedInfo
.
removeClass
(
'
hidden
'
);
}
else
{
}
else
{
...
...
app/views/projects/jobs/show.html.haml
View file @
f102e45a
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
.js-truncated-info.truncated-info.hidden-xs.pull-left.hidden
<
.js-truncated-info.truncated-info.hidden-xs.pull-left.hidden
<
Showing
last
Showing
last
%span
.js-truncated-info-size.truncated-info-size
><
%span
.js-truncated-info-size.truncated-info-size
><
KiB
of
log
-
of
log
-
%a
.js-raw-link.raw-link
{
href:
raw_project_job_path
(
@project
,
@build
)
}><
Complete
Raw
%a
.js-raw-link.raw-link
{
href:
raw_project_job_path
(
@project
,
@build
)
}><
Complete
Raw
.controllers.pull-right
.controllers.pull-right
...
...
changelogs/unreleased/sh-make-kib-human.yml
0 → 100644
View file @
f102e45a
---
title
:
Humanize the units of "Showing last X KiB of log" in job trace
merge_request
:
author
:
type
:
fixed
spec/javascripts/job_spec.js
View file @
f102e45a
import
{
bytesToKiB
}
from
'
~/lib/utils/number_utils
'
;
import
{
numberToHumanSize
}
from
'
~/lib/utils/number_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
Job
from
'
~/job
'
;
import
Job
from
'
~/job
'
;
...
@@ -169,7 +169,7 @@ describe('Job', () => {
...
@@ -169,7 +169,7 @@ describe('Job', () => {
expect
(
expect
(
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
).
toEqual
(
`
${
bytesToKiB
(
size
)}
`
);
).
toEqual
(
`
${
numberToHumanSize
(
size
)}
`
);
});
});
it
(
'
shows incremented size
'
,
()
=>
{
it
(
'
shows incremented size
'
,
()
=>
{
...
@@ -195,7 +195,7 @@ describe('Job', () => {
...
@@ -195,7 +195,7 @@ describe('Job', () => {
expect
(
expect
(
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
).
toEqual
(
`
${
bytesToKiB
(
50
)}
`
);
).
toEqual
(
`
${
numberToHumanSize
(
50
)}
`
);
jasmine
.
clock
().
tick
(
4001
);
jasmine
.
clock
().
tick
(
4001
);
...
@@ -209,7 +209,7 @@ describe('Job', () => {
...
@@ -209,7 +209,7 @@ describe('Job', () => {
expect
(
expect
(
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
).
toEqual
(
`
${
bytesToKiB
(
60
)}
`
);
).
toEqual
(
`
${
numberToHumanSize
(
60
)}
`
);
});
});
it
(
'
renders the raw link
'
,
()
=>
{
it
(
'
renders the raw link
'
,
()
=>
{
...
...
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