disable a select file while global serch
This commit is contained in:
@@ -49,6 +49,7 @@ export default function SectionSearchFile() {
|
||||
const [fileType, setFileType] = useState<string | null>(null);
|
||||
const queryClient = useQueryClient();
|
||||
const isCancelledRef = useRef(false);
|
||||
const [isFileSearchLoading, setIsFileSearchLoading] = useState(false);
|
||||
|
||||
const childRef = useRef(null);
|
||||
|
||||
@@ -285,6 +286,10 @@ export default function SectionSearchFile() {
|
||||
}
|
||||
});
|
||||
|
||||
const handleLoadingChange = (loading: boolean) => {
|
||||
setIsFileSearchLoading(loading);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="upload-section">
|
||||
<div className="search-info">
|
||||
@@ -316,13 +321,14 @@ export default function SectionSearchFile() {
|
||||
style={{ display: 'none' }}
|
||||
onChange={handleFileInputChange}
|
||||
aria-label="Выбор файла для защиты"
|
||||
disabled={isFileSearchLoading || (uploadProgress !== undefined && uploadProgress !== 100)}
|
||||
/>
|
||||
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={handleButtonClick}
|
||||
type="button"
|
||||
disabled={uploadProgress && uploadProgress !== 100 ? true : false}
|
||||
disabled={isFileSearchLoading || (uploadProgress !== undefined && uploadProgress !== 100)}
|
||||
>
|
||||
Выбрать файл
|
||||
</button>
|
||||
@@ -363,7 +369,13 @@ export default function SectionSearchFile() {
|
||||
</div>
|
||||
|
||||
{isFileUploaded && (
|
||||
<FileSearchPanel fileId={fileId} ref={childRef} allowedExtensions={allFilesExtensions} fileType={fileType} />
|
||||
<FileSearchPanel
|
||||
fileId={fileId}
|
||||
ref={childRef}
|
||||
allowedExtensions={allFilesExtensions}
|
||||
fileType={fileType}
|
||||
onLoadingChange={handleLoadingChange}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user