diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-12-27 17:07:29 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-12-27 17:07:29 +0000 |
commit | f1d5e509b52c8c05fd570503389930121e12d87f (patch) | |
tree | dd6a7964aa43102115b44319a516f6074c857c2a | |
parent | ff3e9af6fdac37ae71ea526bbb9aaf4b7d2ce876 (diff) | |
parent | f102e45a196eaa2a59fb92157d04e22736805ad0 (diff) | |
download | gitlab-ce-f1d5e509b52c8c05fd570503389930121e12d87f.tar.gz |
Merge branch 'sh-make-kib-human' into 'master'
Humanize the units of "Showing last X KiB of log" in job trace
Closes #38613
See merge request gitlab-org/gitlab-ce!16147
-rw-r--r-- | app/assets/javascripts/job.js | 4 | ||||
-rw-r--r-- | app/views/projects/jobs/show.html.haml | 2 | ||||
-rw-r--r-- | changelogs/unreleased/sh-make-kib-human.yml | 5 | ||||
-rw-r--r-- | spec/javascripts/job_spec.js | 8 |
4 files changed, 12 insertions, 7 deletions
diff --git a/app/assets/javascripts/job.js b/app/assets/javascripts/job.js index 198a7823381..573c4deb3e4 100644 --- a/app/assets/javascripts/job.js +++ b/app/assets/javascripts/job.js @@ -1,7 +1,7 @@ import _ from 'underscore'; import { visitUrl } from './lib/utils/url_utility'; 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 { timeFor } from './lib/utils/datetime_utility'; @@ -193,7 +193,7 @@ export default class Job { // we need to show a message warning the user about that. if (this.logBytes < log.total) { // 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}`); this.$truncatedInfo.removeClass('hidden'); } else { diff --git a/app/views/projects/jobs/show.html.haml b/app/views/projects/jobs/show.html.haml index 1d0aaa47b60..fd24bbbb9ba 100644 --- a/app/views/projects/jobs/show.html.haml +++ b/app/views/projects/jobs/show.html.haml @@ -60,7 +60,7 @@ .js-truncated-info.truncated-info.hidden-xs.pull-left.hidden< Showing last %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 .controllers.pull-right diff --git a/changelogs/unreleased/sh-make-kib-human.yml b/changelogs/unreleased/sh-make-kib-human.yml new file mode 100644 index 00000000000..c40bb34fa4a --- /dev/null +++ b/changelogs/unreleased/sh-make-kib-human.yml @@ -0,0 +1,5 @@ +--- +title: Humanize the units of "Showing last X KiB of log" in job trace +merge_request: +author: +type: fixed diff --git a/spec/javascripts/job_spec.js b/spec/javascripts/job_spec.js index 4f06237deb5..b740c9ed893 100644 --- a/spec/javascripts/job_spec.js +++ b/spec/javascripts/job_spec.js @@ -1,4 +1,4 @@ -import { bytesToKiB } from '~/lib/utils/number_utils'; +import { numberToHumanSize } from '~/lib/utils/number_utils'; import * as urlUtils from '~/lib/utils/url_utility'; import '~/lib/utils/datetime_utility'; import Job from '~/job'; @@ -169,7 +169,7 @@ describe('Job', () => { expect( document.querySelector('.js-truncated-info-size').textContent.trim(), - ).toEqual(`${bytesToKiB(size)}`); + ).toEqual(`${numberToHumanSize(size)}`); }); it('shows incremented size', () => { @@ -195,7 +195,7 @@ describe('Job', () => { expect( document.querySelector('.js-truncated-info-size').textContent.trim(), - ).toEqual(`${bytesToKiB(50)}`); + ).toEqual(`${numberToHumanSize(50)}`); jasmine.clock().tick(4001); @@ -209,7 +209,7 @@ describe('Job', () => { expect( document.querySelector('.js-truncated-info-size').textContent.trim(), - ).toEqual(`${bytesToKiB(60)}`); + ).toEqual(`${numberToHumanSize(60)}`); }); it('renders the raw link', () => { |