Commit 84703de4 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '336500-file-size-formats' into 'master'

Change byte formatting for corpus management

See merge request gitlab-org/gitlab!67284
parents ce3edf33 6bbd190d
<script>
import { GlLink } from '@gitlab/ui';
import { numberToHumanSize } from '~/lib/utils/number_utils';
import { decimalBytes } from '~/lib/utils/unit_format';
import { s__ } from '~/locale';
export default {
......@@ -18,7 +18,7 @@ export default {
},
computed: {
fileSize() {
return numberToHumanSize(this.corpus.size);
return decimalBytes(this.corpus.size);
},
jobUrl() {
/*
......
<script>
import { GlButton, GlModal, GlModalDirective, GlSprintf } from '@gitlab/ui';
import { numberToHumanSize } from '~/lib/utils/number_utils';
import { decimalBytes } from '~/lib/utils/unit_format';
import { s__, __ } from '~/locale';
import addCorpusMutation from '../graphql/mutations/add_corpus.mutation.graphql';
import resetCorpus from '../graphql/mutations/reset_corpus.mutation.graphql';
......@@ -51,7 +51,7 @@ export default {
},
computed: {
formattedFileSize() {
return numberToHumanSize(this.totalSize);
return decimalBytes(this.totalSize);
},
isUploaded() {
return this.states?.uploadState.progress === 100;
......
......@@ -10,7 +10,7 @@ exports[`Name component renders name with correct file size 1`] = `
<span
data-testid="file-size"
>
381.47 MiB
400MB
</span>
)
......@@ -27,7 +27,7 @@ exports[`Name component renders the latest job 1`] = `
<span
data-testid="file-size"
>
381.47 MiB
400MB
</span>
)
......@@ -44,7 +44,7 @@ exports[`Name component without job path renders a - string instead of a link 1`
<span
data-testid="file-size"
>
306.13 MiB
321MB
</span>
)
......
......@@ -28,14 +28,14 @@ describe('Name', () => {
describe('component', () => {
it('renders name with correct file size', () => {
createComponent();
expect(findFileSize().text()).toBe('381.47 MiB');
expect(findFileSize().text()).toBe('400MB');
expect(findName().element).toMatchSnapshot();
});
it('renders the latest job', () => {
createComponent();
expect(wrapper.findComponent(GlLink).exists()).toBe(true);
expect(findFileSize().text()).toBe('381.47 MiB');
expect(findFileSize().text()).toBe('400MB');
expect(findName().element).toMatchSnapshot();
});
......@@ -43,7 +43,7 @@ describe('Name', () => {
it('renders a - string instead of a link', () => {
createComponent({ propsData: { corpus: corpuses[2] } });
expect(wrapper.findComponent(GlLink).exists()).toBe(false);
expect(findFileSize().text()).toBe('306.13 MiB');
expect(findFileSize().text()).toBe('321MB');
expect(findName().element).toMatchSnapshot();
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment