Установщик Windows узнаётся по метке ISO и имени файла: форма создания машины сама выбирает тип Windows, иначе диск был virtio и установщик его не видел
Этот коммит содержится в:
@@ -478,8 +478,24 @@
|
||||
$$('[data-create-button]').forEach((btn) => { btn.disabled = !hasSource || !value('name'); });
|
||||
$$('[data-missing-source]').forEach((el) => { el.hidden = hasSource || el.dataset.missingSource !== source; });
|
||||
}
|
||||
// Установщик Windows панель узнаёт по ISO (data-os) и сама выбирает тип, пока пользователь не выбрал его руками.
|
||||
const guessOs = () => {
|
||||
const select = field('iso_path');
|
||||
const option = select && select.selectedIndex >= 0 ? select.options[select.selectedIndex] : null;
|
||||
const guess = option?.dataset.os || '';
|
||||
const hint = $('[data-os-hint]', form);
|
||||
if (form.dataset.osManual) return;
|
||||
const radio = $(`input[name=os_type][value="${guess || 'linux'}"]`, form);
|
||||
if (radio) radio.checked = true;
|
||||
if (hint) hint.hidden = !guess;
|
||||
};
|
||||
form.addEventListener('input', (event) => { if (event.target.name === 'ci_user') event.target.dataset.autoLogin = event.target.value ? '0' : '1'; sync(); });
|
||||
form.addEventListener('change', sync);
|
||||
form.addEventListener('change', (event) => {
|
||||
if (event.target.name === 'os_type') { form.dataset.osManual = '1'; const hint = $('[data-os-hint]', form); if (hint) hint.hidden = true; }
|
||||
if (event.target.name === 'iso_path') guessOs();
|
||||
sync();
|
||||
});
|
||||
guessOs();
|
||||
sync();
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user