1- import { BindLogic } from 'kea'
1+ import { BindLogic , useValues } from 'kea'
22
33import { uuid } from 'lib/utils'
44import { groupLogic } from 'scenes/groups/groupLogic'
55import { Notebook } from 'scenes/notebooks/Notebook/Notebook'
6+ import { notebookLogic } from 'scenes/notebooks/Notebook/notebookLogic'
67
7- import { Group } from '~/types'
8+ import { groupsModel } from '~/models/groupsModel'
9+ import { AnyPropertyFilter , Group , PropertyFilterType , PropertyOperator } from '~/types'
810
911interface GroupFeedCanvasProps {
1012 group : Group
@@ -14,69 +16,86 @@ interface GroupFeedCanvasProps {
1416export const GroupFeedCanvas = ( { group, tabId } : GroupFeedCanvasProps ) : JSX . Element => {
1517 const groupKey = group . group_key
1618 const groupTypeIndex = group . group_type_index
19+ const { aggregationLabel } = useValues ( groupsModel )
20+
21+ const shortId = `canvas-${ groupKey } -${ tabId } `
22+ const mode = 'canvas'
23+
24+ const groupFilter : AnyPropertyFilter [ ] = [
25+ {
26+ type : PropertyFilterType . EventMetadata ,
27+ key : `$group_${ groupTypeIndex } ` ,
28+ label : aggregationLabel ( groupTypeIndex ) . singular ,
29+ value : groupKey ,
30+ operator : PropertyOperator . Exact ,
31+ } ,
32+ ]
1733
1834 return (
19- < BindLogic logic = { groupLogic } props = { { groupKey, groupTypeIndex, tabId } } >
20- < Notebook
21- editable = { false }
22- shortId = { `canvas-${ groupKey } -${ tabId } ` }
23- mode = "canvas"
24- initialContent = { {
25- type : 'doc' ,
26- content : [
27- {
28- type : 'ph-usage-metrics' ,
29- attrs : {
30- groupKey,
31- groupTypeIndex,
32- tabId,
33- nodeId : uuid ( ) ,
34- children : [
35- {
36- type : 'ph-group' ,
37- attrs : {
38- id : groupKey ,
39- groupTypeIndex,
40- tabId,
41- nodeId : uuid ( ) ,
42- title : 'Info' ,
35+ < BindLogic logic = { notebookLogic } props = { { shortId, mode, canvasFiltersOverride : groupFilter } } >
36+ < BindLogic logic = { groupLogic } props = { { groupKey, groupTypeIndex, tabId } } >
37+ < Notebook
38+ editable = { false }
39+ shortId = { `canvas-${ groupKey } -${ tabId } ` }
40+ mode = "canvas"
41+ canvasFiltersOverride = { groupFilter }
42+ initialContent = { {
43+ type : 'doc' ,
44+ content : [
45+ {
46+ type : 'ph-usage-metrics' ,
47+ attrs : {
48+ groupKey,
49+ groupTypeIndex,
50+ tabId,
51+ nodeId : uuid ( ) ,
52+ children : [
53+ {
54+ type : 'ph-group' ,
55+ attrs : {
56+ id : groupKey ,
57+ groupTypeIndex,
58+ tabId,
59+ nodeId : uuid ( ) ,
60+ title : 'Info' ,
61+ } ,
4362 } ,
44- } ,
45- {
46- type : 'ph-group-properties' ,
47- attrs : {
48- nodeId : uuid ( ) ,
63+ {
64+ type : 'ph-group-properties' ,
65+ attrs : {
66+ nodeId : uuid ( ) ,
67+ } ,
4968 } ,
50- } ,
51- {
52- type : 'ph-related-groups' ,
53- attrs : {
54- id : groupKey ,
55- groupTypeIndex ,
56- nodeId : uuid ( ) ,
57- title : 'Related people ' ,
58- type : 'person' ,
69+ {
70+ type : 'ph-related-groups' ,
71+ attrs : {
72+ id : groupKey ,
73+ groupTypeIndex ,
74+ nodeId : uuid ( ) ,
75+ title : 'Related people' ,
76+ type : 'person ' ,
77+ } ,
5978 } ,
60- } ,
61- ] ,
79+ ] ,
80+ } ,
81+ } ,
82+ {
83+ type : 'ph-issues' ,
84+ attrs : { groupKey, groupTypeIndex, tabId, nodeId : uuid ( ) } ,
6285 } ,
63- } ,
64- {
65- type : 'ph-issues' ,
66- attrs : { groupKey, groupTypeIndex, tabId, nodeId : uuid ( ) } ,
67- } ,
68- {
69- type : 'ph-llm-trace' ,
70- attrs : {
71- groupKey,
72- groupTypeIndex,
73- tabId,
74- nodeId : uuid ( ) ,
86+ {
87+ type : 'ph-llm-trace' ,
88+ attrs : {
89+ groupKey,
90+ groupTypeIndex,
91+ tabId,
92+ nodeId : uuid ( ) ,
93+ } ,
7594 } ,
76- } ,
77- ] ,
78- } }
79- / >
95+ ] ,
96+ } }
97+ />
98+ </ BindLogic >
8099 </ BindLogic >
81100 )
82101}
0 commit comments