Documentation ¶
Index ¶
- Variables
- func EventConvert(receiver string, event apistructs.ComponentEvent) apistructs.ComponentEvent
- func GetCompStateKV(c *apistructs.Component, sk string) (interface{}, error)
- func GetGlobalStateKV(p *apistructs.ComponentProtocol, key string) interface{}
- func GetProtoComp(p *apistructs.ComponentProtocol, compName string) (c *apistructs.Component, err error)
- func GetProtoCompStateValue(p *apistructs.ComponentProtocol, compName, sk string) (interface{}, error)
- func GetProtoInParamsValue(inParams map[string]interface{}, key string) interface{}
- func GetScenarioKey(req apistructs.ComponentProtocolScenario) (string, error)
- func InitDefaultCompProtocols(path string)
- func LoadDefaultProtocol(scenario string) (apistructs.ComponentProtocol, error)
- func ParseStateBound(b string) (comp, key string, err error)
- func PolishProtocol(req *apistructs.ComponentProtocol)
- func ProtoCompStateRending(ctx context.Context, p *apistructs.ComponentProtocol, r apistructs.RendingItem) error
- func Register(r *CompRenderSpec) error
- func RunScenarioRender(ctx context.Context, req *apistructs.ComponentProtocolRequest) error
- func SetCompStateKVFromInParams(c *apistructs.Component, key string, value interface{}) error
- func SetCompStateValueFromComps(c *apistructs.Component, key string, value interface{}) error
- func SetGlobalStateKV(p *apistructs.ComponentProtocol, key string, value interface{})
- type CompRender
- type CompRenderSpec
- type ContextBundle
- type GlobalInnerKey
- type RenderCreator
- type ScenarioRender
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultProtocols = make(map[string]apistructs.ComponentProtocol)
scenario name: scenario default protocol
View Source
var ScenarioRenders = make(map[string]*ScenarioRender)
scenario: componentName: componentRender
Functions ¶
func EventConvert ¶
func EventConvert(receiver string, event apistructs.ComponentEvent) apistructs.ComponentEvent
前端触发的事件转换,如果是组件自身的事件,则透传; 否则, (1) 组件名为空,界面刷新:InitializeOperation
(2) 通过协议定义的Rending触发的事件:RenderingOperation
func GetCompStateKV ¶
func GetCompStateKV(c *apistructs.Component, sk string) (interface{}, error)
func GetGlobalStateKV ¶
func GetGlobalStateKV(p *apistructs.ComponentProtocol, key string) interface{}
func GetProtoComp ¶
func GetProtoComp(p *apistructs.ComponentProtocol, compName string) (c *apistructs.Component, err error)
func GetProtoCompStateValue ¶
func GetProtoCompStateValue(p *apistructs.ComponentProtocol, compName, sk string) (interface{}, error)
func GetProtoInParamsValue ¶
func GetScenarioKey ¶
func GetScenarioKey(req apistructs.ComponentProtocolScenario) (string, error)
func InitDefaultCompProtocols ¶
func InitDefaultCompProtocols(path string)
default path: libs/erda-configs/permission
func LoadDefaultProtocol ¶
func LoadDefaultProtocol(scenario string) (apistructs.ComponentProtocol, error)
func ParseStateBound ¶
func PolishProtocol ¶
func PolishProtocol(req *apistructs.ComponentProtocol)
func ProtoCompStateRending ¶
func ProtoCompStateRending(ctx context.Context, p *apistructs.ComponentProtocol, r apistructs.RendingItem) error
func Register ¶
func Register(r *CompRenderSpec) error
func RunScenarioRender ¶
func RunScenarioRender(ctx context.Context, req *apistructs.ComponentProtocolRequest) error
func SetCompStateKVFromInParams ¶
func SetCompStateKVFromInParams(c *apistructs.Component, key string, value interface{}) error
func SetCompStateValueFromComps ¶
func SetCompStateValueFromComps(c *apistructs.Component, key string, value interface{}) error
func SetGlobalStateKV ¶
func SetGlobalStateKV(p *apistructs.ComponentProtocol, key string, value interface{})
Types ¶
type CompRender ¶
type CompRender interface {
Render(ctx context.Context, c *apistructs.Component, scenario apistructs.ComponentProtocolScenario, event apistructs.ComponentEvent, gs *apistructs.GlobalStateData) error
}
type CompRenderSpec ¶
type CompRenderSpec struct { // 具体的场景名 Scenario string `json:"scenario"` // 具体的组件名 CompName string `json:"name"` // 组件(包含渲染函数)创建函数 RenderC RenderCreator }
func GetCompRender ¶
func GetCompRender(r *ScenarioRender, comp, typ string) (*CompRenderSpec, error)
type ContextBundle ¶
type GlobalInnerKey ¶
type GlobalInnerKey string
const ( GlobalInnerKeyCtxBundle GlobalInnerKey = "_ctxBundle_" GlobalInnerKeyUserIDs GlobalInnerKey = "_userIDs_" // userID & orgID GlobalInnerKeyIdentity GlobalInnerKey = "_identity_" // Default Rendering Key DefaultRenderingKey = "__DefaultRendering__" // Rendering 从 InParams 绑定 InParamsStateBindingKey = "__InParams__" )
func (GlobalInnerKey) Normal ¶
func (s GlobalInnerKey) Normal() string
func (GlobalInnerKey) String ¶
func (s GlobalInnerKey) String() string
type RenderCreator ¶
type RenderCreator func() CompRender
type ScenarioRender ¶
type ScenarioRender map[string]*CompRenderSpec
componentName: componentRender
func GetScenarioRenders ¶
func GetScenarioRenders(scenario string) (*ScenarioRender, error)
Click to show internal directories.
Click to hide internal directories.