Skip to content
Snippets Groups Projects
Commit ac78e34d authored by ko_oler's avatar ko_oler
Browse files

правки в action.go

parent 87bc105d
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,8 @@ type (
ActionRequest = pb.ActionRequest
ActionResponse = pb.ActionResponse
ActionTarget = pb.Target
//ActionRequest struct {
// Extension string
// Action string
......@@ -61,6 +63,8 @@ const (
type Action struct {
Extension string `mapstructure:"extension,omitempty"` // Расширение
Action string `mapstructure:"action,omitempty"` // Идентификатор действия
Target ActionTarget `mapstructure:"target,omitempty"` // Как должен отображаться результат действия
Parent string `mapstructure:"parent,omitempty"` // Идентификатор родительского действия (для отображения в меню)
Name string `mapstructure:"name,omitempty"` // Название действия для отображения в интерфейсе (пункт меню, кнопка).
Description string `mapstructure:"description,omitempty"` // Описание действия для отображения в интерфейсе
Icon string `mapstructure:"icon,omitempty"` // Название иконки для отображения действия в интерфейсе
......@@ -71,14 +75,17 @@ type Action struct {
Refs []*references.Reference `mapstructure:"refs,omitempty"` // Ссылки на записи используемые для выполнения действия (назначение ссылок зависит от действия и расширения)
ParamsCollection string `mapstructure:"params_collection,omitempty"`
Request *ActionRequest `mapstructure:"request,omitempty"` // Параметры запроса (используется в случае `ActionResponse.next`)
NavigationAction bool `mapstructure:"navigation_action,omitempty"` // Флаг указывающий что действие переносить пользователя в другую часть интерфейса, а не отправляет запрос на сервер
NavigationAction bool `mapstructure:"navigation_action,omitempty"` // Флаг указывающий, что действие переносить пользователя в другую часть интерфейса, а не отправляет запрос на сервер
NavigationRoute string `mapstructure:"navigation_route,omitempty"`
Autorun bool `mapstructure:"autorun,omitempty"` // Параметр указывающий, что действие выполняется автоматически
Confirm bool `mapstructure:"confirm,omitempty"` // Параметр указывающий, что действие требует подтверждения пользователя
}
func ActionToMap(action *Action) map[string]interface{} {
res := make(map[string]interface{})
mapstructure.Decode(action, &res)
_ = mapstructure.Decode(action, &res)
res["kind"] = int64(action.Kind.Number())
res["target"] = int64(action.Target.Number())
return res
}
......@@ -172,6 +179,8 @@ func ActionFromPB(a *pb.Action) *Action {
return &Action{
Extension: a.Extension,
Action: a.Action,
Target: a.Target,
Parent: a.Parent,
Name: a.Name,
Description: a.Description,
Icon: a.Icon,
......@@ -185,6 +194,8 @@ func ActionFromPB(a *pb.Action) *Action {
//Request: ActionRequestFromPB(a.Request),
NavigationAction: a.NavigationAction,
NavigationRoute: a.NavigationRoute,
Autorun: a.Autorun,
Confirm: a.Confirm,
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment