<!DOCTYPE html> <html> <head> <title>ZlewnieGEN V5.2</title> <link rel="icon"…
- User
<!-- Remove the <form> element completely --> <div> <div class="form-group"> <label for="k_przewod_fc">(K) Przewód <i>Shapefile (ZIP)</i>:</label> <input type="file" id="k_przewod_fc" name="k_przewod_fc" accept=".zip" required> <span class="error" id="kPrzewodError">Please select a ZIP file</span> </div> <div class="form-group"> <label for="studnia_fc">(K) Studnia <i>Shapefile (ZIP)</i>:</label> <input type="file" id="studnia_fc" name="studnia_fc" accept=".zip" required> <span class="error" id="studniaError">Please select a ZIP file</span> </div> <div class="form-group"> <label for="nrw_ids">NRW IDs (np.: 302257218, 302258005, (...)):</label> <input type="text" id="nrw_ids" name="nrw_ids" pattern="\d+(,\s*\d+)*" required> <span class="error" id="nrwIdsError">Invalid NRW IDs format</span> </div> <button type="button" id="submitBtn">Uruchom</button> <div class="progress-container"> <progress id="progressBar" value="0" max="100"></progress> <span id="progressText">0%</span> </div> </div> <script> document.addEventListener('DOMContentLoaded', () => { const submitBtn = document.getElementById('submitBtn'); const progressBar = document.getElementById('progressBar'); const progressText = document.getElementById('progressText'); let progressInterval; // Enable/disable button based on form state function validateForm() { const kPrzewodFile = document.getElementById('k_przewod_fc').files[0]; const studniaFile = document.getElementById('studnia_fc').files[0]; const nrwIdsInput = document.getElementById('nrw_ids'); const isValid = ( kPrzewodFile && studniaFile && nrwIdsInput.value.trim() !== '' ); submitBtn.disabled = !isValid; } // Set up event listeners for form changes document.getElementById('k_przewod_fc').addEventListener('change', validateForm); document.getElementById('studnia_fc').addEventListener('change', validateForm); document.getElementById('nrw_ids').addEventListener('input', validateForm); // Initial validation validateForm(); // Process button click submitBtn.addEventListener('click', async (e) => { console.log("Button clicked - starting processing"); e.preventDefault(); // Disable button during processing submitBtn.disabled = true; progressBar.value = 0; progressText.textContent = '0%'; // Create FormData const formData = new FormData(); formData.append('k_przewod_fc', document.getElementById('k_przewod_fc').files[0]); formData.append('studnia_fc', document.getElementById('studnia_fc').files[0]); formData.append('nrw_ids', document.getElementById('nrw_ids').value); try { console.log("Sending request to /process_files/"); // Start processing const response = await fetch("/process_files/", { method: "POST", body: formData, }); console.log("Received response:", response.status); if (!response.ok) { const error = await response.json(); throw new Error(error.error || 'Processing failed'); } const result = await response.json(); console.log("Processing started:", result.message); // Start progress polling progressInterval = setInterval(async () => { try { console.log("Checking progress..."); const res = await fetch("/progress/"); const data = await res.json(); console.log(`Current progress: ${data.progress}%`); progressBar.value = data.progress; progressText.textContent = `${data.progress}%`; if (data.progress >= 100) { clearInterval(progressInterval); console.log("Processing complete, preparing download..."); // Get result file path const pathRes = await fetch("/get_result_path/"); const pathData = await pathRes.json(); if (pathData.path) { // Trigger download after short delay setTimeout(() => { console.log("Downloading file:", pathData.path); window.location.href = "/download/"; submitBtn.disabled = false; }, 1000); } else { console.error("Result path not found"); alert("Processing complete but file not found"); submitBtn.disabled = false; } } } catch (err) { console.error('Progress polling error:', err); clearInterval(progressInterval); alert('Error checking progress: ' + err.message); submitBtn.disabled = false; } }, 1000); } catch (error) { console.error('Processing error:', error); alert('Error: ' + error.message); submitBtn.disabled = false; } }); }); </script> - Assistant
Here's the updated HTML with better styling, centered layout, and a debug window to show background processing:
<!DOCTYPE html> <html> <head> <title>ZlewnieGEN V5.2</title> <link rel="icon" href="/static/favicon.ico" type="image/png"> <link rel="stylesheet" href="/static/style.css"> <link href='https://fonts.googleapis.com/css?family=Cabin+Condensed:700' rel='stylesheet' type='text/css'> <style> .container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; } .form-container { background: rgba(255, 255, 255, 0.95); padding: 30px; border-radius: 12px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px); max-width: 600px; width: 100%; margin-bottom: 20px; } h1 { text-align: center; color: #333; margin-bottom: 30px; font-size: 24px; line-height: 1.4; } .form-group { margin-bottom: 20px; } .form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #555; font-size: 14px; } .form-group input { width: 100%; padding: 12px 16px; border: 2px solid #e1e5e9; border-radius: 8px; font-size: 16px; transition: all 0.3s ease; box-sizing: border-box; } .form-group input:focus { outline: none; border-color: #007BFF; box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1); } .form-group input[type="file"] { padding: 8px 12px; background: #f8f9fa; } .error { display: none; color: #dc3545; font-size: 12px; margin-top: 5px; } #submitBtn { width: 100%; padding: 15px; background: linear-gradient(135deg, #007BFF, #0056b3); color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 500; cursor: pointer; transition: all 0.3s ease; margin-top: 10px; } #submitBtn:hover:not(:disabled) { background: linear-gradient(135deg, #0056b3, #004085); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3); } #submitBtn:disabled { background: #6c757d; cursor: not-allowed; transform: none; box-shadow: none; } .progress-container { margin-top: 20px; text-align: center; } #progressBar { width: 100%; height: 20px; border-radius: 10px; margin-bottom: 10px; } #progressText { font-weight: 500; color: #007BFF; } .debug-window { background: rgba(0, 0, 0, 0.9); color: #00ff00; padding: 20px; border-radius: 12px; max-width: 600px; width: 100%; max-height: 300px; overflow-y: auto; font-family: 'Courier New', monospace; font-size: 12px; line-height: 1.4; display: none; } .debug-window.active { display: block; } .debug-window h3 { color: #ffffff; margin-top: 0; margin-bottom: 15px; text-align: center; } .debug-log { white-space: pre-wrap; word-wrap: break-word; } .timestamp { color: #ffff00; } .status-info { color: #00ffff; } .status-success { color: #00ff00; } .status-error { color: #ff0000; } </style> </head> <body> <div class="container"> <div class="form-container"> <h1>Wczytaj plik kanałów oraz studni/studni witualnych jako shapefile spakowany do .ZIP</h1> <div class="form-group"> <label for="k_przewod_fc">(K) Przewód <i>Shapefile (ZIP)</i>:</label> <input type="file" id="k_przewod_fc" name="k_przewod_fc" accept=".zip" required> <span class="error" id="kPrzewodError">Please select a ZIP file</span> </div> <div class="form-group"> <label for="studnia_fc">(K) Studnia <i>Shapefile (ZIP)</i>:</label> <input type="file" id="studnia_fc" name="studnia_fc" accept=".zip" required> <span class="error" id="studniaError">Please select a ZIP file</span> </div> <div class="form-group"> <label for="nrw_ids">NRW IDs (np.: 302257218, 302258005, (...)):</label> <input type="text" id="nrw_ids" name="nrw_ids" pattern="\d+(,\s*\d+)*" placeholder="302257218, 302258005, ..." required> <span class="error" id="nrwIdsError">Invalid NRW IDs format</span> </div> <button type="button" id="submitBtn">Uruchom</button> <div class="progress-container"> <progress id="progressBar" value="0" max="100"></progress> <span id="progressText">0%</span> </div> </div> <div class="debug-window" id="debugWindow"> <h3>🔍 Debug Console</h3> <div class="debug-log" id="debugLog"></div> </div> </div> <script> document.addEventListener('DOMContentLoaded', () => { const submitBtn = document.getElementById('submitBtn'); const progressBar = document.getElementById('progressBar'); const progressText = document.getElementById('progressText'); const debugWindow = document.getElementById('debugWindow'); const debugLog = document.getElementById('debugLog'); let progressInterval; // Debug logging function function addDebugLog(message, type = 'info') { const timestamp = new Date().toLocaleTimeString(); const logEntry = document.createElement('div'); let className = 'status-info'; let icon = 'ℹ️'; switch(type) { case 'success': className = 'status-success'; icon = '✅'; break; case 'error': className = 'status-error'; icon = '❌'; break; case 'warning': className = 'status-warning'; icon = '⚠️'; break; } logEntry.innerHTML = `<span class="timestamp">[${timestamp}]</span> <span class="${className}">${icon} ${message}</span>`; debugLog.appendChild(logEntry); debugLog.scrollTop = debugLog.scrollHeight; } // Enable/disable button based on form state function validateForm() { const kPrzewodFile = document.getElementById('k_przewod_fc').files[0]; const studniaFile = document.getElementById('studnia_fc').files[0]; const nrwIdsInput = document.getElementById('nrw_ids'); const isValid = ( kPrzewodFile && studniaFile && nrwIdsInput.value.trim() !== '' ); submitBtn.disabled = !isValid; if (isValid) { addDebugLog('Form validation passed - ready to submit', 'success'); } } // Set up event listeners for form changes document.getElementById('k_przewod_fc').addEventListener('change', (e) => { if (e.target.files[0]) { addDebugLog(`K Przewód file selected: ${e.target.files[0].name}`, 'success'); } validateForm(); }); document.getElementById('studnia_fc').addEventListener('change', (e) => { if (e.target.files[0]) { addDebugLog(`Studnia file selected: ${e.target.files[0].name}`, 'success'); } validateForm(); }); document.getElementById('nrw_ids').addEventListener('input', (e) => { if (e.target.value.trim()) { addDebugLog(`NRW IDs entered: ${e.target.value}`, 'success'); } validateForm(); }); // Initial setup addDebugLog('Application initialized - waiting for user input'); validateForm(); // Process button click submitBtn.addEventListener('click', async (e) => { e.preventDefault(); // Show debug window debugWindow.classList.add('active'); addDebugLog('Processing started - button clicked', 'success'); // Disable button during processing submitBtn.disabled = true; progressBar.value = 0; progressText.textContent = '0%'; // Create FormData const formData = new FormData(); formData.append('k_przewod_fc', document.getElementById('k_przewod_fc').files[0]); formData.append('studnia_fc', document.getElementById('studnia_fc').files[0]); formData.append('nrw_ids', document.getElementById('nrw_ids').value); addDebugLog('FormData prepared, sending to server...'); try { addDebugLog('Sending POST request to /process_files/'); // Start processing const response = await fetch("/process_files/", { method: "POST", body: formData, }); addDebugLog(`Server response received: ${response.status}`, response.ok ? 'success' : 'error'); if (!response.ok) { const error = await response.json(); throw new Error(error.error || 'Processing failed'); } const result = await response.json(); addDebugLog(`Processing initiated: ${result.message}`, 'success'); // Start progress polling addDebugLog('Starting progress monitoring...'); progressInterval = setInterval(async () => { try { const res = await fetch("/progress/"); const data = await res.json(); progressBar.value = data.progress; progressText.textContent = `${data.progress}%`; if (data.progress > 0) { addDebugLog(`Progress update: ${data.progress}%`); } if (data.progress >= 100) { clearInterval(progressInterval); addDebugLog('Processing completed successfully!', 'success'); // Get result file path addDebugLog('Retrieving result file path...'); const pathRes = await fetch("/get_result_path/"); const pathData = await pathRes.json(); if (pathData.path) { addDebugLog(`Result file ready: ${pathData.path}`, 'success'); // Trigger download after short delay setTimeout(() => { addDebugLog('Initiating file download...', 'success'); window.location.href = "/download/"; submitBtn.disabled = false; addDebugLog('Process completed - ready for new submission', 'success'); }, 1000); } else { addDebugLog('Result file path not found', 'error'); alert("Processing complete but file not found"); submitBtn.disabled = false; } } } catch (err) { addDebugLog(`Progress polling error: ${err.message}`, 'error'); clearInterval(progressInterval); alert('Error checking progress: ' + err.message); submitBtn.disabled = false; } }, 1000); } catch (error) { addDebugLog(`Processing error: ${error.message}`, 'error'); alert('Error: ' + error.message); submitBtn.disabled = false; } }); }); </script> </body> </html>Key improvements made:
-
Centered Layout: Added a container with flexbox to center everything vertically and horizontally
-
Better Styling:
- Modern glassmorphism effect with backdrop blur
- Improved input field styling with focus states
- Gradient button with hover effects
- Better typography and spacing
-
Debug Window:
- Real-time logging of all background processes
- Color-coded messages (info, success, error, warning)
- Timestamps for each log entry
- Auto-scroll to latest messages
- Shows when files are selected, validation passes, server requests, progress updates, etc.
-
Enhanced UX:
- Placeholder text for NRW IDs input
- Visual feedback for all user interactions
- Smooth transitions and animations
- Better visual hierarchy
The debug window will automatically appear when processing starts and will show detailed information about what's happening in the background, making it easier to troubleshoot any issues.
-
- User
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');
body { width: 100vw; height: 100vh; font-family: 'Roboto', sans-serif; margin: 0; background-image: url('/static/bg.png'); background-repeat: no-repeat; background-size: cover; background-position: center; overflow: hidden; }
/* Optional: keep a little padding if needed */ .container { padding: 40px; }
h1 { color: #333; }
form { background: rgba(255, 255, 255, 0.95); /* Slight transparency for a modern look */ padding: 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); max-width: 500px; margin: 40px auto; }
form input, form button { display: block; width: 100%; padding: 12px; margin: 10px 0; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; transition: border-color 0.3s, box-shadow 0.3s; }
/* Enhanced focus state for inputs */ form input:focus { outline: none; border-color: #007BFF; box-shadow: 0 0 4px rgba(0, 123, 255, 0.3); }
form button { background-color: #007BFF; color: white; border: none; cursor: pointer; font-size: 16px; transition: background-color 0.3s; }
form button:hover { background-color: #0056b3; } .container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.form-container { background: rgba(255, 255, 255, 0.95); padding: 30px; border-radius: 12px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px); max-width: 600px; width: 100%; margin-bottom: 20px; }
h1 { text-align: center; color: #333; margin-bottom: 30px; font-size: 24px; line-height: 1.4; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #555; font-size: 14px; }
.form-group input { width: 100%; padding: 12px 16px; border: 2px solid #e1e5e9; border-radius: 8px; font-size: 16px; transition: all 0.3s ease; box-sizing: border-box; }
.form-group input:focus { outline: none; border-color: #007BFF; box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1); }
.form-group input[type="file"] { padding: 8px 12px; background: #f8f9fa; }
.error { display: none; color: #dc3545; font-size: 12px; margin-top: 5px; }
#submitBtn { width: 100%; padding: 15px; background: linear-gradient(135deg, #007BFF, #0056b3); color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 500; cursor: pointer; transition: all 0.3s ease; margin-top: 10px; }
#submitBtn:hover:not(:disabled) { background: linear-gradient(135deg, #0056b3, #004085); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3); }
#submitBtn:disabled { background: #6c757d; cursor: not-allowed; transform: none; box-shadow: none; }
.progress-container { margin-top: 20px; text-align: center; } #progressBar { width: 100%; height: 20px; border-radius: 10px; margin-bottom: 10px; } #progressText { font-weight: 500; color: #007BFF; } .debug-window { background: rgba(0, 0, 0, 0.9); color: #00ff00; padding: 20px; border-radius: 12px; max-width: 600px; width: 100%; max-height: 300px; overflow-y: auto; font-family: 'Courier New', monospace; font-size: 12px; line-height: 1.4; display: none; } .debug-window.active { display: block; } .debug-window h3 { color: #ffffff; margin-top: 0; margin-bottom: 15px; text-align: center; } .debug-log { white-space: pre-wrap; word-wrap: break-word; } .timestamp { color: #ffff00; } .status-info { color: #00ffff; } .status-success { color: #00ff00; } .status-error { color: #ff0000; } make debig console shown on right side of main widnws - as column 20% vw - Assistant
Here's the updated CSS to display the debug console on the right side as a 20% viewport width column:
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap'); body { width: 100vw; height: 100vh; font-family: 'Roboto', sans-serif; margin: 0; background-image: url('/static/bg.png'); background-repeat: no-repeat; background-size: cover; background-position: center; overflow: hidden; } .container { display: flex; flex-direction: row; /* Changed to row for side-by-side layout */ align-items: flex-start; justify-content: center; min-height: 100vh; padding: 20px; gap: 20px; /* Add gap between main content and debug window */ } .main-content { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; /* Take remaining space */ max-width: 600px; } .form-container { background: rgba(255, 255, 255, 0.95); padding: 30px; border-radius: 12px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px); width: 100%; margin-bottom: 20px; } h1 { text-align: center; color: #333; margin-bottom: 30px; font-size: 24px; line-height: 1.4; } .form-group { margin-bottom: 20px; } .form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #555; font-size: 14px; } .form-group input { width: 100%; padding: 12px 16px; border: 2px solid #e1e5e9; border-radius: 8px; font-size: 16px; transition: all 0.3s ease; box-sizing: border-box; } .form-group input:focus { outline: none; border-color: #007BFF; box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1); } .form-group input[type="file"] { padding: 8px 12px; background: #f8f9fa; } .error { display: none; color: #dc3545; font-size: 12px; margin-top: 5px; } #submitBtn { width: 100%; padding: 15px; background: linear-gradient(135deg, #007BFF, #0056b3); color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 500; cursor: pointer; transition: all 0.3s ease; margin-top: 10px; } #submitBtn:hover:not(:disabled) { background: linear-gradient(135deg, #0056b3, #004085); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3); } #submitBtn:disabled { background: #6c757d; cursor: not-allowed; transform: none; box-shadow: none; } .progress-container { margin-top: 20px; text-align: center; } #progressBar { width: 100%; height: 20px; border-radius: 10px; margin-bottom: 10px; } #progressText { font-weight: 500; color: #007BFF; } .debug-window { background: rgba(0, 0, 0, 0.9); color: #00ff00; padding: 20px; border-radius: 12px; width: 20vw; /* Fixed 20% viewport width */ height: calc(100vh - 40px); /* Full height minus padding */ overflow-y: auto; font-family: 'Courier New', monospace; font-size: 12px; line-height: 1.4; display: block; /* Always visible now */ position: sticky; top: 20px; flex-shrink: 0; /* Prevent shrinking */ } .debug-window h3 { color: #ffffff; margin-top: 0; margin-bottom: 15px; text-align: center; font-size: 14px; } .debug-log { white-space: pre-wrap; word-wrap: break-word; } .timestamp { color: #ffff00; } .status-info { color: #00ffff; } .status-success { color: #00ff00; } .status-error { color: #ff0000; } /* Responsive design for smaller screens */ @media (max-width: 1024px) { .container { flex-direction: column; } .debug-window { width: 100%; height: 300px; position: relative; top: auto; } .main-content { max-width: 100%; } }And update the HTML structure to match:
<div class="container"> <div class="main-content"> <div class="form-container"> <h1>Wczytaj plik kanałów oraz studni/studni witualnych jako shapefile spakowany do .ZIP</h1> <div class="form-group"> <label for="k_przewod_fc">(K) Przewód <i>Shapefile (ZIP)</i>:</label> <input type="file" id="k_przewod_fc" name="k_przewod_fc" accept=".zip" required> <span class="error" id="kPrzewodError">Please select a ZIP file</span> </div> <div class="form-group"> <label for="studnia_fc">(K) Studnia <i>Shapefile (ZIP)</i>:</label> <input type="file" id="studnia_fc" name="studnia_fc" accept=".zip" required> <span class="error" id="studniaError">Please select a ZIP file</span> </div> <div class="form-group"> <label for="nrw_ids">NRW IDs (np.: 302257218, 302258005, (...)):</label> <input type="text" id="nrw_ids" name="nrw_ids" pattern="\d+(,\s*\d+)*" placeholder="302257218, 302258005, ..." required> <span class="error" id="nrwIdsError">Invalid NRW IDs format</span> </div> <button type="button" id="submitBtn">Uruchom</button> <div class="progress-container"> <progress id="progressBar" value="0" max="100"></progress> <span id="progressText">0%</span> </div> </div> </div> <div class="debug-window" id="debugWindow"> <h3>🔍 Debug Console</h3> <div class="debug-log" id="debugLog"></div> </div> </div>Key changes made:
- Layout Structure: Changed container to
flex-direction: rowfor side-by-side layout - Main Content: Wrapped the form in a
main-contentdiv that takes the remaining space - Debug Window:
- Fixed width to
20vw(20% of viewport width) - Full height with
calc(100vh - 40px) - Always visible (removed the
.activeclass requirement) - Sticky positioning to stay in place when scrolling
- Fixed width to
- Responsive Design: Added media query for smaller screens to stack vertically
- Gap: Added spacing between the main content and debug console
The debug console will now appear as a permanent sidebar on the right side, taking up exactly 20% of the viewport width, while the main form content takes up the remaining space in the center.
- Layout Structure: Changed container to
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.