From d8d87ddf871c4529b67ffd70d66c0f724dbcb36e Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Thu, 25 Feb 2021 20:28:57 -0500 Subject: [PATCH] Filter files uploaded for supported ones The current behavior of qvis is to reject all files uploaded together when one of them cannot be accepted because of an invalid filename. This patch modifies that behavior so that only those files that do not have an acceptable file extension are rejected and the others are properly parsed. --- .../filemanager/FileManagerContainer.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/visualizations/src/components/filemanager/FileManagerContainer.vue b/visualizations/src/components/filemanager/FileManagerContainer.vue index 01edbc8..f97695a 100644 --- a/visualizations/src/components/filemanager/FileManagerContainer.vue +++ b/visualizations/src/components/filemanager/FileManagerContainer.vue @@ -48,7 +48,7 @@ :state="Boolean(filesToUpload.length > 0)" placeholder="Choose files or drop them here..." drop-placeholder="Drop files here..." - accept=".qlog,.json,.netlog" + accept=".qlog,.qlognd,.json,.netlog" class="text-nowrap text-truncate" > @@ -274,22 +274,24 @@ return; } + let filteredFilesToUpload: Array = []; for ( const file of this.filesToUpload ){ if ( file === null || (!file.name.endsWith(".qlog") && !file.name.endsWith(".json")) && !file.name.endsWith(".netlog") && !file.name.endsWith(".qlognd")) { Vue.notify({ group: "default", - title: "Provide .qlog file", + title: "Provide .qlog, .qlognd, .json, or .netlog file", type: "error", duration: 6000, - text: "We currently only support uploading .qlog files. " + file.name, + text: "Cannot accept " + file.name + "; we currently only support uploading .qlog, .qlognd, .json, or .netlog files. ", }); - - return; + } + else { + filteredFilesToUpload.push(file); } } - for ( const file of this.filesToUpload ){ + for ( const file of filteredFilesToUpload ){ const uploadFileName = file.name; Vue.notify({