MCPcopy Create free account
hub / github.com/ECSTeam/cloudfoundry-top-plugin / editUpdateInterval

Method editUpdateInterval

ui/masterUi.go:501–530  ·  view source on GitHub ↗
(g *gocui.Gui, v *gocui.View)

Source from the content-addressed store, hash-verified

499}
500
501func (mui *MasterUI) editUpdateInterval(g *gocui.Gui, v *gocui.View) error {
502
503 labelText := "Seconds:"
504 maxLength := 4
505 titleText := "Update refresh interval"
506 helpText := "no help"
507
508 valueText := strings.TrimRight(strings.TrimRight(fmt.Sprintf("%.2f", mui.refreshIntervalMS.Seconds()), "0"), ".")
509
510 applyCallbackFunc := func(g *gocui.Gui, v *gocui.View, w managerUI.Manager, inputValue string) error {
511 f, err := strconv.ParseFloat(inputValue, 64)
512 if err != nil {
513 return err
514 }
515 // Minimum refresh time
516 if f < float64(0.01) {
517 return nil
518 }
519 mui.refreshIntervalMS = time.Duration(f*1000) * time.Millisecond
520 mui.RefeshNow()
521
522 return w.(*uiCommon.InputDialogWidget).CloseWidget(g, v)
523 }
524
525 intervalWidget := uiCommon.NewInputDialogWidget(mui,
526 "editIntervalWidget", 30, 6, labelText, maxLength, titleText, helpText,
527 valueText, applyCallbackFunc)
528
529 return intervalWidget.Init(g)
530}
531
532func (mui *MasterUI) clearStats(g *gocui.Gui, v *gocui.View) error {
533 mui.router.Clear()

Callers

nothing calls this directly

Calls 3

RefeshNowMethod · 0.95
InitMethod · 0.95
CloseWidgetMethod · 0.80

Tested by

no test coverage detected