CreateSuccessDialogWithURL creates a success dialog with URL information for VNC connections.
(title, message string, onClose func())
| 137 | |
| 138 | // CreateSuccessDialogWithURL creates a success dialog with URL information for VNC connections. |
| 139 | func CreateSuccessDialogWithURL(title, message string, onClose func()) *tview.Modal { |
| 140 | // Create a modal with the message |
| 141 | modal := tview.NewModal() |
| 142 | modal.SetText(message) |
| 143 | modal.SetTextColor(theme.Colors.Success) |
| 144 | modal.SetBorderColor(theme.Colors.Border) |
| 145 | modal.SetTitle(title) |
| 146 | modal.SetTitleColor(theme.Colors.Title) |
| 147 | |
| 148 | // Add close button |
| 149 | modal.AddButtons([]string{"OK"}) |
| 150 | modal.SetDoneFunc(func(buttonIndex int, buttonLabel string) { |
| 151 | if onClose != nil { |
| 152 | onClose() |
| 153 | } |
| 154 | }) |
| 155 | |
| 156 | // Add keyboard shortcuts for dismissal |
| 157 | modal.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { |
| 158 | if event.Key() == tcell.KeyEscape { |
| 159 | if onClose != nil { |
| 160 | onClose() |
| 161 | } |
| 162 | return nil |
| 163 | } |
| 164 | return event |
| 165 | }) |
| 166 | |
| 167 | return modal |
| 168 | } |
| 169 | |
| 170 | // CreateFormDialog creates a form dialog with custom fields. |
| 171 | func CreateFormDialog(title string, fields []FormField, onSubmit, onCancel func(map[string]string)) *tview.Form { |
no test coverage detected