diff --git a/internal/config/config.go b/internal/config/config.go index 8f4e22d..8898be1 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -11,20 +11,20 @@ type ActionButton struct { CSS map[string]string `mapstructure:"omitempty"` Timeout int Permissions []PermissionsEntry - Arguments []ActionArgument + Arguments []ActionArgument } type ActionArgument struct { - Name string - Label string - Type string - Default string - Choices []ActionArgumentChoice + Name string + Label string + Type string + Default string + Choices []ActionArgumentChoice } type ActionArgumentChoice struct { - Value string - Label string + Value string + Label string } // Entity represents a "thing" that can have multiple actions associated with it. diff --git a/internal/grpcapi/grpcApi.go b/internal/grpcapi/grpcApi.go index 393f6cd..97b5d5c 100644 --- a/internal/grpcapi/grpcApi.go +++ b/internal/grpcapi/grpcApi.go @@ -7,9 +7,9 @@ import ( "google.golang.org/grpc" "net" + acl "github.com/jamesread/OliveTin/internal/acl" config "github.com/jamesread/OliveTin/internal/config" executor "github.com/jamesread/OliveTin/internal/executor" - acl "github.com/jamesread/OliveTin/internal/acl" ) var ( diff --git a/internal/grpcapi/grpcApiButtons.go b/internal/grpcapi/grpcApiButtons.go index e9141a5..87e0fe0 100644 --- a/internal/grpcapi/grpcApiButtons.go +++ b/internal/grpcapi/grpcApiButtons.go @@ -1,14 +1,14 @@ package grpcapi import ( - "fmt" "crypto/md5" + "fmt" pb "github.com/jamesread/OliveTin/gen/grpc" - config "github.com/jamesread/OliveTin/internal/config" 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{ Id: fmt.Sprintf("%x", md5.Sum([]byte(action.Title))), Title: action.Title, @@ -17,12 +17,12 @@ func buildButton(action config.ActionButton, user *acl.User) (*pb.ActionButton) } for _, cfgArg := range action.Arguments { - pbArg := pb.ActionArgument { - Name: cfgArg.Name, - Label: cfgArg.Label, - Type: cfgArg.Type, + pbArg := pb.ActionArgument{ + Name: cfgArg.Name, + Label: cfgArg.Label, + Type: cfgArg.Type, DefaultValue: cfgArg.Default, - Choices: buildChoices(cfgArg.Choices), + Choices: buildChoices(cfgArg.Choices), } btn.Arguments = append(btn.Arguments, &pbArg) @@ -31,17 +31,17 @@ func buildButton(action config.ActionButton, user *acl.User) (*pb.ActionButton) return &btn } -func buildChoices(choices []config.ActionArgumentChoice) ([]*pb.ActionArgumentChoice) { +func buildChoices(choices []config.ActionArgumentChoice) []*pb.ActionArgumentChoice { ret := []*pb.ActionArgumentChoice{} for _, cfgChoice := range choices { - pbChoice := pb.ActionArgumentChoice { + pbChoice := pb.ActionArgumentChoice{ Value: cfgChoice.Value, Label: cfgChoice.Label, } - ret = append(ret, &pbChoice); + ret = append(ret, &pbChoice) } - return ret; + return ret }