Skip to content

Commit

Permalink
Merge pull request #17431 from davelopez/23.2_fix_upload_target_history
Browse files Browse the repository at this point in the history
[23.2] Fix target history when uploading files
  • Loading branch information
mvdbeek authored Feb 7, 2024
2 parents 7ff64b7 + a42993e commit 1e84387
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions client/src/components/Upload/DefaultBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,22 @@ const listExtensions = computed(() => props.effectiveExtensions.filter((ext) =>
const showHelper = computed(() => Object.keys(uploadItems.value).length === 0);
const uploadValues = computed(() => Object.values(uploadItems.value));
const queue = new UploadQueue({
announce: eventAnnounce,
chunkSize: props.chunkUploadSize,
complete: eventComplete,
error: eventError,
get: (index) => uploadItems.value[index],
historyId: historyId.value,
multiple: props.multiple,
progress: eventProgress,
success: eventSuccess,
warning: eventWarning,
});
const queue = computed(() => createUploadQueue());
function createUploadQueue() {
return new UploadQueue({
announce: eventAnnounce,
chunkSize: props.chunkUploadSize,
complete: eventComplete,
error: eventError,
get: (index) => uploadItems.value[index],
historyId: historyId.value,
multiple: props.multiple,
progress: eventProgress,
success: eventSuccess,
warning: eventWarning,
});
}
/** Add files to queue */
function addFiles(files, immediate = false) {
Expand All @@ -119,9 +123,9 @@ function addFiles(files, immediate = false) {
eventReset();
}
if (props.multiple) {
queue.add(files);
queue.value.add(files);
} else if (files.length > 0) {
queue.add([files[0]]);
queue.value.add([files[0]]);
}
}
}
Expand Down Expand Up @@ -165,7 +169,7 @@ function eventComplete() {
/** Create a new file */
function eventCreate() {
queue.add([{ name: DEFAULT_FILE_NAME, size: 0, mode: "new" }]);
queue.value.add([{ name: DEFAULT_FILE_NAME, size: 0, mode: "new" }]);
}
/** Error */
Expand Down Expand Up @@ -207,14 +211,14 @@ function eventRemove(index) {
counterAnnounce.value--;
}
Vue.delete(uploadItems.value, index);
queue.remove(index);
queue.value.remove(index);
}
/** Show remote files dialog or FTP files */
function eventRemoteFiles() {
filesDialog(
(items) => {
queue.add(
queue.value.add(
items.map((item) => {
const rval = {
mode: "url",
Expand All @@ -236,7 +240,7 @@ function eventReset() {
counterAnnounce.value = 0;
counterSuccess.value = 0;
counterError.value = 0;
queue.reset();
queue.value.reset();
uploadItems.value = {};
extension.value = props.defaultExtension;
dbKey.value = props.defaultDbKey;
Expand Down Expand Up @@ -269,7 +273,7 @@ function eventStart() {
});
emit("progress", 0, "success");
counterRunning.value = counterAnnounce.value;
queue.start();
queue.value.start();
}
}
Expand All @@ -278,7 +282,7 @@ function eventStop() {
if (isRunning.value) {
emit("progress", null, "info");
queueStopping.value = true;
queue.stop();
queue.value.stop();
}
}
Expand Down

0 comments on commit 1e84387

Please sign in to comment.