mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
* WTF-484 DigitalOcean module stubbed out * WTF-484 Delete droplets via Ctrl-d * WTF-484 Rebasing off master after a long time away * WTF-484 Improve DigitalOcean display * WTF-484 Can shutdown and restart the selected droplet * WTF-484 Display info about the selected droplet using the ? key * WTF-484 Display info about the selected droplet using the Return key * WTF-484 Greatly improve the utils.Truncate function * WTF-484 Display a droplet's features in the info modal * WTF-484 Change reboot key from r to b to not conflict with refresh * WTF-484 Panic if a keyboard control is mapped to the same character more than once * WTF-484 Colorize droplet status indicator * WTF-484 Extract view.InfoTable out into a reusable component
41 lines
772 B
Go
41 lines
772 B
Go
package digitalocean
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/wtfutil/wtf/utils"
|
|
)
|
|
|
|
func (widget *Widget) content() (string, string, bool) {
|
|
title := widget.CommonSettings().Title
|
|
if widget.err != nil {
|
|
return title, widget.err.Error(), true
|
|
}
|
|
|
|
str := fmt.Sprintf(
|
|
" [%s]Droplets\n\n",
|
|
widget.settings.common.Colors.Subheading,
|
|
)
|
|
|
|
for idx, droplet := range widget.droplets {
|
|
dropletName := droplet.Name
|
|
|
|
row := fmt.Sprintf(
|
|
"[%s] %-8s %-24s %s",
|
|
widget.RowColor(idx),
|
|
droplet.Status,
|
|
dropletName,
|
|
utils.Truncate(strings.Join(droplet.Tags, ","), 24, true),
|
|
)
|
|
|
|
str += utils.HighlightableHelper(widget.View, row, idx, 33)
|
|
}
|
|
|
|
return title, str, false
|
|
}
|
|
|
|
func (widget *Widget) display() {
|
|
widget.ScrollableWidget.Redraw(widget.content)
|
|
}
|