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
6 changes: 3 additions & 3 deletions src/components/mui/__tests__/mui-formik-upload.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
* limitations under the License.
* */

jest.mock("../../inputs/upload-input-v2", () => {
jest.mock("../../inputs/upload-input-v3", () => {
const React = require("react");
const MockUploadInputV2 = ({ value, canAdd }) => (
const MockUploadInputV3 = ({ value = [], canAdd = true }) => (
<div data-testid="upload-input" data-can-add={canAdd}>
{value.length} file(s)
</div>
);
return { __esModule: true, default: MockUploadInputV2 };
return { __esModule: true, default: MockUploadInputV3 };
});

import React from "react";
Expand Down
6 changes: 4 additions & 2 deletions src/components/mui/formik-inputs/mui-formik-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
import React from "react";
import PropTypes from "prop-types";
import { FormHelperText } from "@mui/material";
import UploadInputV2 from "../../inputs/upload-input-v2";
import T from "i18n-react/dist/i18n-react";
import UploadInputV3 from "../../inputs/upload-input-v3";
import { useField } from "formik";
import {
ALLOWED_INVENTORY_IMAGE_FORMATS,
Expand Down Expand Up @@ -85,7 +86,7 @@ const MuiFormikUpload = ({
{meta.touched && meta.error && (
<FormHelperText error>{meta.error}</FormHelperText>
)}
<UploadInputV2
<UploadInputV3
id={id}
name={name}
onUploadComplete={handleUploadComplete}
Expand All @@ -96,6 +97,7 @@ const MuiFormikUpload = ({
djsConfig={{ withCredentials: true }}
maxFiles={maxFiles}
canAdd={canAddMore()}
error={!canAddMore() ? T.translate("errors.maximum_files") : undefined}
parallelChunkUploads
/>
</>
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"user_not_auth": "Hold on. Your user is not authenticated!.",
"user_not_authz": "Hold on. Your user is not authorized!.",
"session_expired": "Hold on. Your session expired!.",
"server_error": "There was a problem with our server, please contact admin."
"server_error": "There was a problem with our server, please contact admin.",
"maximum_files": "Maximum number of files has been reached"
},
"general": {
"select_summit": "Select a Summit...",
Expand Down
Loading