component_protocol

package
v1.3.0-rc Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
pkg
scenarios

Jump to

Keyboard shortcuts

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