Private
Public Access
0
0

fix(gui): Improve Approve PowerShell Command modal UX

- Make the approval modal resizable with a larger default size.
- Render 'Show Full Preview' inline to prevent UI lockup issues.
This commit is contained in:
2026-06-02 00:45:30 -04:00
parent ff849e7990
commit 3528d6eb03
2 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -313,5 +313,5 @@ This file tracks all major tracks for the project. Each track has its own detail
---
- [ ] **Track: Fix Approve Modal sizing and inline full preview**
- [~] **Track: Fix Approve Modal sizing and inline full preview**
*Link: [./tracks/approve_modal_ux_20260601/](./tracks/approve_modal_ux_20260601/)*
+10 -6
View File
@@ -4419,20 +4419,24 @@ def render_approve_script_modal(app: App) -> None:
else:
app._pending_dialog_open = False
if imgui.begin_popup_modal("Approve PowerShell Command", None, imgui.WindowFlags_.always_auto_resize)[0]:
imgui.set_next_window_size(imgui.ImVec2(800, 600), imgui.Cond_.first_use_ever)
if imgui.begin_popup_modal("Approve PowerShell Command", None, 0)[0]:
if not dlg: imgui.close_current_popup()
else:
imgui.text("The AI wants to run the following PowerShell script:")
imgui.text_colored(vec4(200, 200, 100), f"base_dir: {dlg._base_dir}")
imgui.separator()
# Checkbox to toggle full preview inside modal
_, app.show_windows["Text Viewer"] = imgui.checkbox("Show Full Preview", app.show_windows.get("Text Viewer", False))
if app.show_windows.get("Text Viewer", False):
imgui.begin_child("preview_child", imgui.ImVec2(600, 300), True)
imgui.text_unformatted(dlg._script)
if not hasattr(app, 'ui_approve_modal_preview'): app.ui_approve_modal_preview = False
_, app.ui_approve_modal_preview = imgui.checkbox("Read-only Full Preview", app.ui_approve_modal_preview)
avail_y = imgui.get_content_region_avail().y - 40 # reserve space for buttons
if app.ui_approve_modal_preview:
imgui.begin_child("preview_child", imgui.ImVec2(-1, avail_y), True)
markdown_helper.render(f"```powershell\n{dlg._script}\n```", context_id="approve_script_preview")
imgui.end_child()
else:
ch, dlg._script = imgui.input_text_multiline("##confirm_script", dlg._script, imgui.ImVec2(-1, 200))
ch, dlg._script = imgui.input_text_multiline("##confirm_script", dlg._script, imgui.ImVec2(-1, avail_y))
imgui.separator()
if imgui.button("Approve & Run", imgui.ImVec2(120, 0)):
with dlg._condition: