Skip to content

Commit 3bdf884

Browse files
authored
chore(import-export): fix number formatting for import label (#3509)
1 parent b9451ce commit 3bdf884

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

packages/compass-import-export/src/components/import-modal/import-modal.jsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
setFieldType,
3434
} from '../../modules/import';
3535
import styles from './import-modal.module.less';
36-
import createStyler from '../../utils/styler.js';
36+
import createStyler from '../../utils/styler';
3737
import classnames from 'classnames';
3838

3939
const style = createStyler(styles, 'import-modal');
@@ -331,14 +331,16 @@ class ImportModal extends PureComponent {
331331
? Math.max(docsProcessed, guesstimatedDocsTotal)
332332
: docsTotal
333333
}
334-
progressLabel={(written, total) =>
335-
`${written}\u00a0/\u00a0${isGuesstimated ? '~' : ''}${total}`
336-
}
337-
progressTitle={(written, total) =>
338-
`Imported ${written} out of ${
334+
progressLabel={(written, total) => {
335+
return `${formatNumber(written)}\u00a0/\u00a0${
336+
isGuesstimated ? '~' : ''
337+
}${formatNumber(total)}`;
338+
}}
339+
progressTitle={(written, total) => {
340+
return `Imported ${formatNumber(written)} out of ${
339341
isGuesstimated ? 'approximately ' : ''
340-
}${total} documents`
341-
}
342+
}${formatNumber(total)} documents`;
343+
}}
342344
message={MESSAGES[status]}
343345
/>
344346
<ErrorsList errors={errors} />

packages/compass-import-export/src/components/progress-bar/progress-bar.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import {
1212
} from '../../constants/process-status';
1313

1414
import styles from './progress-bar.module.less';
15-
import createStyler from '../../utils/styler.js';
16-
import formatNumber from '../../utils/format-number.js';
15+
import createStyler from '../../utils/styler';
16+
import formatNumber from '../../utils/format-number';
1717

1818
const style = createStyler(styles, 'progress-bar');
1919

@@ -133,13 +133,13 @@ class ProgressBar extends PureComponent {
133133

134134
return (
135135
<div className={style('chart-wrapper')}>
136-
{docsTotal && (
136+
{!isNaN(docsTotal) && (
137137
<div className={style()}>
138138
<div
139139
className={this.getBarClassName()}
140140
style={{ width: toPercentage(docsWritten, docsTotal) }}
141141
/>
142-
{Boolean(docsProcessed) && (
142+
{!isNaN(docsProcessed) && (
143143
<div
144144
className={this.getBarClassName(true)}
145145
style={{ width: toPercentage(docsProcessed, docsTotal) }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
const formatter = new Intl.NumberFormat();
2-
export default function (num) {
2+
export default function formatNumber(num) {
33
return formatter.format(Math.ceil(Number(num)));
44
}

0 commit comments

Comments
 (0)