upload fix

This commit is contained in:
Peter Papp
2021-05-15 07:22:57 +02:00
parent d8bbfcd4d2
commit 6dc34964d8
4 changed files with 42 additions and 27 deletions
+7 -2
View File
@@ -42,7 +42,7 @@
"/chunks/files~chunks/oasis/invoices/list~chunks/shared/file-browser.js": "/chunks/files~chunks/oasis/invoices/list~chunks/shared/file-browser.js?id=2d5163fd2869304720da",
"/chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~chunks/s~40cda2f4.js": "/chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~chunks/s~40cda2f4.js?id=25a8f2ba10196cc72353",
"/chunks/files~chunks/oasis/invoices~chunks/platform~chunks/shared~chunks/shared/file-browser~chunks/s~3fd62fd8.js": "/chunks/files~chunks/oasis/invoices~chunks/platform~chunks/shared~chunks/shared/file-browser~chunks/s~3fd62fd8.js?id=d39c8f198b09bb094e80",
"/chunks/files~chunks/shared/file-browser.js": "/chunks/files~chunks/shared/file-browser.js?id=5e4f31eae3364c4e9976",
"/chunks/files~chunks/shared/file-browser.js": "/chunks/files~chunks/shared/file-browser.js?id=063267aa542a652378d2",
"/chunks/files~chunks/shared/file-browser~chunks/shared/single-file.js": "/chunks/files~chunks/shared/file-browser~chunks/shared/single-file.js?id=7a6b6c8b23774249d5b2",
"/chunks/forgotten-password.js": "/chunks/forgotten-password.js?id=877a9289b77ac3885042",
"/chunks/homepage.js": "/chunks/homepage.js?id=48e0e9b3c870c46218ce",
@@ -261,5 +261,10 @@
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~2fac28cc.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~2fac28cc.js?id=57c854adb91ed9a9d088",
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~d5e36d91.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~d5e36d91.js?id=170765b4fd923b62195c",
"/vendors~chunks/files~chunks/platform~chunks/shared~chunks/shared/file-browser~chunks/shared/single-file.js": "/vendors~chunks/files~chunks/platform~chunks/shared~chunks/shared/file-browser~chunks/shared/single-file.js?id=ca01bfe1656f58710763",
"/vendors~chunks/platform~chunks/shared.js": "/vendors~chunks/platform~chunks/shared.js?id=eb141834bc24b72d8e92"
"/vendors~chunks/platform~chunks/shared.js": "/vendors~chunks/platform~chunks/shared.js?id=eb141834bc24b72d8e92",
"/js/main.cbf5194e183ab420137f.hot-update.js": "/js/main.cbf5194e183ab420137f.hot-update.js",
"/js/main.6644cc84ea25fa63f61c.hot-update.js": "/js/main.6644cc84ea25fa63f61c.hot-update.js",
"/chunks/files~chunks/shared/file-browser.3943bb43c1513dc42d9b.hot-update.js": "/chunks/files~chunks/shared/file-browser.3943bb43c1513dc42d9b.hot-update.js",
"/js/main.c7d922233b7f5838e35d.hot-update.js": "/js/main.c7d922233b7f5838e35d.hot-update.js",
"/js/main.d49da45e4e3c518ef2bb.hot-update.js": "/js/main.d49da45e4e3c518ef2bb.hot-update.js"
}
@@ -319,7 +319,7 @@
color: $dark_mode_text_primary;
}
.toolbar-go-back {
.location {
.location-title {
color: $dark_mode_text_primary;
}
+9 -2
View File
@@ -206,9 +206,16 @@ const Helpers = {
// Set Data
let formData = new FormData(),
uploadedSize = 0,
isNotGeneralError = true,
striped_name = item.file.name.replace(/[^A-Za-z 0-9 \.,\?""!@#\$%\^&\*\(\)-_=\+;:<>\/\\\|\}\{\[\]`~]*/g, ''),
filename = Array(16).fill(0).map(x => Math.random().toString(36).charAt(2)).join('') + '-' + striped_name + '.part'
striped_name = item.file.name
.replace(/[^A-Za-z 0-9 \.,\?""!@#\$%\^&\*\(\)-_=\+;:<>\/\\\|\}\{\[\]`~]*/g, ''),
filename = Array(16)
.fill(0)
.map(x => Math.random().toString(36).charAt(2))
.join('') + '-' + striped_name + '.part'
do {
let isLast = chunks.length === 1,
+25 -22
View File
@@ -183,7 +183,7 @@ const actions = {
'Content-Type': 'application/octet-stream'
},
onUploadProgress: event => {
var percentCompleted = Math.floor(((totalUploadedSize + event.loaded) / fileSize) * 100)
let percentCompleted = Math.floor(((totalUploadedSize + event.loaded) / fileSize) * 100);
commit('UPLOADING_FILE_PROGRESS', percentCompleted >= 100 ? 100 : percentCompleted)
@@ -195,33 +195,36 @@ const actions = {
.then(response => {
resolve(response)
commit('PROCESSING_FILE', false)
// Proceed if was returned database record
if (response.data.id) {
// Remove first file from file queue
commit('SHIFT_FROM_FILE_QUEUE')
commit('PROCESSING_FILE', false)
// Check if user is in uploading folder, if yes, than show new file
if (response.data.folder_id == getters.currentFolder.id) {
// Remove first file from file queue
commit('SHIFT_FROM_FILE_QUEUE')
// Add uploaded item into view
commit('ADD_NEW_ITEMS', response.data)
// Check if user is in uploading folder, if yes, than show new file
if (response.data.folder_id == getters.currentFolder.id) {
// Reset file progress
commit('UPLOADING_FILE_PROGRESS', 0)
// Add uploaded item into view
commit('ADD_NEW_ITEMS', response.data)
// Increase count in files in queue uploaded for 1
commit('INCREASE_FILES_IN_QUEUE_UPLOADED')
// Reset file progress
commit('UPLOADING_FILE_PROGRESS', 0)
// Increase count in files in queue uploaded for 1
commit('INCREASE_FILES_IN_QUEUE_UPLOADED')
}
// Start uploading next file if file queue is not empty
if (getters.fileQueue.length) {
Vue.prototype.$handleUploading(getters.fileQueue[0])
}
// Reset upload process
if (!getters.fileQueue.length)
commit('CLEAR_UPLOAD_PROGRESS')
}
// Start uploading next file if file queue is not empty
if (getters.fileQueue.length) {
Vue.prototype.$handleUploading(getters.fileQueue[0])
}
// Reset upload process
if (!getters.fileQueue.length)
commit('CLEAR_UPLOAD_PROGRESS')
})
.catch(error => {
reject(error)