Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction/subvolume_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/user_interaction/subvolume_config.py')
-rw-r--r--archinstall/lib/user_interaction/subvolume_config.py32
1 files changed, 14 insertions, 18 deletions
diff --git a/archinstall/lib/user_interaction/subvolume_config.py b/archinstall/lib/user_interaction/subvolume_config.py
index e2797bba..94150dee 100644
--- a/archinstall/lib/user_interaction/subvolume_config.py
+++ b/archinstall/lib/user_interaction/subvolume_config.py
@@ -12,13 +12,13 @@ if TYPE_CHECKING:
class SubvolumeList(ListManager):
- def __init__(self, prompt: str, current_volumes: List[Subvolume]):
+ def __init__(self, prompt: str, subvolumes: List[Subvolume]):
self._actions = [
str(_('Add subvolume')),
str(_('Edit subvolume')),
str(_('Delete subvolume'))
]
- super().__init__(prompt, current_volumes, self._actions, self._actions[0])
+ super().__init__(prompt, subvolumes, [self._actions[0]], self._actions[1:])
def reformat(self, data: List[Subvolume]) -> Dict[str, Optional[Subvolume]]:
table = FormattedOutput.as_table(data)
@@ -75,13 +75,8 @@ class SubvolumeList(ListManager):
return subvolume
- def exec_action(self, data: List[Subvolume]) -> List[Subvolume]:
- if self.target:
- active_subvolume = self.target
- else:
- active_subvolume = None
-
- if self.action == self._actions[0]: # add
+ def handle_action(self, action: str, entry: Optional[Subvolume], data: List[Subvolume]) -> List[Subvolume]:
+ if action == self._actions[0]: # add
new_subvolume = self._add_subvolume()
if new_subvolume is not None:
@@ -89,14 +84,15 @@ class SubvolumeList(ListManager):
# was created we'll replace the existing one
data = [d for d in data if d.name != new_subvolume.name]
data += [new_subvolume]
- elif self.action == self._actions[1]: # edit subvolume
- new_subvolume = self._add_subvolume(active_subvolume)
-
- if new_subvolume is not None:
- # we'll remove the original subvolume and add the modified version
- data = [d for d in data if d.name != active_subvolume.name and d.name != new_subvolume.name]
- data += [new_subvolume]
- elif self.action == self._actions[2]: # delete
- data = [d for d in data if d != active_subvolume]
+ elif entry is not None:
+ if action == self._actions[1]: # edit subvolume
+ new_subvolume = self._add_subvolume(entry)
+
+ if new_subvolume is not None:
+ # we'll remove the original subvolume and add the modified version
+ data = [d for d in data if d.name != entry.name and d.name != new_subvolume.name]
+ data += [new_subvolume]
+ elif action == self._actions[2]: # delete
+ data = [d for d in data if d != entry]
return data