Skip to content

Commit e3d9457

Browse files
Dirk Petersenclaude
andcommitted
fix: show confirmation modal over tier selection and exclude current tier
Improved tier change UX with proper modal behavior and prevented selecting the same tier as migration target. Changes: - Confirmation modal now appears as overlay on tier selection screen (not as separate app with dark background) - Removed TableStorageTierConfirmApp wrapper class (no longer needed) - Modified TableStorageTierSelector to use push_screen() for modal - Added handle_confirmation() to allow users to cancel and reselect - Excluded current tier from available migration targets User experience improvements: - Modal appears over existing screen (proper modal behavior) - Can cancel and select different tier without restarting - Cannot accidentally select same tier as migration target - Cleaner, more intuitive workflow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 289f62f commit e3d9457

File tree

1 file changed

+22
-43
lines changed

1 file changed

+22
-43
lines changed

froster/froster.py

Lines changed: 22 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6124,33 +6124,6 @@ def on_button_pressed(self, event: Button.Pressed) -> None:
61246124
self.dismiss(result=event.button.id == "yes")
61256125

61266126

6127-
class TableStorageTierConfirmApp(App[bool]):
6128-
"""Wrapper app to show the confirmation modal"""
6129-
6130-
def __init__(self, folder, current_tier, new_tier, object_count, total_size_gib):
6131-
super().__init__()
6132-
self.folder = folder
6133-
self.current_tier = current_tier
6134-
self.new_tier = new_tier
6135-
self.object_count = object_count
6136-
self.total_size_gib = total_size_gib
6137-
6138-
def on_mount(self) -> None:
6139-
self.push_screen(
6140-
ScreenConfirmTierChange(
6141-
self.folder,
6142-
self.current_tier,
6143-
self.new_tier,
6144-
self.object_count,
6145-
self.total_size_gib
6146-
),
6147-
self.handle_result
6148-
)
6149-
6150-
def handle_result(self, result: bool) -> None:
6151-
self.exit(result)
6152-
6153-
61546127
class TableStorageTierSelector(App[str]):
61556128
"""Interactive TUI for selecting AWS S3 storage tier with cost information"""
61566129

@@ -6252,6 +6225,10 @@ def on_mount(self) -> None:
62526225
table.add_columns("Tier", "Storage Cost", "Retrieval Time", "Retrieval Cost", "Description")
62536226

62546227
for tier_key, tier_info in self.STORAGE_TIERS.items():
6228+
# Skip the current tier - no need to migrate to same tier
6229+
if tier_key == self.current_tier:
6230+
continue
6231+
62556232
table.add_row(
62566233
tier_info['name'],
62576234
tier_info['storage_cost'],
@@ -6263,7 +6240,24 @@ def on_mount(self) -> None:
62636240

62646241
def on_data_table_row_selected(self, event: DataTable.RowSelected) -> None:
62656242
self.selected_tier = event.row_key.value
6266-
self.exit(self.selected_tier)
6243+
# Show confirmation modal
6244+
self.push_screen(
6245+
ScreenConfirmTierChange(
6246+
self.folder_path,
6247+
self.current_tier,
6248+
self.selected_tier,
6249+
self.object_count,
6250+
self.total_size_gib
6251+
),
6252+
self.handle_confirmation
6253+
)
6254+
6255+
def handle_confirmation(self, confirmed: bool) -> None:
6256+
if confirmed:
6257+
self.exit(self.selected_tier)
6258+
else:
6259+
self.selected_tier = None
6260+
# User can continue selecting another tier
62676261

62686262
def on_button_pressed(self, event: Button.Pressed) -> None:
62696263
if event.button.id == "cancel":
@@ -7462,21 +7456,6 @@ def _change_storage_tier(self, arch: Archiver, aws: AWSBoto, folders):
74627456
log('\nStorage tier change cancelled\n')
74637457
return False
74647458

7465-
# Show confirmation modal
7466-
confirm_app = TableStorageTierConfirmApp(
7467-
folder=folder,
7468-
current_tier=current_tier,
7469-
new_tier=new_tier,
7470-
object_count=object_count,
7471-
total_size_gib=total_size / (1024**3)
7472-
)
7473-
7474-
confirmed = confirm_app.run()
7475-
7476-
if not confirmed:
7477-
log('\nStorage tier change cancelled\n')
7478-
return False
7479-
74807459
# Perform the storage class change
74817460
success, total_objs, changed_objs, skipped_objs, size_bytes = aws.change_storage_class(
74827461
bucket_name=bucket,

0 commit comments

Comments
 (0)