From 7a9054bb3f033c98067b3196378311dae54c5fbf Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 20 Jan 2026 01:31:53 +0000
Subject: [PATCH] =OperationQueue refactor to the JVBase/managers/queue namespace
---
assets/js/concise/Queue.js | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/assets/js/concise/Queue.js b/assets/js/concise/Queue.js
index a44d3a1..4c9adbc 100644
--- a/assets/js/concise/Queue.js
+++ b/assets/js/concise/Queue.js
@@ -5,6 +5,7 @@
this.user = window.auth.getUser();
+
this.canUpdateUI = true;
this.isProcessing = false;
this.isPolling = false;
@@ -26,7 +27,7 @@
this.initElements();
this.initListeners();
this.initStore();
- if (this.canUpdateUI) {
+ if (this.canUpdateUI && this.ui.panel) {
this.popup = new window.jvbPopup({
popup: this.ui.panel,
toggle: this.ui.toggle.button,
@@ -175,6 +176,7 @@
this.updatePanel('offline');
}
handleBeforeUnload(e) {
+ if (!this.ui.panel) return;
const total = this.getQueueByStatus(this.pendingStatuses).length;
if (total > 0) {
// Modern browsers ignore custom messages, but this triggers the native dialog
@@ -283,6 +285,9 @@
{name: 'status', keyPath: 'status'},
{name: 'type', keyPath: 'type'},
],
+ filters: {
+ user: window.auth.getUser()
+ },
showLoading: false,
}
)
@@ -486,13 +491,13 @@
let requestBody;
if (operation.data instanceof FormData) {
operation.data.append('id', operation.id);
- operation.data.append('user', this.user);
+ operation.data.append('user', window.auth.getUser());
requestBody = operation.data;
} else {
requestBody = JSON.stringify({
...operation.data,
id: operation.id,
- user: this.user
+ user: window.auth.getUser()
});
operation.headers['Content-Type'] = 'application/json';
}
@@ -861,7 +866,7 @@
}
updatePanel(status = 'syncing') {
- if (!this.panelStatuses.includes(status)) return;
+ if (!this.ui.panel || !this.panelStatuses.includes(status)) return;
this.ui.panel.classList.remove(...this.panelStatuses);
this.ui.panel.classList.add(status);
}
@@ -898,7 +903,7 @@
case 'completed':
return 'Successfully completed';
case 'failed':
- return `Failed: ${item.lastError || 'Unknown error'} (Retry ${item.retries}/${this.config.maxRetries})`;
+ return `Failed: ${item.lastError || 'Unknown error'} (Retry ${item.retries}/${2})`;
case 'failed_permanent':
return `Failed: ${item.lastError || 'Unknown error'}`;
default:
@@ -906,6 +911,7 @@
}
}
toggleQueue(on = true) {
+ if (!this.ui.panel) return;
this.ui.panel.hidden = !on;
this.ui.toggle.button.hidden = !on;
}
--
Gitblit v1.10.0