Root cause: innerHTML does not execute <script> tags in modern browsers. The _analysis.html and polling.html fragments had inline <script> blocks that were silently dropped, causing: - Confirm form's submitJob() undefined → form submitted as normal GET back to '/' (user saw 'New Conversion Session' instead of polling) - Polling page's poll() never started → stuck on 'Waiting for backend...' Fix: - Stripped all <script> tags from _analysis.html and polling.html - Moved all JS logic into index.html (executed on page load) - initConfirmForm() attaches submit/change listeners after analysis HTML is injected via innerHTML - initPolling() attaches poll timer + reuse button handlers after polling fragment is injected - Polling fragment replaces step1/analysis content while keeping base.html header/footer intact - Reuse buttons now use onclick attached via JS (not inline)
78 lines
2.8 KiB
HTML
78 lines
2.8 KiB
HTML
{# Fragment — no <script> tags (injected via innerHTML) #}
|
|
|
|
{% if error %}
|
|
<div class="panel error-panel" id="analysis-result">
|
|
<h2>Analysis Failed</h2>
|
|
<div class="error">{{ error }}</div>
|
|
<a href="/" class="btn">Try Again</a>
|
|
</div>
|
|
{% else %}
|
|
<div class="panel" id="step2">
|
|
<h2>Analysis Result</h2>
|
|
|
|
<table>
|
|
<tr><td>File</td><td>{{ analysis.filename }}</td></tr>
|
|
<tr><td>Disk Format</td><td>{{ analysis.disk_format }}</td></tr>
|
|
<tr><td>Disk Size</td><td>{{ analysis.disk_size_gb }} GB</td></tr>
|
|
<tr><td>Operating System</td><td>{{ analysis.os_type or 'Unknown' }}</td></tr>
|
|
<tr><td>EFI Bootable</td><td>{{ 'Yes' if analysis.efi_detectable else 'Unknown' }}</td></tr>
|
|
</table>
|
|
|
|
<p class="confirm-text">Is this correct? Configure the VM below and submit the conversion job.</p>
|
|
|
|
<form id="confirm-form" data-vmid="{{ vmid }}" data-source-filename="{{ source_filename }}">
|
|
<input type="hidden" name="vmid" value="{{ vmid }}">
|
|
<input type="hidden" name="source_filename" value="{{ source_filename }}">
|
|
<input type="hidden" name="disk_format" value="{{ analysis.disk_format }}">
|
|
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label>VM Name *</label>
|
|
<input type="text" name="vm_name" required value="{{ vm_name or '' }}"
|
|
placeholder="my-converted-vm">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Target Disk Size (GB)</label>
|
|
<input type="number" name="target_disk_size_gb"
|
|
value="{{ analysis.disk_size_gb }}"
|
|
placeholder="Leave blank for auto-shrink">
|
|
<span class="hint">{{ analysis.disk_size_gb }} GB detected. Omit to auto-shrink to 30 GB.</span>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label>CPU Cores</label>
|
|
<input type="number" name="cpu_cores" value="2" min="1">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>RAM (MB)</label>
|
|
<input type="number" name="ram_mb" value="4096" min="512">
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label>Storage Pool</label>
|
|
<input type="text" name="target_storage" value="local-lvm">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Boot Detection</label>
|
|
<select name="auto_detect_boot">
|
|
<option value="true" selected>Auto-detect (recommended)</option>
|
|
<option value="false">Manual</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group" id="boot-type-group" style="display:none;">
|
|
<label>Boot Type</label>
|
|
<select name="boot_type">
|
|
<option value="uefi">UEFI</option>
|
|
<option value="legacy">Legacy BIOS</option>
|
|
</select>
|
|
</div>
|
|
|
|
<button type="submit" id="submit-btn">Start Conversion</button>
|
|
</form>
|
|
|
|
<div id="submit-status" class="hidden" style="margin-top:1rem;"></div>
|
|
</div>
|
|
{% endif %}
|