Warn when network selection was skipped instead of making it mandatory
Replace the mandatory network_config menu requirement with a yellow warning on the final confirmation screen, shown only when the user skipped the network menu entirely. Explicitly picking "No network configuration" is treated as a conscious choice and does not trigger the warning. - Drop mandatory=True from the network_config global menu item - Rename NicType.NONE menu label from "No network" to "No network configuration" (an installed system still has an NIC; only the install-time configuration is absent) - Add ConfigurationOutput.get_install_warnings() and render them in confirm_config when show_install_warnings=True - guided.py and minimal.py enable the warning on the confirm screen - Reuse the existing "No network configuration" msgid in .pot; add the warning string; update Ukrainian translations accordingly
This commit is contained in:
parent
ccc378be56
commit
3b275a7f95
|
|
@ -10,6 +10,7 @@ from archinstall.lib.args import ArchConfig
|
|||
from archinstall.lib.crypt import encrypt
|
||||
from archinstall.lib.menu.helpers import Confirmation, Selection
|
||||
from archinstall.lib.menu.util import get_password, prompt_dir
|
||||
from archinstall.lib.models.network import NetworkConfiguration
|
||||
from archinstall.lib.output import debug, logger, warn
|
||||
from archinstall.lib.translationhandler import tr
|
||||
from archinstall.tui.ui.menu_item import MenuItem, MenuItemGroup
|
||||
|
|
@ -58,10 +59,13 @@ class ConfigurationOutput:
|
|||
debug(' -- Chosen configuration --')
|
||||
debug(self.user_config_to_json())
|
||||
|
||||
async def confirm_config(self) -> bool:
|
||||
async def confirm_config(self, show_install_warnings: bool = False) -> bool:
|
||||
header = f'{tr("The specified configuration will be applied")}. '
|
||||
header += tr('Would you like to continue?') + '\n'
|
||||
|
||||
if show_install_warnings:
|
||||
header += self._render_install_warnings()
|
||||
|
||||
group = MenuItemGroup.yes_no()
|
||||
group.set_preview_for_all(lambda x: self.user_config_to_json())
|
||||
|
||||
|
|
@ -79,6 +83,22 @@ class ConfigurationOutput:
|
|||
|
||||
return True
|
||||
|
||||
def get_install_warnings(self) -> list[str]:
|
||||
warnings: list[str] = []
|
||||
|
||||
if not isinstance(self._config.network_config, NetworkConfiguration):
|
||||
warnings.append(tr('Warning: no network configuration selected. Network will need to be set up manually on the installed system.'))
|
||||
|
||||
return warnings
|
||||
|
||||
def _render_install_warnings(self) -> str:
|
||||
warnings = self.get_install_warnings()
|
||||
|
||||
if not warnings:
|
||||
return ''
|
||||
|
||||
return '\n' + '\n'.join(f'[yellow]{w}[/]' for w in warnings) + '\n'
|
||||
|
||||
def _is_valid_path(self, dest_path: Path) -> bool:
|
||||
dest_path_ok = dest_path.exists() and dest_path.is_dir()
|
||||
if not dest_path_ok:
|
||||
|
|
|
|||
|
|
@ -139,7 +139,6 @@ class GlobalMenu(AbstractMenu[None]):
|
|||
action=select_network,
|
||||
value={},
|
||||
preview_action=self._prev_network_config,
|
||||
mandatory=True,
|
||||
key='network_config',
|
||||
),
|
||||
MenuItem(
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class NicType(Enum):
|
|||
case NicType.MANUAL:
|
||||
return tr('Manual configuration')
|
||||
case NicType.NONE:
|
||||
return tr('No network')
|
||||
return tr('No network configuration')
|
||||
|
||||
|
||||
class _NicSerialization(TypedDict):
|
||||
|
|
|
|||
|
|
@ -633,9 +633,6 @@ msgstr ""
|
|||
msgid "Manual configuration"
|
||||
msgstr ""
|
||||
|
||||
msgid "No network"
|
||||
msgstr ""
|
||||
|
||||
msgid "Mark/Unmark a partition as compressed (btrfs only)"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -2180,6 +2177,11 @@ msgstr ""
|
|||
msgid "Recommended: Network Manager for desktop, Manual for server"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Warning: no network configuration selected. Network will need to be set up "
|
||||
"manually on the installed system."
|
||||
msgstr ""
|
||||
|
||||
msgid "No packages found"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ msgid "Define users with sudo privilege: "
|
|||
msgstr "Визначте користувачів із привілеєм sudo: "
|
||||
|
||||
msgid "No network configuration"
|
||||
msgstr "Відсутня конфігурація мережі"
|
||||
msgstr "Без налаштування мережі"
|
||||
|
||||
msgid "Set desired subvolumes on a btrfs partition"
|
||||
msgstr "Встановіть потрібні підтома на розділі btrfs"
|
||||
|
|
@ -646,9 +646,6 @@ msgstr "Оберіть інтерфейс для додавання"
|
|||
msgid "Manual configuration"
|
||||
msgstr "Ручне налаштування"
|
||||
|
||||
msgid "No network"
|
||||
msgstr "Без мережі"
|
||||
|
||||
msgid "Mark/Unmark a partition as compressed (btrfs only)"
|
||||
msgstr "Позначити/зняти позначку розділу як стисненого (лише btrfs)"
|
||||
|
||||
|
|
@ -2121,6 +2118,9 @@ msgstr "Оберіть конфігурацію мережі"
|
|||
msgid "Recommended: Network Manager for desktop, Manual for server"
|
||||
msgstr "Рекомендовано: Network Manager для робочого столу, ручне налаштування для сервера"
|
||||
|
||||
msgid "Warning: no network configuration selected. Network will need to be set up manually on the installed system."
|
||||
msgstr "Попередження: конфігурацію мережі не обрано. Мережу доведеться налаштувати вручну на встановленій системі."
|
||||
|
||||
msgid "No packages found"
|
||||
msgstr "Пакети не знайдено"
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ def main(arch_config_handler: ArchConfigHandler | None = None) -> None:
|
|||
|
||||
if not arch_config_handler.args.silent:
|
||||
aborted = False
|
||||
res: bool = tui.run(config.confirm_config)
|
||||
res: bool = tui.run(lambda: config.confirm_config(show_install_warnings=True))
|
||||
|
||||
if not res:
|
||||
debug('Installation aborted')
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ async def main(arch_config_handler: ArchConfigHandler | None = None) -> None:
|
|||
|
||||
if not arch_config_handler.args.silent:
|
||||
aborted = False
|
||||
res: bool = tui.run(config.confirm_config)
|
||||
res: bool = tui.run(lambda: config.confirm_config(show_install_warnings=True))
|
||||
|
||||
if not res:
|
||||
debug('Installation aborted')
|
||||
|
|
|
|||
Loading…
Reference in New Issue