MCPcopy
hub / github.com/docker/docker-agent / View

Method View

pkg/tui/dialog/tool_confirmation.go:352–390  ·  view source on GitHub ↗

View renders the tool confirmation dialog

()

Source from the content-addressed store, hash-verified

350
351// View renders the tool confirmation dialog
352func (d *toolConfirmationDialog) View() string {
353 dialogWidth, contentWidth := d.dialogDimensions()
354
355 dialogStyle := styles.DialogStyle.Width(dialogWidth)
356
357 titleStyle := styles.DialogTitleStyle.Width(contentWidth)
358 title := titleStyle.Render(toolconfirm.Title)
359
360 // Separator
361 separator := d.renderSeparator(contentWidth)
362
363 // Get scrollable tool call view
364 argumentsSection := d.scrollView.View()
365
366 // Combine all parts with proper spacing
367 parts := []string{title, separator}
368
369 if argumentsSection != "" {
370 parts = append(parts, "", argumentsSection)
371 }
372
373 if warning := d.renderSafetyWarning(contentWidth); warning != "" {
374 parts = append(parts, "", warning)
375 }
376
377 if metadata := d.renderMetadata(contentWidth); metadata != "" {
378 parts = append(parts, "", metadata)
379 }
380
381 // Confirmation prompt
382 question := styles.DialogQuestionStyle.Width(contentWidth).Render(toolconfirm.Question)
383 options := d.renderOptions(contentWidth)
384
385 parts = append(parts, "", question, "", options)
386
387 content := lipgloss.JoinVertical(lipgloss.Left, parts...)
388
389 return dialogStyle.Render(content)
390}
391
392// Position calculates the position to center the dialog
393func (d *toolConfirmationDialog) Position() (row, col int) {

Callers 2

handleMouseClickMethod · 0.95
PositionMethod · 0.95

Calls 8

dialogDimensionsMethod · 0.95
renderSeparatorMethod · 0.95
renderSafetyWarningMethod · 0.95
renderMetadataMethod · 0.95
renderOptionsMethod · 0.95
RenderMethod · 0.65
ViewMethod · 0.65
WidthMethod · 0.45

Tested by

no test coverage detected