Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
setFieldType,
} from '../../modules/import';
import styles from './import-modal.module.less';
import createStyler from '../../utils/styler.js';
import createStyler from '../../utils/styler';
import classnames from 'classnames';

const style = createStyler(styles, 'import-modal');
Expand Down Expand Up @@ -331,14 +331,16 @@ class ImportModal extends PureComponent {
? Math.max(docsProcessed, guesstimatedDocsTotal)
: docsTotal
}
progressLabel={(written, total) =>
`${written}\u00a0/\u00a0${isGuesstimated ? '~' : ''}${total}`
}
progressTitle={(written, total) =>
`Imported ${written} out of ${
progressLabel={(written, total) => {
return `${formatNumber(written)}\u00a0/\u00a0${
isGuesstimated ? '~' : ''
}${formatNumber(total)}`;
}}
progressTitle={(written, total) => {
return `Imported ${formatNumber(written)} out of ${
isGuesstimated ? 'approximately ' : ''
}${total} documents`
}
}${formatNumber(total)} documents`;
}}
message={MESSAGES[status]}
/>
<ErrorsList errors={errors} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
} from '../../constants/process-status';

import styles from './progress-bar.module.less';
import createStyler from '../../utils/styler.js';
import formatNumber from '../../utils/format-number.js';
import createStyler from '../../utils/styler';
import formatNumber from '../../utils/format-number';

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

Expand Down Expand Up @@ -133,13 +133,13 @@ class ProgressBar extends PureComponent {

return (
<div className={style('chart-wrapper')}>
{docsTotal && (
{!isNaN(docsTotal) && (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by to fix 0 rendering for a split second (value needs to be false, null, or undefined for react not to render it)

<div className={style()}>
<div
className={this.getBarClassName()}
style={{ width: toPercentage(docsWritten, docsTotal) }}
/>
{Boolean(docsProcessed) && (
{!isNaN(docsProcessed) && (
<div
className={this.getBarClassName(true)}
style={{ width: toPercentage(docsProcessed, docsTotal) }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const formatter = new Intl.NumberFormat();
export default function (num) {
export default function formatNumber(num) {
return formatter.format(Math.ceil(Number(num)));
}