mirror of
https://github.com/wavetermdev/waveterm
synced 2026-05-24 09:18:27 +00:00
send block creation events for sub-blocks as well (#3247)
need to understand vdom usage
This commit is contained in:
parent
c2a17e7eb2
commit
efd450fd3d
3 changed files with 8 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -21,6 +21,7 @@ aiplans/
|
|||
manifests/
|
||||
.env
|
||||
out
|
||||
.kilocode/package-lock.json
|
||||
|
||||
# Yarn Modern
|
||||
.pnp.*
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ type TEventProps struct {
|
|||
|
||||
BlockView string `json:"block:view,omitempty"`
|
||||
BlockController string `json:"block:controller,omitempty"`
|
||||
BlockSubBlock bool `json:"block:subblock,omitempty"`
|
||||
|
||||
AiBackendType string `json:"ai:backendtype,omitempty"`
|
||||
AiLocal bool `json:"ai:local,omitempty"`
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ func CreateSubBlock(ctx context.Context, blockId string, blockDef *waveobj.Block
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating sub block: %w", err)
|
||||
}
|
||||
blockView := blockDef.Meta.GetString(waveobj.MetaKey_View, "")
|
||||
blockController := blockDef.Meta.GetString(waveobj.MetaKey_Controller, "")
|
||||
go recordBlockCreationTelemetry(blockView, blockController, true)
|
||||
return blockData, nil
|
||||
}
|
||||
|
||||
|
|
@ -100,12 +103,12 @@ func CreateBlockWithTelemetry(ctx context.Context, tabId string, blockDef *waveo
|
|||
if recordTelemetry {
|
||||
blockView := blockDef.Meta.GetString(waveobj.MetaKey_View, "")
|
||||
blockController := blockDef.Meta.GetString(waveobj.MetaKey_Controller, "")
|
||||
go recordBlockCreationTelemetry(blockView, blockController)
|
||||
go recordBlockCreationTelemetry(blockView, blockController, false)
|
||||
}
|
||||
return blockData, nil
|
||||
}
|
||||
|
||||
func recordBlockCreationTelemetry(blockView string, blockController string) {
|
||||
func recordBlockCreationTelemetry(blockView string, blockController string, subBlock bool) {
|
||||
defer func() {
|
||||
panichandler.PanicHandler("CreateBlock:telemetry", recover())
|
||||
}()
|
||||
|
|
@ -122,6 +125,7 @@ func recordBlockCreationTelemetry(blockView string, blockController string) {
|
|||
Props: telemetrydata.TEventProps{
|
||||
BlockView: blockView,
|
||||
BlockController: blockController,
|
||||
BlockSubBlock: subBlock,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue