aboutsummaryrefslogtreecommitdiffstats
path: root/src/i_insert.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-02-27 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-02-27 20:20:20 +0100
commita02ec216a094352431f8317c0b902fdd321b6f88 (patch)
tree6b7a87193b10f4b332a619934f4f849b6eca6a4e /src/i_insert.go
parentye (diff)
downloadhardflip-a02ec216a094352431f8317c0b902fdd321b6f88.tar.gz
hardflip-a02ec216a094352431f8317c0b902fdd321b6f88.tar.bz2
hardflip-a02ec216a094352431f8317c0b902fdd321b6f88.tar.xz
hardflip-a02ec216a094352431f8317c0b902fdd321b6f88.tar.zst
hardflip-a02ec216a094352431f8317c0b902fdd321b6f88.zip
gooo
Diffstat (limited to 'src/i_insert.go')
-rw-r--r--src/i_insert.go43
1 files changed, 35 insertions, 8 deletions
diff --git a/src/i_insert.go b/src/i_insert.go
index 5b246aa..12f4cf3 100644
--- a/src/i_insert.go
+++ b/src/i_insert.go
@@ -43,7 +43,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* hardflip: src/i_insert.go
- * Tue Feb 27 13:48:05 2024
+ * Tue Feb 27 14:31:54 2024
* Joe
*
* insert a new host
@@ -51,23 +51,33 @@
package main
-import "github.com/gdamore/tcell/v2"
+import (
+ "strconv"
+ "github.com/gdamore/tcell/v2"
+)
-func i_draw_text_box(ui HardUI, line int, dim Quad, label, content string) {
+func i_draw_text_box(ui HardUI, line int, dim Quad, label, content string,
+ id, selected int) {
const tbox_size int = 14
+ tbox_style := ui.style[STYLE_DEF].Background(tcell.ColorBlack).Dim(true)
- l := ui.dim[W] / 2 - len(label) - 1
+ if id == selected {
+ tbox_style = tbox_style.Reverse(true).Dim(false)
+ }
+
+ l := ui.dim[W] / 2 - len(label) - 2
if l <= dim.L { l = dim.L + 1 }
i_draw_text(ui.s, l, line, ui.dim[W] / 2, line,
ui.style[STYLE_DEF], label)
- // TODO: here
spaces := ""
for i := 0; i < tbox_size; i++ {
spaces += " "
}
i_draw_text(ui.s, ui.dim[W] / 2, line, dim.R, line,
- ui.style[STYLE_DEF].Background(tcell.ColorBlack).Dim(true),
- "|" + spaces + "|")
+ tbox_style,
+ "[" + spaces + "]")
+ i_draw_text(ui.s, ui.dim[W] / 2 + 1, line, ui.dim[W] / 2 + 1 + tbox_size,
+ line, tbox_style, content)
}
func i_draw_insert_panel(ui HardUI, in *HostNode) {
@@ -83,5 +93,22 @@ func i_draw_insert_panel(ui HardUI, in *HostNode) {
i_draw_box(ui.s, win.L, win.T, win.R, win.B,
ui.style[STYLE_BOX], ui.style[STYLE_HEAD],
" Insert - " + in.Name + " ", true)
- i_draw_text_box(ui, win.T + 2, win, "Connection type", "fuck this")
+ line := 2
+ i_draw_text_box(ui, win.T + line, win, "Connection type", in.protocol_str(),
+ 0, ui.insert_sel)
+ line += 2
+ i_draw_insert_ssh(ui, line, win, in)
+}
+
+func i_draw_insert_ssh(ui HardUI, line int, win Quad, in *HostNode) {
+ i_draw_text_box(ui, win.T + line, win, "Host/IP", in.Host, 1, ui.insert_sel)
+ line += 1
+ i_draw_text_box(ui, win.T + line, win, "Port", strconv.Itoa(int(in.Port)),
+ 2, ui.insert_sel)
+ line += 2
+ i_draw_text_box(ui, win.T + line, win, "User", in.User, 3, ui.insert_sel)
+ line += 1
+ i_draw_text_box(ui, win.T + line, win, "Pass", in.Pass, 4, ui.insert_sel) // TODO: gpg
+ line += 1
+ // TODO: here
}