1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

Added Operation initially to the structure

This commit is contained in:
postmannen 2021-06-17 09:36:42 +02:00
parent 0f5e737f52
commit 55b6602b4b
2 changed files with 9 additions and 4 deletions

View file

@ -48,7 +48,7 @@ type Message struct {
// operation are used to give an opCmd and opArg's.
Operation Operation `json:"operation"`
// PreviousMessage are used for example if a reply message is
// generated and we also need a copy of thedetails of the the
// generated and we also need a copy of the details of the the
// initial request message.
PreviousMessage *Message

11
stew.go
View file

@ -99,8 +99,6 @@ type msg struct {
// you can override it setting your own here.
ReplyMethod Method `json:"replyMethod" yaml:"replyMethod"`
// From what node the message originated
FromNode node
// ACKTimeout for waiting for an ack message
ACKTimeout int `json:"ACKTimeout" yaml:"ACKTimeout"`
// Resend retries
Retries int `json:"retries" yaml:"retries"`
@ -119,6 +117,8 @@ type msg struct {
// on a file being saved as the result of data being handled
// by a method handler.
FileExtension string `json:"fileExtension" yaml:"fileExtension"`
// operation are used to give an opCmd and opArg's.
Operation *Operation `json:"operation,omitempty"`
}
// Will check and compare all the fields of the main message struct
@ -159,7 +159,7 @@ func checkFieldsMsg() error {
switch stewardRefVal.Type().Field(i).Name {
case "ID":
// Not used in message template.
case "Operation":
case "FromNode":
// Not used in message template.
case "PreviousMessage":
// Not used in message template.
@ -238,6 +238,9 @@ func drawFormREQ(reqFillForm *tview.Form, logForm *tview.TextView, app *tview.Ap
case "FileExtension":
value := ".log"
reqFillForm.AddInputField("FileExtension", value, 30, nil, nil)
case "Operation":
values := []string{"todo"}
reqFillForm.AddDropDown(mRefVal.Type().Field(i).Name, values, 0, nil).SetItemPadding(1)
default:
// Add a no definition fields to the form if a a field within the
@ -312,6 +315,8 @@ func drawFormREQ(reqFillForm *tview.Form, logForm *tview.TextView, app *tview.Ap
m.Directory = value
case "FileExtension":
m.FileExtension = value
case "Operation":
m.Operation = nil
default:
fmt.Fprintf(logForm, "%v : error: did not find case defenition for how to handle the \"%v\" within the switch statement\n", time.Now().Format("Mon Jan _2 15:04:05 2006"), label)
}