diff options
author | Joe <rbo@gmx.us> | 2024-04-18 20:20:20 +0200 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-04-18 20:20:20 +0200 |
commit | e7d590fc38c580fb33c8d3a6dc7c888c98c064ec (patch) | |
tree | a63a999268fb2fe856001b7d42e0a0cef961a162 /src/i_insert.go | |
parent | cool for now (diff) | |
download | hardflip-e7d590fc38c580fb33c8d3a6dc7c888c98c064ec.tar.gz hardflip-e7d590fc38c580fb33c8d3a6dc7c888c98c064ec.tar.bz2 hardflip-e7d590fc38c580fb33c8d3a6dc7c888c98c064ec.tar.xz hardflip-e7d590fc38c580fb33c8d3a6dc7c888c98c064ec.tar.zst hardflip-e7d590fc38c580fb33c8d3a6dc7c888c98c064ec.zip |
add
Diffstat (limited to 'src/i_insert.go')
-rw-r--r-- | src/i_insert.go | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/src/i_insert.go b/src/i_insert.go index 0565c4c..ff71c06 100644 --- a/src/i_insert.go +++ b/src/i_insert.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_insert.go - * Wed Apr 17 14:00:27 2024 + * Thu Apr 18 17:00:01 2024 * Joe * * insert a new host @@ -192,6 +192,8 @@ func i_insert_check_ok(data *HardData, in *HostNode) { text := "no host" if in.Protocol == PROTOCOL_CMD { text = "no command" + } else if in.Protocol == PROTOCOL_OS { + text = "no endpoint" } data.insert_err = append(data.insert_err, errors.New(text)) } @@ -204,6 +206,20 @@ func i_insert_check_ok(data *HardData, in *HostNode) { data.insert_err = append(data.insert_err, errors.New("jump port can't be 0")) } + if in.Protocol == PROTOCOL_OS { + if len(in.User) == 0 { + data.insert_err = append(data.insert_err, + errors.New("user can't be empty")) + } + if len(in.Stack.UserDomainID) == 0 { + data.insert_err = append(data.insert_err, + errors.New("user domain ID can't be empty")) + } + if len(in.Stack.ProjectID) == 0 { + data.insert_err = append(data.insert_err, + errors.New("project ID can't be empty")) + } + } var file [2]string switch in.Protocol { case PROTOCOL_SSH: file[0], file[1] = in.Priv, in.Jump.Priv @@ -347,7 +363,8 @@ func i_draw_insert_inputs(ui HardUI, in *HostNode, home_dir string) { false, home_dir) case INS_SSH_NOTE, INS_RDP_NOTE + len(in.Drive), - INS_CMD_NOTE: + INS_CMD_NOTE, + INS_OS_NOTE: i_prompt_generic(ui, "Note: ", false, "") case INS_RDP_DOMAIN: i_prompt_generic(ui, "Domain: ", false, "") @@ -383,6 +400,12 @@ func i_draw_insert_inputs(ui HardUI, in *HostNode, home_dir string) { i_prompt_generic(ui, "Interface: ", false, "") case INS_OS_IDAPI: i_prompt_generic(ui, "Identity API version: ", false, "") + case INS_OS_IMGAPI: + i_prompt_generic(ui, "Image API version: ", false, "") + case INS_OS_NETAPI: + i_prompt_generic(ui, "Network API version: ", false, "") + case INS_OS_VOLAPI: + i_prompt_generic(ui, "Volume API version: ", false, "") } if len(in.Drive) > 0 && ui.insert_sel >= INS_RDP_DRIVE && @@ -701,5 +724,26 @@ func i_draw_insert_os(ui HardUI, line int, win Quad, i_draw_text_box(ui, win.T + line, win, "Identity API version", in.Stack.IdentityAPI, INS_OS_IDAPI, false) + if line += 1; win.T + line >= win.B { return line } + i_draw_text_box(ui, win.T + line, win, "Image API version", + in.Stack.ImageAPI, + INS_OS_IMGAPI, false) + if line += 1; win.T + line >= win.B { return line } + i_draw_text_box(ui, win.T + line, win, "Network API version", + in.Stack.NetworkAPI, + INS_OS_NETAPI, false) + if line += 1; win.T + line >= win.B { return line } + i_draw_text_box(ui, win.T + line, win, "Volume API version", + in.Stack.VolumeAPI, + INS_OS_VOLAPI, false) + if line += 2; win.T + line >= win.B { return line } + text = "---- Note ----" + i_draw_text(ui.s, ui.dim[W] / 2 - len(text) / 2, win.T + line, win.R - 1, + win.T + line, ui.style[DEF_STYLE], text) + if line += 2; win.T + line >= win.B { return line } + i_draw_text_box(ui, win.T + line, win, "Note", in.Note, + INS_OS_NOTE, false) + if line += 2; win.T + line >= win.B { return line } + i_draw_ok_butt(ui, win.T + line, INS_OS_OK, ui.insert_sel) return line } |