Loading client/src/components/Upload/DefaultBox.vue +32 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ import { faCopy, faEdit, faFolderOpen, faLaptop } from "@fortawesome/free-solid- import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { BButton } from "bootstrap-vue"; import { filesDialog } from "utils/data"; import Vue, { computed, ref } from "vue"; import Vue, { computed, onMounted, ref, watch } from "vue"; import { UploadQueue } from "@/utils/upload-queue.js"; Loading Loading @@ -84,6 +84,7 @@ const uploadCompleted = ref(0); const uploadFile = ref(null); const uploadItems = ref({}); const uploadSize = ref(0); const queue = ref(); const counterNonRunning = computed(() => counterAnnounce.value + counterSuccess.value + counterError.value); const enableBuild = computed( Loading @@ -99,7 +100,16 @@ 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 = computed(() => createUploadQueue()); onMounted(() => { queue.value = initUploadQueue(); }); watch( () => props.historyId, () => { queue.value = initUploadQueue(); } ); function createUploadQueue() { return new UploadQueue({ Loading @@ -116,6 +126,26 @@ function createUploadQueue() { }); } function initUploadQueue() { if (!queue.value) { return createUploadQueue(); } if (queue.value.historyId !== historyId.value) { // The history has changed since the queue was created if (isRunning.value) { // The queue is running on the old history, so we need to create a new queue // that will target the new history return createUploadQueue(); } // The queue is not running, so we can just update the target historyId and reuse the queue queue.value.historyId = historyId.value; return queue.value; } // Nothing has changed, so we can just return the existing queue return queue.value; } /** Add files to queue */ function addFiles(files, immediate = false) { if (!isRunning.value) { Loading client/src/utils/upload-queue.js +8 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,14 @@ export class UploadQueue { return this.queue.size; } get historyId() { return this.opts.historyId; } set historyId(historyId) { this.opts.historyId = historyId; } // Initiate upload process start() { if (!this.isRunning) { Loading Loading
client/src/components/Upload/DefaultBox.vue +32 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ import { faCopy, faEdit, faFolderOpen, faLaptop } from "@fortawesome/free-solid- import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { BButton } from "bootstrap-vue"; import { filesDialog } from "utils/data"; import Vue, { computed, ref } from "vue"; import Vue, { computed, onMounted, ref, watch } from "vue"; import { UploadQueue } from "@/utils/upload-queue.js"; Loading Loading @@ -84,6 +84,7 @@ const uploadCompleted = ref(0); const uploadFile = ref(null); const uploadItems = ref({}); const uploadSize = ref(0); const queue = ref(); const counterNonRunning = computed(() => counterAnnounce.value + counterSuccess.value + counterError.value); const enableBuild = computed( Loading @@ -99,7 +100,16 @@ 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 = computed(() => createUploadQueue()); onMounted(() => { queue.value = initUploadQueue(); }); watch( () => props.historyId, () => { queue.value = initUploadQueue(); } ); function createUploadQueue() { return new UploadQueue({ Loading @@ -116,6 +126,26 @@ function createUploadQueue() { }); } function initUploadQueue() { if (!queue.value) { return createUploadQueue(); } if (queue.value.historyId !== historyId.value) { // The history has changed since the queue was created if (isRunning.value) { // The queue is running on the old history, so we need to create a new queue // that will target the new history return createUploadQueue(); } // The queue is not running, so we can just update the target historyId and reuse the queue queue.value.historyId = historyId.value; return queue.value; } // Nothing has changed, so we can just return the existing queue return queue.value; } /** Add files to queue */ function addFiles(files, immediate = false) { if (!isRunning.value) { Loading
client/src/utils/upload-queue.js +8 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,14 @@ export class UploadQueue { return this.queue.size; } get historyId() { return this.opts.historyId; } set historyId(historyId) { this.opts.historyId = historyId; } // Initiate upload process start() { if (!this.isRunning) { Loading