<!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
Certainly! Below is the updated HTML with improved styling, centering the table and inputs, and adding a debug window to show what's happening in the background while 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> body { font-family: 'Cabin Condensed', sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; margin: 0; background-color: #f4f4f4; } h1 { text-align: center; color: #333; } .form-container { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); max-width: 500px; width: 100%; margin: 20px auto; text-align: center; } .form-group { margin-bottom: 15px; text-align: left; } .form-group label { display: block; margin-bottom: 5px; font-weight: 500; } .form-group input { width: calc(100% - 20px); padding: 10px; margin: 0 10px; border: 1px solid #ccc; border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } .form-group .error { color: red; display: none; } button { background-color: #007BFF; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: 500; display: block; margin: 20px auto; } button:hover { background-color: #0056b3; } .progress-container { display: flex; align-items: center; justify-content: center; margin-top: 10px; } progress { width: calc(100% - 50px); } #progressText { margin-left: 10px; } #debugWindow { background: #fff; border: 1px solid #ccc; border-radius: 8px; padding: 10px; margin-top: 20px; max-width: 500px; width: 100%; display: none; } #debugWindow pre { margin: 0; white-space: pre-wrap; word-wrap: break-word; } </style> </head> <body> <h1>Wczytaj plik kanałów oraz studni/studni witualnych jako shapefile spakowany do .ZIP</h1> <div class="form-container"> <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> <div id="debugWindow"> <h3>Debug Information</h3> <pre id="debugInfo"></pre> </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 debugInfo = document.getElementById('debugInfo'); let progressInterval; function updateDebugInfo(message) { debugInfo.textContent += message + '\n'; debugWindow.style.display = 'block'; } // 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 { updateDebugInfo("Sending request to /process_files/"); // Start processing const response = await fetch("/process_files/", { method: "POST", body: formData, }); updateDebugInfo("Received response: " + response.status); if (!response.ok) { const error = await response.json(); throw new Error(error.error || 'Processing failed'); } const result = await response.json(); updateDebugInfo("Processing started: " + result.message); // Start progress polling progressInterval = setInterval(async () => { try { updateDebugInfo("Checking progress..."); const res = await fetch("/progress/"); const data = await res.json(); updateDebugInfo(`Current progress: ${data.progress}%`); progressBar.value = data.progress; progressText.textContent = `${data.progress}%`; if (data.progress >= 100) { clearInterval(progressInterval); updateDebugInfo("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(() => { - 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
Certainly! Below is the updated CSS to position the debug console on the right side of the main window, taking up 20% of the viewport width. The main content will take up the remaining 80% of the width.
@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; display: flex; } .main-content { flex: 4; /* 80% of the viewport width */ display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; } .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 { flex: 1; /* 20% of the viewport width */ background: rgba(0, 0, 0, 0.9); color: #00ff00; padding: 20px; border-radius: 12px; max-width: 300px; width: 100%; max-height: 100vh; 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; }In your HTML, you can structure it like this:
<!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"> </head> <body> <div class="main-content"> <h1>Wczytaj plik kanałów oraz studni/studni witualnych jako shapefile spakowany do .ZIP</h1> <div class="form-container"> <!-- Your form elements here --> </div> </div> <div class="debug-window" id="debugWindow"> <h3>Debug Information</h3> <div class="debug-log" id="debugLog"></div> </div> </body> </html>This will create a layout where the main content takes up 80% of the width and the debug window takes up the remaining 20%.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.