component_protocol

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

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 GetProtoInParamsValue(inParams map[string]interface{}, key string) interface{}

func InitDefaultCompProtocols

func InitDefaultCompProtocols(path string)

default path: libs/erda-configs/permission

func LoadDefaultProtocol

func LoadDefaultProtocol(scenario string) (apistructs.ComponentProtocol, error)

func ParseStateBound

func ParseStateBound(b string) (comp, key string, err error)

func PolishProtocol

func PolishProtocol(req *apistructs.ComponentProtocol)

func Register

func Register(r *CompRenderSpec) 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 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 ContextBundle struct {
	Bdl         *bundle.Bundle
	I18nPrinter *message.Printer
	Identity    apistructs.Identity
	InParams    map[string]interface{}
	// add language name for change language
	Locale string
}

type GlobalInnerKey

type GlobalInnerKey string
const (
	GlobalInnerKeyCtxBundle GlobalInnerKey = "_ctxBundle_"
	GlobalInnerKeyUserIDs   GlobalInnerKey = "_userIDs_"
	GlobalInnerKeyError     GlobalInnerKey = "_error_"
	// 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)

Directories

Path Synopsis
component_spec
components
scenarios

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL