fix file size display from kB to KB (#10561)
* fix file size display from kB to KB * add a wrapper function for filesize --------- Co-authored-by: Neeraj <neerajv@thirdrocktechkno.com>
This commit is contained in:
parent
8a150252bf
commit
ce0bd00c5b
5 changed files with 33 additions and 15 deletions
|
@ -16,13 +16,13 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import React from "react";
|
||||
import { filesize } from "filesize";
|
||||
|
||||
import { Icon as FileIcon } from "../../../../res/img/feather-customised/files.svg";
|
||||
import { _t } from "../../../languageHandler";
|
||||
import { getBlobSafeMimeType } from "../../../utils/blobs";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
import DialogButtons from "../elements/DialogButtons";
|
||||
import { fileSize } from "../../../utils/FileUtils";
|
||||
|
||||
interface IProps {
|
||||
file: File;
|
||||
|
@ -116,7 +116,7 @@ export default class UploadConfirmDialog extends React.Component<IProps> {
|
|||
{preview && <div>{preview}</div>}
|
||||
<div id={fileId}>
|
||||
{placeholder}
|
||||
{this.props.file.name} ({filesize(this.props.file.size)})
|
||||
{this.props.file.name} ({fileSize(this.props.file.size)})
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { filesize } from "filesize";
|
||||
import React from "react";
|
||||
|
||||
import { _t } from "../../../languageHandler";
|
||||
import ContentMessages from "../../../ContentMessages";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
import DialogButtons from "../elements/DialogButtons";
|
||||
import { fileSize } from "../../../utils/FileUtils";
|
||||
|
||||
interface IProps {
|
||||
badFiles: File[];
|
||||
|
@ -52,8 +52,8 @@ export default class UploadFailureDialog extends React.Component<IProps> {
|
|||
"This file is <b>too large</b> to upload. " +
|
||||
"The file size limit is %(limit)s but this file is %(sizeOfThisFile)s.",
|
||||
{
|
||||
limit: filesize(this.props.contentMessages.getUploadLimit()),
|
||||
sizeOfThisFile: filesize(this.props.badFiles[0].size),
|
||||
limit: fileSize(this.props.contentMessages.getUploadLimit()),
|
||||
sizeOfThisFile: fileSize(this.props.badFiles[0].size),
|
||||
},
|
||||
{
|
||||
b: (sub) => <b>{sub}</b>,
|
||||
|
@ -71,7 +71,7 @@ export default class UploadFailureDialog extends React.Component<IProps> {
|
|||
message = _t(
|
||||
"These files are <b>too large</b> to upload. " + "The file size limit is %(limit)s.",
|
||||
{
|
||||
limit: filesize(this.props.contentMessages.getUploadLimit()),
|
||||
limit: fileSize(this.props.contentMessages.getUploadLimit()),
|
||||
},
|
||||
{
|
||||
b: (sub) => <b>{sub}</b>,
|
||||
|
@ -89,7 +89,7 @@ export default class UploadFailureDialog extends React.Component<IProps> {
|
|||
message = _t(
|
||||
"Some files are <b>too large</b> to be uploaded. " + "The file size limit is %(limit)s.",
|
||||
{
|
||||
limit: filesize(this.props.contentMessages.getUploadLimit()),
|
||||
limit: fileSize(this.props.contentMessages.getUploadLimit()),
|
||||
},
|
||||
{
|
||||
b: (sub) => <b>{sub}</b>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue