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 | |
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')
-rw-r--r-- | src/c_defs.go | 5 | ||||
-rw-r--r-- | src/i_events.go | 27 | ||||
-rw-r--r-- | src/i_insert.go | 48 | ||||
-rw-r--r-- | src/i_ui.go | 2 |
4 files changed, 74 insertions, 8 deletions
diff --git a/src/c_defs.go b/src/c_defs.go index b621382..3179488 100644 --- a/src/c_defs.go +++ b/src/c_defs.go @@ -148,7 +148,10 @@ const ( INS_OS_ENDTYPE INS_OS_INTERFACE INS_OS_IDAPI - // TODO: here + INS_OS_IMGAPI + INS_OS_NETAPI + INS_OS_VOLAPI + INS_OS_NOTE INS_OS_OK ) diff --git a/src/i_events.go b/src/i_events.go index b3fa6d5..41cee0f 100644 --- a/src/i_events.go +++ b/src/i_events.go @@ -629,7 +629,8 @@ func i_events(data *HardData) { switch data.ui.insert_sel { case INS_SSH_OK, INS_RDP_OK + len(data.insert.Drive), - INS_CMD_OK: + INS_CMD_OK, + INS_OS_OK: data.ui.insert_sel_ok = false i_insert_check_ok(data, data.insert) if data.insert_err != nil { @@ -698,9 +699,16 @@ func i_events(data *HardData) { ui.buff = data.insert.Stack.Interface case INS_OS_IDAPI: ui.buff = data.insert.Stack.IdentityAPI + case INS_OS_IMGAPI: + ui.buff = data.insert.Stack.ImageAPI + case INS_OS_NETAPI: + ui.buff = data.insert.Stack.NetworkAPI + case INS_OS_VOLAPI: + ui.buff = data.insert.Stack.VolumeAPI case INS_SSH_NOTE, INS_RDP_NOTE + len(data.insert.Drive), - INS_CMD_NOTE: + INS_CMD_NOTE, + INS_OS_NOTE: ui.buff = data.insert.Note } } @@ -846,7 +854,11 @@ func i_events(data *HardData) { INS_OS_REGION, INS_OS_ENDTYPE, INS_OS_INTERFACE, - INS_OS_IDAPI: + INS_OS_IDAPI, + INS_OS_IMGAPI, + INS_OS_NETAPI, + INS_OS_VOLAPI, + INS_OS_NOTE: if event.Key() == tcell.KeyEnter { switch data.ui.insert_sel { case INS_SSH_HOST, @@ -904,9 +916,16 @@ func i_events(data *HardData) { data.insert.Stack.Interface = ui.buff case INS_OS_IDAPI: data.insert.Stack.IdentityAPI = ui.buff + case INS_OS_IMGAPI: + data.insert.Stack.ImageAPI = ui.buff + case INS_OS_NETAPI: + data.insert.Stack.NetworkAPI = ui.buff + case INS_OS_VOLAPI: + data.insert.Stack.VolumeAPI = ui.buff case INS_SSH_NOTE, INS_RDP_NOTE + len(data.insert.Drive), - INS_CMD_NOTE: + INS_CMD_NOTE, + INS_OS_NOTE: data.insert.Note = ui.buff } data.ui.insert_sel_ok = false 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 } diff --git a/src/i_ui.go b/src/i_ui.go index 2565f32..30dfce2 100644 --- a/src/i_ui.go +++ b/src/i_ui.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_ui.go - * Tue Apr 16 15:42:37 2024 + * Thu Apr 18 16:59:53 2024 * Joe * * interfacing with the user |