θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
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 @@ -306,6 +306,7 @@ function Directory({
workspace={workspace}
fetchKeys={fetchKeys}
setLoading={setLoading}
setLoadingMessage={setLoadingMessage}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ function FileUploadProgressComponent({
reason = null,
onUploadSuccess,
onUploadError,
setLoading,
setLoadingMessage,
}) {
const [timerMs, setTimerMs] = useState(10);
const [status, setStatus] = useState("pending");
const [error, setError] = useState("");

useEffect(() => {
async function uploadFile() {
setLoading(true);
setLoadingMessage("Uploading file...");
const start = Number(new Date());
const formData = new FormData();
formData.append("file", file, file.name);
Expand All @@ -34,6 +38,8 @@ function FileUploadProgressComponent({
onUploadError(data.error);
setError(data.error);
} else {
setLoading(false);
setLoadingMessage("");
setStatus("complete");
clearInterval(timer);
onUploadSuccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ import { v4 } from "uuid";
import FileUploadProgress from "./FileUploadProgress";
import Workspace from "../../../../../models/workspace";

export default function UploadFile({ workspace, fetchKeys, setLoading }) {
export default function UploadFile({
workspace,
fetchKeys,
setLoading,
setLoadingMessage,
}) {
const [ready, setReady] = useState(false);
const [files, setFiles] = useState([]);
const [fetchingUrl, setFetchingUrl] = useState(false);

const handleSendLink = async (e) => {
e.preventDefault();
setLoading(true);
setLoadingMessage("Scraping link...");
setFetchingUrl(true);
const formEl = e.target;
const form = new FormData(formEl);
Expand Down Expand Up @@ -114,6 +120,8 @@ export default function UploadFile({ workspace, fetchKeys, setLoading }) {
reason={file?.reason}
onUploadSuccess={handleUploadSuccess}
onUploadError={handleUploadError}
setLoading={setLoading}
setLoadingMessage={setLoadingMessage}
/>
))}
</div>
Expand Down