revert blocking image gen

This commit is contained in:
Karl 2025-08-12 15:21:23 +01:00
parent 34f8a05035
commit f5427d18ed

View File

@ -73,19 +73,6 @@
background: #555; background: #555;
} }
button:disabled {
background: #555;
cursor: not-allowed;
opacity: 0.6;
}
.queue-message {
color: #ffcc00;
font-size: 14px;
margin-top: 10px;
text-align: center;
min-height: 20px;
}
#spinner-overlay { #spinner-overlay {
position: fixed; position: fixed;
@ -211,10 +198,9 @@
<div class="button-group"> <div class="button-group">
<button onclick="showSpinner(); location.href='/'">Back</button> <button onclick="showSpinner(); location.href='/'">Back</button>
<button id="send-prompt-btn" onclick="sendPrompt()">Send Prompt</button> <button onclick="sendPrompt()">Send Prompt</button>
<button id="random-prompt-btn" onclick="randomPrompt()">Random Prompt</button> <button onclick="randomPrompt()">Random Prompt</button>
</div> </div>
<div id="queue-message" class="queue-message"></div>
<div class="model-selection"> <div class="model-selection">
<div class="model-group"> <div class="model-group">
@ -288,31 +274,10 @@
{% block scripts %} {% block scripts %}
<script> <script>
const overlay = document.getElementById('spinner-overlay'); const overlay = document.getElementById('spinner-overlay');
const sendPromptBtn = document.getElementById('send-prompt-btn');
const randomPromptBtn = document.getElementById('random-prompt-btn');
const queueMessage = document.getElementById('queue-message');
function showSpinner() { overlay.style.visibility = 'visible'; } function showSpinner() { overlay.style.visibility = 'visible'; }
function updateButtonStates(queueCount) {
if (queueCount > 0) {
sendPromptBtn.disabled = true;
randomPromptBtn.disabled = true;
queueMessage.textContent = "Please wait until the current image is processed...";
} else {
sendPromptBtn.disabled = false;
randomPromptBtn.disabled = false;
queueMessage.textContent = "";
}
}
function sendPrompt() { function sendPrompt() {
// Check if buttons are disabled
if (sendPromptBtn.disabled) {
alert("Please wait until the current image is processed.");
return;
}
showSpinner(); showSpinner();
const prompt = document.getElementById('prompt-box').value; const prompt = document.getElementById('prompt-box').value;
const model = document.getElementById('model-select').value; const model = document.getElementById('model-select').value;
@ -338,12 +303,6 @@
} }
function randomPrompt() { function randomPrompt() {
// Check if buttons are disabled
if (randomPromptBtn.disabled) {
alert("Please wait until the current image is processed.");
return;
}
showSpinner(); showSpinner();
const model = document.getElementById('model-select').value; const model = document.getElementById('model-select').value;
const promptModel = document.getElementById('prompt-model-select').value; const promptModel = document.getElementById('prompt-model-select').value;
@ -372,10 +331,6 @@
const queueDropdown = document.getElementById('queue-dropdown'); const queueDropdown = document.getElementById('queue-dropdown');
const queueCountSpan = document.getElementById('queue-count'); const queueCountSpan = document.getElementById('queue-count');
// Check initial queue count and update button states
const initialQueueCount = parseInt(queueCountSpan.textContent) || 0;
updateButtonStates(initialQueueCount);
// Toggle dropdown visibility // Toggle dropdown visibility
queueBtn.addEventListener('click', function(e) { queueBtn.addEventListener('click', function(e) {
e.stopPropagation(); e.stopPropagation();
@ -401,10 +356,7 @@
fetch('/api/queue') fetch('/api/queue')
.then(response => response.json()) .then(response => response.json())
.then(jobs => { .then(jobs => {
const queueCount = jobs.length; queueCountSpan.textContent = jobs.length;
queueCountSpan.textContent = queueCount;
updateButtonStates(queueCount);
const container = queueDropdown; const container = queueDropdown;
container.innerHTML = ''; container.innerHTML = '';