()
| 566 | } |
| 567 | |
| 568 | func openExplorerSettingsForm() { |
| 569 | currentFocus := app.GetFocus() |
| 570 | |
| 571 | baseDNField := tview.NewInputField(). |
| 572 | SetLabel("Base DN"). |
| 573 | SetText(explorerBaseDN) |
| 574 | assignInputFieldTheme(baseDNField) |
| 575 | |
| 576 | filterField := tview.NewInputField(). |
| 577 | SetLabel("Expand Filter"). |
| 578 | SetText(SearchFilter) |
| 579 | assignInputFieldTheme(filterField) |
| 580 | |
| 581 | attrsField := tview.NewInputField(). |
| 582 | SetLabel("Attributes"). |
| 583 | SetText(explorerAttrsList) |
| 584 | assignInputFieldTheme(attrsField) |
| 585 | |
| 586 | form := NewXForm() |
| 587 | form. |
| 588 | AddFormItem(baseDNField). |
| 589 | AddFormItem(filterField). |
| 590 | AddFormItem(attrsField). |
| 591 | AddButton("Go Back", func() { |
| 592 | app.SetRoot(appPanel, true).SetFocus(currentFocus) |
| 593 | }). |
| 594 | AddButton("Query", func() { |
| 595 | newAttrsList := attrsField.GetText() |
| 596 | warnAttrsList(newAttrsList, currentFocus, func() { |
| 597 | explorerBaseDN = baseDNField.GetText() |
| 598 | SearchFilter = filterField.GetText() |
| 599 | explorerAttrsList = newAttrsList |
| 600 | app.SetRoot(appPanel, true).SetFocus(currentFocus) |
| 601 | reloadExplorerPage() |
| 602 | }) |
| 603 | }) |
| 604 | |
| 605 | form.SetTitle("Explorer Settings").SetBorder(true) |
| 606 | form.SetInputCapture(handleEscape(currentFocus)) |
| 607 | |
| 608 | centeredForm := tview.NewGrid(). |
| 609 | SetColumns(0, 60, 0). |
| 610 | SetRows(0, 11, 0). |
| 611 | AddItem(form, 1, 1, 1, 1, 0, 0, true) |
| 612 | |
| 613 | app.SetRoot(centeredForm, true).SetFocus(form) |
| 614 | } |
| 615 | |
| 616 | func explorerPageKeyHandler(event *tcell.EventKey) *tcell.EventKey { |
| 617 | if event.Key() == tcell.KeyTab || event.Key() == tcell.KeyBacktab { |
no test coverage detected