diff --git a/pkg/extension/action.go b/pkg/extension/action.go index 2d92fc048e7efeb634b28f194d1eba4f2bd7ce01..5d115679c739d22bd4fa75bc26692e99698172ab 100644 --- a/pkg/extension/action.go +++ b/pkg/extension/action.go @@ -9,6 +9,7 @@ import ( type ( ActionKind = pb.Action_Kind ActionTarget = pb.Target + ActionView = pb.Action_View ResponseState = pb.ActionResponse_State ResponseFormat = pb.ActionResponse_Format @@ -50,14 +51,19 @@ const ( ActionKindRevision = pb.Action_REVISION ActionKindCreate = pb.Action_CREATE - TargetDefault = pb.Target_DEFAULT - TargetModal = pb.Target_MODAL - TargetWide = pb.Target_WIDE - TargetMain = pb.Target_MAIN - TargetDrawer = pb.Target_DRAWER - TargetNotification = pb.Target_NOTIFICATION - TargetBlank = pb.Target_BLANK - TargetNone = pb.Target_NONE + ActionTargetDefault = pb.Target_DEFAULT + ActionTargetModal = pb.Target_MODAL + ActionTargetWide = pb.Target_WIDE + ActionTargetMain = pb.Target_MAIN + ActionTargetDrawer = pb.Target_DRAWER + ActionTargetNotification = pb.Target_NOTIFICATION + ActionTargetBlank = pb.Target_BLANK + ActionTargetNone = pb.Target_NONE + + ActionViewDefault = pb.Action_DEFAULT_VIEW + ActionViewHidden = pb.Action_HIDDEN_VIEW + ActionViewMainMenu = pb.Action_MAIN_MENU_VIEW + ActionViewMainMenuBottom = pb.Action_MAIN_MENU_BOTTOM_VIEW ResponseDone = pb.ActionResponse_DONE ResponseError = pb.ActionResponse_ERROR @@ -71,10 +77,10 @@ const ( ) var ( - TargetName = pb.Target_name - TargetValue = pb.Target_value ActionKindName = pb.Action_Kind_name ActionKindValue = pb.Action_Kind_value + ActionTargetName = pb.Target_name + ActionTargetValue = pb.Target_value ActionViewName = pb.Action_View_name ActionViewValue = pb.Action_View_value ResponseStateName = pb.ActionResponse_State_name diff --git a/pkg/extension/mocks/Extension.go b/pkg/extension/mocks/Extension.go index 67270e599bad23a91aadfeda297325203fea5573..e5482a2db5ede0d006eeefcd5e83259b1974a158 100644 --- a/pkg/extension/mocks/Extension.go +++ b/pkg/extension/mocks/Extension.go @@ -5,6 +5,7 @@ package mocks import ( context "context" + extension "git.perx.ru/perxis/perxis-go/pkg/extension" extensions "git.perx.ru/perxis/perxis-go/proto/extensions" mock "github.com/stretchr/testify/mock" @@ -16,23 +17,23 @@ type Extension struct { } // Action provides a mock function with given fields: ctx, in -func (_m *Extension) Action(ctx context.Context, in *extensions.ActionRequest) (*extensions.ActionResponse, error) { +func (_m *Extension) Action(ctx context.Context, in *extension.ActionRequest) (*extension.ActionResponse, error) { ret := _m.Called(ctx, in) - var r0 *extensions.ActionResponse + var r0 *extension.ActionResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *extensions.ActionRequest) (*extensions.ActionResponse, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, *extension.ActionRequest) (*extension.ActionResponse, error)); ok { return rf(ctx, in) } - if rf, ok := ret.Get(0).(func(context.Context, *extensions.ActionRequest) *extensions.ActionResponse); ok { + if rf, ok := ret.Get(0).(func(context.Context, *extension.ActionRequest) *extension.ActionResponse); ok { r0 = rf(ctx, in) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*extensions.ActionResponse) + r0 = ret.Get(0).(*extension.ActionResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, *extensions.ActionRequest) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, *extension.ActionRequest) error); ok { r1 = rf(ctx, in) } else { r1 = ret.Error(1) diff --git a/pkg/extension/mocks/Manager.go b/pkg/extension/mocks/Manager.go index 907e79be06246a240d05ed8f264d3354ab76cbbe..84fdb40c2471d0a13a9d76cc6528e3a6a2a51d63 100644 --- a/pkg/extension/mocks/Manager.go +++ b/pkg/extension/mocks/Manager.go @@ -17,23 +17,23 @@ type Manager struct { } // Action provides a mock function with given fields: ctx, in -func (_m *Manager) Action(ctx context.Context, in *extensions.ActionRequest) (*extensions.ActionResponse, error) { +func (_m *Manager) Action(ctx context.Context, in *extension.ActionRequest) (*extension.ActionResponse, error) { ret := _m.Called(ctx, in) - var r0 *extensions.ActionResponse + var r0 *extension.ActionResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *extensions.ActionRequest) (*extensions.ActionResponse, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, *extension.ActionRequest) (*extension.ActionResponse, error)); ok { return rf(ctx, in) } - if rf, ok := ret.Get(0).(func(context.Context, *extensions.ActionRequest) *extensions.ActionResponse); ok { + if rf, ok := ret.Get(0).(func(context.Context, *extension.ActionRequest) *extension.ActionResponse); ok { r0 = rf(ctx, in) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*extensions.ActionResponse) + r0 = ret.Get(0).(*extension.ActionResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, *extensions.ActionRequest) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, *extension.ActionRequest) error); ok { r1 = rf(ctx, in) } else { r1 = ret.Error(1) diff --git a/pkg/extension/schema.go b/pkg/extension/schema.go index 3426ae1e2c7663c6c35b994416f1a9d509736b2c..6b38a6d37a43b11fad1221ec947f5d0666313e93 100644 --- a/pkg/extension/schema.go +++ b/pkg/extension/schema.go @@ -8,7 +8,6 @@ import ( "git.perx.ru/perxis/perxis-go/pkg/schema" "git.perx.ru/perxis/perxis-go/pkg/schema/field" "git.perx.ru/perxis/perxis-go/pkg/schema/validate" - pb "git.perx.ru/perxis/perxis-go/proto/extensions" ) const ( @@ -30,7 +29,7 @@ func NewActionsCollection(spaceID, envID string) *collections.Collection { "image", references.Field([]string{"media"}).SetTitle("Рзображение").WithUI(&field.UI{Widget: "Media"}), "kind", field.Number( field.NumberFormatInt, - validate.Enum(getEnumOpt(pb.Action_Kind_name)...), + validate.Enum(getEnumOpt(ActionKindName)...), ).SetTitle("Р’РёРґ").WithUI(&field.UI{Widget: "Select"}), "autorun", field.Bool().SetTitle("Автозапуск"). SetDescription("Действие выполняется автоматически каждый раз РїСЂРё загрузке приложения"). @@ -40,11 +39,11 @@ func NewActionsCollection(spaceID, envID string) *collections.Collection { WithUI(&field.UI{Widget: "Checkbox"}), "target", field.Number( field.NumberFormatInt, - validate.Enum(getEnumOpt(pb.Target_name)...), + validate.Enum(getEnumOpt(ActionTargetName)...), ).SetTitle("Отображение результата действия").WithUI(&field.UI{Widget: "Select"}), "view", field.Number( field.NumberFormatInt, - validate.Enum(getEnumOpt(pb.Action_View_name)...), + validate.Enum(getEnumOpt(ActionViewName)...), ).SetTitle("Отображение действия РІ интерфейсе").WithUI(&field.UI{Widget: "Select"}), "parent", field.String().SetTitle("Рдентификатор родительского действия"), "order", field.Number(field.NumberFormatInt).SetTitle("РџРѕСЂСЏРґРѕРє отображения").