gofmt
This commit is contained in:
parent
afd8353b6f
commit
ca36434a48
|
|
@ -11,20 +11,20 @@ type ActionButton struct {
|
||||||
CSS map[string]string `mapstructure:"omitempty"`
|
CSS map[string]string `mapstructure:"omitempty"`
|
||||||
Timeout int
|
Timeout int
|
||||||
Permissions []PermissionsEntry
|
Permissions []PermissionsEntry
|
||||||
Arguments []ActionArgument
|
Arguments []ActionArgument
|
||||||
}
|
}
|
||||||
|
|
||||||
type ActionArgument struct {
|
type ActionArgument struct {
|
||||||
Name string
|
Name string
|
||||||
Label string
|
Label string
|
||||||
Type string
|
Type string
|
||||||
Default string
|
Default string
|
||||||
Choices []ActionArgumentChoice
|
Choices []ActionArgumentChoice
|
||||||
}
|
}
|
||||||
|
|
||||||
type ActionArgumentChoice struct {
|
type ActionArgumentChoice struct {
|
||||||
Value string
|
Value string
|
||||||
Label string
|
Label string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entity represents a "thing" that can have multiple actions associated with it.
|
// Entity represents a "thing" that can have multiple actions associated with it.
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ import (
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
acl "github.com/jamesread/OliveTin/internal/acl"
|
||||||
config "github.com/jamesread/OliveTin/internal/config"
|
config "github.com/jamesread/OliveTin/internal/config"
|
||||||
executor "github.com/jamesread/OliveTin/internal/executor"
|
executor "github.com/jamesread/OliveTin/internal/executor"
|
||||||
acl "github.com/jamesread/OliveTin/internal/acl"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
package grpcapi
|
package grpcapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
|
"fmt"
|
||||||
pb "github.com/jamesread/OliveTin/gen/grpc"
|
pb "github.com/jamesread/OliveTin/gen/grpc"
|
||||||
config "github.com/jamesread/OliveTin/internal/config"
|
|
||||||
acl "github.com/jamesread/OliveTin/internal/acl"
|
acl "github.com/jamesread/OliveTin/internal/acl"
|
||||||
|
config "github.com/jamesread/OliveTin/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func buildButton(action config.ActionButton, user *acl.User) (*pb.ActionButton) {
|
func buildButton(action config.ActionButton, user *acl.User) *pb.ActionButton {
|
||||||
btn := pb.ActionButton{
|
btn := pb.ActionButton{
|
||||||
Id: fmt.Sprintf("%x", md5.Sum([]byte(action.Title))),
|
Id: fmt.Sprintf("%x", md5.Sum([]byte(action.Title))),
|
||||||
Title: action.Title,
|
Title: action.Title,
|
||||||
|
|
@ -17,12 +17,12 @@ func buildButton(action config.ActionButton, user *acl.User) (*pb.ActionButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, cfgArg := range action.Arguments {
|
for _, cfgArg := range action.Arguments {
|
||||||
pbArg := pb.ActionArgument {
|
pbArg := pb.ActionArgument{
|
||||||
Name: cfgArg.Name,
|
Name: cfgArg.Name,
|
||||||
Label: cfgArg.Label,
|
Label: cfgArg.Label,
|
||||||
Type: cfgArg.Type,
|
Type: cfgArg.Type,
|
||||||
DefaultValue: cfgArg.Default,
|
DefaultValue: cfgArg.Default,
|
||||||
Choices: buildChoices(cfgArg.Choices),
|
Choices: buildChoices(cfgArg.Choices),
|
||||||
}
|
}
|
||||||
|
|
||||||
btn.Arguments = append(btn.Arguments, &pbArg)
|
btn.Arguments = append(btn.Arguments, &pbArg)
|
||||||
|
|
@ -31,17 +31,17 @@ func buildButton(action config.ActionButton, user *acl.User) (*pb.ActionButton)
|
||||||
return &btn
|
return &btn
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildChoices(choices []config.ActionArgumentChoice) ([]*pb.ActionArgumentChoice) {
|
func buildChoices(choices []config.ActionArgumentChoice) []*pb.ActionArgumentChoice {
|
||||||
ret := []*pb.ActionArgumentChoice{}
|
ret := []*pb.ActionArgumentChoice{}
|
||||||
|
|
||||||
for _, cfgChoice := range choices {
|
for _, cfgChoice := range choices {
|
||||||
pbChoice := pb.ActionArgumentChoice {
|
pbChoice := pb.ActionArgumentChoice{
|
||||||
Value: cfgChoice.Value,
|
Value: cfgChoice.Value,
|
||||||
Label: cfgChoice.Label,
|
Label: cfgChoice.Label,
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = append(ret, &pbChoice);
|
ret = append(ret, &pbChoice)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue