Private
Public Access
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:
+1
-1
@@ -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/)*
|
*Link: [./tracks/approve_modal_ux_20260601/](./tracks/approve_modal_ux_20260601/)*
|
||||||
|
|||||||
+10
-6
@@ -4419,20 +4419,24 @@ def render_approve_script_modal(app: App) -> None:
|
|||||||
else:
|
else:
|
||||||
app._pending_dialog_open = False
|
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()
|
if not dlg: imgui.close_current_popup()
|
||||||
else:
|
else:
|
||||||
imgui.text("The AI wants to run the following PowerShell script:")
|
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.text_colored(vec4(200, 200, 100), f"base_dir: {dlg._base_dir}")
|
||||||
imgui.separator()
|
imgui.separator()
|
||||||
# Checkbox to toggle full preview inside modal
|
# 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 not hasattr(app, 'ui_approve_modal_preview'): app.ui_approve_modal_preview = False
|
||||||
if app.show_windows.get("Text Viewer", False):
|
_, app.ui_approve_modal_preview = imgui.checkbox("Read-only Full Preview", app.ui_approve_modal_preview)
|
||||||
imgui.begin_child("preview_child", imgui.ImVec2(600, 300), True)
|
|
||||||
imgui.text_unformatted(dlg._script)
|
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()
|
imgui.end_child()
|
||||||
else:
|
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()
|
imgui.separator()
|
||||||
if imgui.button("Approve & Run", imgui.ImVec2(120, 0)):
|
if imgui.button("Approve & Run", imgui.ImVec2(120, 0)):
|
||||||
with dlg._condition:
|
with dlg._condition:
|
||||||
|
|||||||
Reference in New Issue
Block a user