Commit 6bbd190d authored by Fernando's avatar Fernando

Change byte formatting for corpus management

* Change MiB to MB
parent a20f106e
<script> <script>
import { GlLink } from '@gitlab/ui'; import { GlLink } from '@gitlab/ui';
import { numberToHumanSize } from '~/lib/utils/number_utils'; import { decimalBytes } from '~/lib/utils/unit_format';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
export default { export default {
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
}, },
computed: { computed: {
fileSize() { fileSize() {
return numberToHumanSize(this.corpus.size); return decimalBytes(this.corpus.size);
}, },
jobUrl() { jobUrl() {
/* /*
......
<script> <script>
import { GlButton, GlModal, GlModalDirective, GlSprintf } from '@gitlab/ui'; 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 { s__, __ } from '~/locale';
import addCorpusMutation from '../graphql/mutations/add_corpus.mutation.graphql'; import addCorpusMutation from '../graphql/mutations/add_corpus.mutation.graphql';
import resetCorpus from '../graphql/mutations/reset_corpus.mutation.graphql'; import resetCorpus from '../graphql/mutations/reset_corpus.mutation.graphql';
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
}, },
computed: { computed: {
formattedFileSize() { formattedFileSize() {
return numberToHumanSize(this.totalSize); return decimalBytes(this.totalSize);
}, },
isUploaded() { isUploaded() {
return this.states?.uploadState.progress === 100; return this.states?.uploadState.progress === 100;
......
...@@ -10,7 +10,7 @@ exports[`Name component renders name with correct file size 1`] = ` ...@@ -10,7 +10,7 @@ exports[`Name component renders name with correct file size 1`] = `
<span <span
data-testid="file-size" data-testid="file-size"
> >
381.47 MiB 400MB
</span> </span>
) )
...@@ -27,7 +27,7 @@ exports[`Name component renders the latest job 1`] = ` ...@@ -27,7 +27,7 @@ exports[`Name component renders the latest job 1`] = `
<span <span
data-testid="file-size" data-testid="file-size"
> >
381.47 MiB 400MB
</span> </span>
) )
...@@ -44,7 +44,7 @@ exports[`Name component without job path renders a - string instead of a link 1` ...@@ -44,7 +44,7 @@ exports[`Name component without job path renders a - string instead of a link 1`
<span <span
data-testid="file-size" data-testid="file-size"
> >
306.13 MiB 321MB
</span> </span>
) )
......
...@@ -28,14 +28,14 @@ describe('Name', () => { ...@@ -28,14 +28,14 @@ describe('Name', () => {
describe('component', () => { describe('component', () => {
it('renders name with correct file size', () => { it('renders name with correct file size', () => {
createComponent(); createComponent();
expect(findFileSize().text()).toBe('381.47 MiB'); expect(findFileSize().text()).toBe('400MB');
expect(findName().element).toMatchSnapshot(); expect(findName().element).toMatchSnapshot();
}); });
it('renders the latest job', () => { it('renders the latest job', () => {
createComponent(); createComponent();
expect(wrapper.findComponent(GlLink).exists()).toBe(true); expect(wrapper.findComponent(GlLink).exists()).toBe(true);
expect(findFileSize().text()).toBe('381.47 MiB'); expect(findFileSize().text()).toBe('400MB');
expect(findName().element).toMatchSnapshot(); expect(findName().element).toMatchSnapshot();
}); });
...@@ -43,7 +43,7 @@ describe('Name', () => { ...@@ -43,7 +43,7 @@ describe('Name', () => {
it('renders a - string instead of a link', () => { it('renders a - string instead of a link', () => {
createComponent({ propsData: { corpus: corpuses[2] } }); createComponent({ propsData: { corpus: corpuses[2] } });
expect(wrapper.findComponent(GlLink).exists()).toBe(false); expect(wrapper.findComponent(GlLink).exists()).toBe(false);
expect(findFileSize().text()).toBe('306.13 MiB'); expect(findFileSize().text()).toBe('321MB');
expect(findName().element).toMatchSnapshot(); 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