MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / draw_sandbox_screen

Function draw_sandbox_screen

crates/openshell-tui/src/ui/mod.rs:73–120  ·  view source on GitHub ↗
(frame: &mut Frame<'_>, app: &mut App, area: Rect)

Source from the content-addressed store, hash-verified

71// ---------------------------------------------------------------------------
72
73fn draw_sandbox_screen(frame: &mut Frame<'_>, app: &mut App, area: Rect) {
74 let chunks = Layout::default()
75 .direction(Direction::Vertical)
76 .constraints([
77 Constraint::Percentage(20), // metadata
78 Constraint::Percentage(80), // policy or logs
79 ])
80 .split(area);
81
82 sandbox_detail::draw(frame, app, chunks[0]);
83
84 match app.focus {
85 Focus::SandboxLogs => sandbox_logs::draw(frame, app, chunks[1]),
86 Focus::SandboxDraft => sandbox_draft::draw(frame, app, chunks[1]),
87 _ => match app.sandbox_policy_tab {
88 app::SandboxPolicyTab::Settings => sandbox_settings::draw(frame, app, chunks[1]),
89 app::SandboxPolicyTab::Policy => sandbox_policy::draw(frame, app, chunks[1]),
90 },
91 }
92
93 // Log detail popup renders over the full frame (not constrained to pane).
94 if app.focus == Focus::SandboxLogs
95 && let Some(detail_idx) = app.log_detail_index
96 {
97 let filtered: Vec<&app::LogLine> = app.filtered_log_lines();
98 if let Some(log) = filtered.get(detail_idx) {
99 sandbox_logs::draw_detail_popup(frame, log, frame.size(), &app.theme);
100 }
101 }
102
103 // Draft detail popup renders over the full frame.
104 if app.focus == Focus::SandboxDraft && app.draft_detail_open {
105 let abs = app.draft_scroll + app.draft_selected;
106 if let Some(chunk) = app.draft_chunks.get(abs) {
107 sandbox_draft::draw_detail_popup(frame, chunk, frame.size(), &app.theme);
108 }
109 }
110
111 // Approve-all confirmation popup renders over everything.
112 if app.approve_all_confirm_open && !app.approve_all_confirm_chunks.is_empty() {
113 sandbox_draft::draw_approve_all_popup(
114 frame,
115 &app.approve_all_confirm_chunks,
116 frame.size(),
117 &app.theme,
118 );
119 }
120}
121
122// ---------------------------------------------------------------------------
123// Chrome: title bar, nav bar, command bar

Callers 1

drawFunction · 0.85

Calls 6

draw_approve_all_popupFunction · 0.85
filtered_log_linesMethod · 0.80
drawFunction · 0.70
draw_detail_popupFunction · 0.70
getMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected