mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
Merge branch 'user-group-bugs' of github.com:ToolJet/ToolJet into group-revamp-fix_krit
This commit is contained in:
commit
1855d676e0
3 changed files with 21 additions and 4 deletions
|
|
@ -134,7 +134,6 @@ class ManageGranularAccessComponent extends React.Component {
|
|||
})
|
||||
.catch(({ error }) => {
|
||||
this.closeAddPermissionModal();
|
||||
console.log(error);
|
||||
if (error?.error) {
|
||||
this.props.updateParentState({
|
||||
showEditRoleErrorModal: true,
|
||||
|
|
@ -145,7 +144,7 @@ class ManageGranularAccessComponent extends React.Component {
|
|||
});
|
||||
return;
|
||||
}
|
||||
toast.error(error?.error, {
|
||||
toast.error(error, {
|
||||
style: {
|
||||
maxWidth: '500px',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,7 +3,15 @@ import { useDropzone } from 'react-dropzone';
|
|||
import BulkIcon from '@/_ui/Icon/BulkIcons';
|
||||
import { toast } from 'react-hot-toast';
|
||||
|
||||
export function FileDropzone({ handleClick, hiddenFileInput, errors, handleFileChange, inviteBulkUsers, onDrop }) {
|
||||
export function FileDropzone({
|
||||
handleClick,
|
||||
hiddenFileInput,
|
||||
errors,
|
||||
handleFileChange,
|
||||
inviteBulkUsers,
|
||||
onDrop,
|
||||
setFileUpload,
|
||||
}) {
|
||||
const [fileData, setFileData] = useState();
|
||||
const { getRootProps, getInputProps, isDragActive, acceptedFiles } = useDropzone({
|
||||
accept: { parsedFileType: ['text/csv'] },
|
||||
|
|
@ -53,11 +61,15 @@ export function FileDropzone({ handleClick, hiddenFileInput, errors, handleFileC
|
|||
onChange={(e) => {
|
||||
const file = e.target.files[0];
|
||||
setFileData(file);
|
||||
if (file === undefined) {
|
||||
setFileUpload(false);
|
||||
}
|
||||
if (Math.round(file.size / 1024) > 1024) {
|
||||
toast.error('File size cannot exceed more than 1MB');
|
||||
e.target.value = null;
|
||||
} else {
|
||||
handleFileChange(file);
|
||||
setFileUpload(true);
|
||||
}
|
||||
}}
|
||||
accept=".csv"
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ function InviteUsersForm({
|
|||
return indexA - indexB;
|
||||
});
|
||||
const [isChangeRoleModalOpen, setIsChangeRoleModalOpen] = useState(false);
|
||||
const [fileUpload, setFileUpload] = useState(false);
|
||||
const groupedOptions = [
|
||||
{
|
||||
label: 'default',
|
||||
|
|
@ -54,6 +55,9 @@ function InviteUsersForm({
|
|||
},
|
||||
];
|
||||
const [selectedGroups, setSelectedGroups] = useState([]);
|
||||
useEffect(() => {
|
||||
setFileUpload(false);
|
||||
}, [activeTab]);
|
||||
|
||||
const hiddenFileInput = useRef(null);
|
||||
|
||||
|
|
@ -86,6 +90,7 @@ function InviteUsersForm({
|
|||
toast.error('File size cannot exceed more than 1MB');
|
||||
} else {
|
||||
handleFileChange(file);
|
||||
setFileUpload(true);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
|
@ -334,6 +339,7 @@ function InviteUsersForm({
|
|||
handleFileChange={handleFileChange}
|
||||
inviteBulkUsers={inviteBulkUsers}
|
||||
onDrop={onDrop}
|
||||
setFileUpload={setFileUpload}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -353,7 +359,7 @@ function InviteUsersForm({
|
|||
form={activeTab == 1 ? 'inviteByEmail' : 'inviteBulkUsers'}
|
||||
type="submit"
|
||||
variant="primary"
|
||||
disabled={uploadingUsers || creatingUser || !isEdited()}
|
||||
disabled={uploadingUsers || creatingUser || !isEdited() || (activeTab !== 1 && !fileUpload)}
|
||||
data-cy={activeTab == 1 ? 'button-invite-users' : 'button-upload-users'}
|
||||
leftIcon={activeTab == 1 ? 'sent' : 'fileupload'}
|
||||
width="20"
|
||||
|
|
|
|||
Loading…
Reference in a new issue