Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Frontend: data.js: Add file type validation to
Browse files Browse the repository at this point in the history
file uploader
  • Loading branch information
DeepChirp committed Dec 3, 2023
1 parent ec1c817 commit acb1c91
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions frontend/js/data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class DataPage {
constructor () {
constructor() {
this.uniqueIdLst = [];
this.examInfoBySemester = {};
this.examData = {};
Expand Down Expand Up @@ -81,7 +81,7 @@ class DataPage {
for (const uniqueId of this.uniqueIdLst) {
const data = await this.doTriggerCsvLoad(uniqueId);
if (data["code"] === 200) {
loadedCount ++;
loadedCount++;
} else {
// TODO: Show error message if request failed?
}
Expand Down Expand Up @@ -114,7 +114,7 @@ class DataPage {
else {
// TODO: Show error message if request failed?
}

}

initEventListeners() {
Expand All @@ -125,12 +125,12 @@ class DataPage {
loadBtn.addEventListener("click", () => {
this.loadCsv();
});
const pond = FilePond.create(fileUploader);
pond.allowMultiple = true;
pond.chunkUploads = false;
pond.allowRevert = false;
pond.maxFileSize = "1MB";
pond.setOptions({
const pond = FilePond.create(fileUploader, {
allowMultiple: true,
chunkUploads: false,
allowRevert: false,
maxFileSize: "1MB",
acceptedFileTypes: ['text/csv', 'application/vnd.ms-excel'],
server: {
process: {
url: '/api/scores/data/upload',
Expand Down Expand Up @@ -158,7 +158,7 @@ class DataPage {
downloadBtn.textContent = "下载";
downloadBtn.disabled = false;
});

});
}
}
Expand Down

0 comments on commit acb1c91

Please sign in to comment.