From bd40d5e4c314d44453b04fa56484186294ab81ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= <78488229+viktor138irk@users.noreply.github.com> Date: Thu, 7 May 2026 20:59:13 +0900 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=BE=D1=80=D0=BC=D0=B0=20=D1=81=D0=BE?= =?UTF-8?q?=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20VM=20=D0=B1=D1=8B=D0=BB?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=87=D0=B8=D1=89=D0=B5=D0=BD=D0=B0=20=D0=BE?= =?UTF-8?q?=D1=82=20=D0=BD=D0=B5=D1=81=D0=BE=D0=B2=D0=BC=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BC=D1=8B=D1=85=20=D1=81=D0=BE=D1=81=D1=82=D0=BE=D1=8F?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/templates/vm_create.html | 40 +++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/web/templates/vm_create.html b/web/templates/vm_create.html index 22ca1b1..28b4da1 100644 --- a/web/templates/vm_create.html +++ b/web/templates/vm_create.html @@ -7,6 +7,8 @@
+ {% set disk_images_available = disk_images is defined and disk_images %} + {% set disk_feature_available = disk_images is defined %}ISO x86: virt-install --arch x86_64 --cdrom ubuntu.iso
@@ -165,18 +176,19 @@ IMG ARM: qemu-img convert -O qcow2 image.img VM.qcow2
const diskWarning = document.getElementById('disk-image-missing-warning');
const createButton = document.getElementById('create-vm-button');
const hasIsos = {{ 'true' if isos else 'false' }};
- const hasDiskImages = {{ 'true' if disk_images else 'false' }};
+ const diskFeatureAvailable = {{ 'true' if disk_feature_available else 'false' }};
+ const hasDiskImages = {{ 'true' if disk_images_available else 'false' }};
function refreshSourceUI() {
- const isDisk = sourceType.value === 'disk_image';
+ const isDisk = diskFeatureAvailable && sourceType.value === 'disk_image';
isoRow.style.display = isDisk ? 'none' : 'grid';
- diskImageRow.style.display = isDisk ? 'grid' : 'none';
+ if (diskImageRow) diskImageRow.style.display = isDisk ? 'grid' : 'none';
sourceImageLabel.textContent = isDisk ? 'Готовый образ диска' : 'ISO образ';
- diskImageLabel.textContent = isDisk ? 'Готовый образ диска' : 'ISO образ';
+ if (diskImageLabel) diskImageLabel.textContent = 'Готовый образ диска';
diskSizeRow.style.opacity = isDisk ? '.45' : '1';
diskSizeRow.querySelector('span').textContent = isDisk ? 'Диск, GB — не используется при импорте' : 'Диск, GB';
sourceModeNotice.textContent = isDisk
- ? 'Выбран источник “Готовый диск”: Virtuality импортирует .img/.raw/.qcow2 в новый qcow2-диск VM. Поле “Диск, GB” не используется. При необходимости можно заменить хвост от неудачной установки прямо в блоке готового диска.'
+ ? 'Выбран источник “Готовый диск”: Virtuality импортирует .img/.raw/.qcow2 в новый qcow2-диск VM. Поле “Диск, GB” не используется.'
: 'Выбран источник “ISO-установщик”: Virtuality создаст новый диск указанного размера и запустит установку с ISO.';
if (isoWarning) isoWarning.style.display = !isDisk && !hasIsos ? 'block' : 'none';
if (diskWarning) diskWarning.style.display = isDisk && !hasDiskImages ? 'block' : 'none';