mirror of
https://github.com/postmannen/ctrl.git
synced 2025-03-15 10:57:42 +00:00
Added Operation initially to the structure
This commit is contained in:
parent
0f5e737f52
commit
55b6602b4b
2 changed files with 9 additions and 4 deletions
|
@ -48,7 +48,7 @@ type Message struct {
|
||||||
// operation are used to give an opCmd and opArg's.
|
// operation are used to give an opCmd and opArg's.
|
||||||
Operation Operation `json:"operation"`
|
Operation Operation `json:"operation"`
|
||||||
// PreviousMessage are used for example if a reply message is
|
// 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.
|
// initial request message.
|
||||||
PreviousMessage *Message
|
PreviousMessage *Message
|
||||||
|
|
||||||
|
|
11
stew.go
11
stew.go
|
@ -99,8 +99,6 @@ type msg struct {
|
||||||
// you can override it setting your own here.
|
// you can override it setting your own here.
|
||||||
ReplyMethod Method `json:"replyMethod" yaml:"replyMethod"`
|
ReplyMethod Method `json:"replyMethod" yaml:"replyMethod"`
|
||||||
// From what node the message originated
|
// From what node the message originated
|
||||||
FromNode node
|
|
||||||
// ACKTimeout for waiting for an ack message
|
|
||||||
ACKTimeout int `json:"ACKTimeout" yaml:"ACKTimeout"`
|
ACKTimeout int `json:"ACKTimeout" yaml:"ACKTimeout"`
|
||||||
// Resend retries
|
// Resend retries
|
||||||
Retries int `json:"retries" yaml:"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
|
// on a file being saved as the result of data being handled
|
||||||
// by a method handler.
|
// by a method handler.
|
||||||
FileExtension string `json:"fileExtension" yaml:"fileExtension"`
|
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
|
// 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 {
|
switch stewardRefVal.Type().Field(i).Name {
|
||||||
case "ID":
|
case "ID":
|
||||||
// Not used in message template.
|
// Not used in message template.
|
||||||
case "Operation":
|
case "FromNode":
|
||||||
// Not used in message template.
|
// Not used in message template.
|
||||||
case "PreviousMessage":
|
case "PreviousMessage":
|
||||||
// Not used in message template.
|
// Not used in message template.
|
||||||
|
@ -238,6 +238,9 @@ func drawFormREQ(reqFillForm *tview.Form, logForm *tview.TextView, app *tview.Ap
|
||||||
case "FileExtension":
|
case "FileExtension":
|
||||||
value := ".log"
|
value := ".log"
|
||||||
reqFillForm.AddInputField("FileExtension", value, 30, nil, nil)
|
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:
|
default:
|
||||||
// Add a no definition fields to the form if a a field within the
|
// 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
|
m.Directory = value
|
||||||
case "FileExtension":
|
case "FileExtension":
|
||||||
m.FileExtension = value
|
m.FileExtension = value
|
||||||
|
case "Operation":
|
||||||
|
m.Operation = nil
|
||||||
default:
|
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)
|
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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue