Skip to content

Commit 08cba23

Browse files
authored
Show install summary when configuration is valid (#4475)
* Show install summary when configuration is valid Previously the Install menu preview was empty when everything was valid, leaving the user with no "ready" signal. Now show "Ready to install" plus a two-column summary of the current configuration. - New _install_summary() composes an aligned key/value table with rows for disks+FS+LUKS, bootloader, kernel, profile, greeter, package count, network, locale and timezone. Column width adapts to the longest translated label so translations keep the alignment. - Rows whose underlying config is not set are skipped rather than rendered as empty. - base.pot / uk base.po: add new msgids for summary labels. * Move install summary into ConfigurationOutput The summary helper that renders the install preview's two-column configuration overview lived in GlobalMenu. Move it to ConfigurationOutput.as_summary() so it sits alongside the JSON output methods that share the same role. The preview now syncs menu state to ArchConfig and delegates rendering.
1 parent 8cc35f4 commit 08cba23

4 files changed

Lines changed: 102 additions & 2 deletions

File tree

archinstall/lib/configuration.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from archinstall.lib.crypt import encrypt
1111
from archinstall.lib.menu.helpers import Confirmation, Selection
1212
from archinstall.lib.menu.util import get_password, prompt_dir
13+
from archinstall.lib.models.bootloader import Bootloader
14+
from archinstall.lib.models.network import NetworkConfiguration
1315
from archinstall.lib.output import debug, logger, warn
1416
from archinstall.lib.translationhandler import tr
1517
from archinstall.tui.ui.menu_item import MenuItem, MenuItemGroup
@@ -58,6 +60,70 @@ def write_debug(self) -> None:
5860
debug(' -- Chosen configuration --')
5961
debug(self.user_config_to_json())
6062

63+
def as_summary(self) -> str:
64+
"""
65+
Render a concise two-column summary of the current configuration.
66+
67+
The left column holds section labels, the right column holds values.
68+
Column width adapts to the longest translated label so translations
69+
do not break the alignment. Rows whose underlying config is not set
70+
are skipped.
71+
72+
Returns an empty string if nothing meaningful to show.
73+
"""
74+
rows: list[tuple[str, str]] = []
75+
76+
disk_config = self._config.disk_config
77+
if disk_config and disk_config.device_modifications:
78+
disk_parts: list[str] = []
79+
for mod in disk_config.device_modifications:
80+
path = str(mod.device_path)
81+
root_part = mod.get_root_partition()
82+
flags: list[str] = []
83+
if root_part and root_part.fs_type:
84+
flags.append(root_part.fs_type.value)
85+
if disk_config.disk_encryption:
86+
flags.append(tr('LUKS'))
87+
disk_parts.append(f'{path} ({" + ".join(flags)})' if flags else path)
88+
rows.append((tr('Disks'), ', '.join(disk_parts)))
89+
90+
bl_config = self._config.bootloader_config
91+
if bl_config and bl_config.bootloader != Bootloader.NO_BOOTLOADER:
92+
rows.append((tr('Bootloader'), bl_config.bootloader.value))
93+
94+
kernels = self._config.kernels
95+
if kernels:
96+
rows.append((tr('Kernel'), ', '.join(kernels)))
97+
98+
profile_config = self._config.profile_config
99+
if profile_config and profile_config.profile:
100+
names = profile_config.profile.current_selection_names()
101+
rows.append((tr('Profile'), ', '.join(names) if names else profile_config.profile.name))
102+
if profile_config.greeter:
103+
rows.append((tr('Greeter'), profile_config.greeter.value))
104+
105+
packages = self._config.packages
106+
if packages:
107+
rows.append((tr('Packages'), str(len(packages))))
108+
109+
net_config = self._config.network_config
110+
if isinstance(net_config, NetworkConfiguration):
111+
rows.append((tr('Network'), net_config.type.display_msg()))
112+
113+
locale_config = self._config.locale_config
114+
if locale_config:
115+
rows.append((tr('Locale'), locale_config.sys_lang))
116+
117+
tz = self._config.timezone
118+
if tz:
119+
rows.append((tr('Timezone'), tz))
120+
121+
if not rows:
122+
return ''
123+
124+
label_width = max(len(label) for label, _ in rows) + 2
125+
return '\n'.join(f'{label:<{label_width}}{value}' for label, value in rows)
126+
61127
async def confirm_config(self) -> bool:
62128
header = f'{tr("The specified configuration will be applied")}. '
63129
header += tr('Would you like to continue?') + '\n'

archinstall/lib/global_menu.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from archinstall.lib.authentication.authentication_menu import AuthenticationMenu
77
from archinstall.lib.bootloader.bootloader_menu import BootloaderMenu
88
from archinstall.lib.bootloader.utils import validate_bootloader_layout
9-
from archinstall.lib.configuration import save_config
9+
from archinstall.lib.configuration import ConfigurationOutput, save_config
1010
from archinstall.lib.disk.disk_menu import DiskLayoutConfigurationMenu
1111
from archinstall.lib.general.general_menu import select_hostname, select_ntp, select_timezone
1212
from archinstall.lib.general.system_menu import select_kernel, select_swap
@@ -504,7 +504,11 @@ def _prev_install_invalid_config(self, item: MenuItem) -> str | None:
504504
if error := self._validate_bootloader():
505505
return tr(f'Invalid configuration: {error}')
506506

507-
return None
507+
self.sync_all_to_config()
508+
summary = ConfigurationOutput(self._arch_config).as_summary()
509+
if summary:
510+
return f'{tr("Ready to install")}\n\n{summary}'
511+
return tr('Ready to install')
508512

509513
def _prev_profile(self, item: MenuItem) -> str | None:
510514
profile_config: ProfileConfiguration | None = item.value

archinstall/locales/base.pot

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,21 @@ msgstr ""
12481248
msgid "Invalid configuration: {error}"
12491249
msgstr ""
12501250

1251+
msgid "Ready to install"
1252+
msgstr ""
1253+
1254+
msgid "Disks"
1255+
msgstr ""
1256+
1257+
msgid "Packages"
1258+
msgstr ""
1259+
1260+
msgid "Network"
1261+
msgstr ""
1262+
1263+
msgid "Locale"
1264+
msgstr ""
1265+
12511266
msgid "Type"
12521267
msgstr ""
12531268

archinstall/locales/uk/LC_MESSAGES/base.po

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,21 @@ msgstr "Модель"
12221222
msgid "Invalid configuration: {error}"
12231223
msgstr "Неправильна конфігурація: {error}"
12241224

1225+
msgid "Ready to install"
1226+
msgstr "Готово до встановлення"
1227+
1228+
msgid "Disks"
1229+
msgstr "Диски"
1230+
1231+
msgid "Packages"
1232+
msgstr "Пакети"
1233+
1234+
msgid "Network"
1235+
msgstr "Мережа"
1236+
1237+
msgid "Locale"
1238+
msgstr "Локаль"
1239+
12251240
msgid "Type"
12261241
msgstr "Тип"
12271242

0 commit comments

Comments
 (0)