File tree Expand file tree Collapse file tree 8 files changed +398
-28
lines changed
calculator_ops_catalog/src Expand file tree Collapse file tree 8 files changed +398
-28
lines changed Original file line number Diff line number Diff line change 114
114
}
115
115
]
116
116
},
117
+ "ConfigExample" : {
118
+ "properties" : {
119
+ "config" : {
120
+ "description" : " The value of the config"
121
+ },
122
+ "description" : {
123
+ "description" : " A description of what this config is for" ,
124
+ "type" : " string"
125
+ }
126
+ },
127
+ "required" : [
128
+ " description" ,
129
+ " config"
130
+ ],
131
+ "type" : " object"
132
+ },
117
133
"DebugSessionMessage" : {
118
134
"oneOf" : [
119
135
{
780
796
"description" : " If the user does not specify a default display text, the node ID will\n be used here." ,
781
797
"type" : " string"
782
798
},
799
+ "description" : {
800
+ "type" : [
801
+ " string" ,
802
+ " null"
803
+ ]
804
+ },
805
+ "example_configs" : {
806
+ "items" : {
807
+ "$ref" : " #/$defs/ConfigExample"
808
+ },
809
+ "type" : " array"
810
+ },
783
811
"request" : {
784
812
"type" : " string"
785
813
},
798
826
" request" ,
799
827
" response" ,
800
828
" streams" ,
801
- " config_schema"
829
+ " config_schema" ,
830
+ " example_configs"
802
831
],
803
832
"type" : " object"
804
833
},
1027
1056
"default_display_text" : {
1028
1057
"type" : " string"
1029
1058
},
1059
+ "description" : {
1060
+ "type" : [
1061
+ " string" ,
1062
+ " null"
1063
+ ]
1064
+ },
1065
+ "example_configs" : {
1066
+ "items" : {
1067
+ "$ref" : " #/$defs/ConfigExample"
1068
+ },
1069
+ "type" : " array"
1070
+ },
1030
1071
"metadata" : {
1031
1072
"$ref" : " #/$defs/SectionMetadata"
1032
1073
}
1033
1074
},
1034
1075
"required" : [
1035
1076
" default_display_text" ,
1036
1077
" metadata" ,
1037
- " config_schema"
1078
+ " config_schema" ,
1079
+ " example_configs"
1038
1080
],
1039
1081
"type" : " object"
1040
1082
},
Original file line number Diff line number Diff line change 1
- import { Autocomplete , TextField } from '@mui/material' ;
1
+ import {
2
+ Autocomplete ,
3
+ Box ,
4
+ ListItem ,
5
+ Stack ,
6
+ TextField ,
7
+ Tooltip ,
8
+ } from '@mui/material' ;
2
9
import { useMemo , useState } from 'react' ;
10
+ import { MaterialSymbol } from '../nodes' ;
3
11
import { useRegistry } from '../registry-provider' ;
4
12
import BaseEditOperationForm , {
5
13
type BaseEditOperationFormProps ,
@@ -60,6 +68,25 @@ function NodeForm(props: NodeFormProps) {
60
68
renderInput = { ( params ) => (
61
69
< TextField { ...params } required label = "Builder" />
62
70
) }
71
+ renderOption = { ( { key, ...otherProps } , value ) => {
72
+ const nodeMetadata = registry . nodes [ value ] ;
73
+ return (
74
+ < ListItem key = { key } { ...otherProps } >
75
+ < Stack
76
+ direction = "row"
77
+ justifyContent = "space-between"
78
+ width = "100%"
79
+ >
80
+ < span > { value } </ span >
81
+ { nodeMetadata ?. description && (
82
+ < Tooltip title = { nodeMetadata . description } >
83
+ < MaterialSymbol symbol = "info" />
84
+ </ Tooltip >
85
+ ) }
86
+ </ Stack >
87
+ </ ListItem >
88
+ ) ;
89
+ } }
63
90
/>
64
91
< TextField
65
92
multiline
Original file line number Diff line number Diff line change @@ -9,10 +9,15 @@ export interface MaterialSymbolProps extends BoxProps {
9
9
10
10
export function MaterialSymbol ( {
11
11
symbol,
12
+ className,
12
13
...otherProps
13
14
} : MaterialSymbolProps ) : React . JSX . Element {
14
15
return (
15
- < Box component = "span" className = "material-symbols-outlined" { ...otherProps } >
16
+ < Box
17
+ component = "span"
18
+ className = { `material-symbols-outlined ${ className } ` }
19
+ { ...otherProps }
20
+ >
16
21
{ symbol }
17
22
</ Box >
18
23
) ;
Original file line number Diff line number Diff line change @@ -352,6 +352,23 @@ export interface BufferSettings {
352
352
retention : RetentionPolicy ;
353
353
[ k : string ] : unknown ;
354
354
}
355
+ /**
356
+ * This interface was referenced by `DiagramEditorApi`'s JSON-Schema
357
+ * via the `definition` "ConfigExample".
358
+ */
359
+ export interface ConfigExample {
360
+ /**
361
+ * The value of the config
362
+ */
363
+ config : {
364
+ [ k : string ] : unknown ;
365
+ } ;
366
+ /**
367
+ * A description of what this config is for
368
+ */
369
+ description : string ;
370
+ [ k : string ] : unknown ;
371
+ }
355
372
/**
356
373
* This interface was referenced by `DiagramEditorApi`'s JSON-Schema
357
374
* via the `definition` "Diagram".
@@ -1111,6 +1128,8 @@ export interface NodeRegistration {
1111
1128
* be used here.
1112
1129
*/
1113
1130
default_display_text : string ;
1131
+ description ?: string | null ;
1132
+ example_configs : ConfigExample [ ] ;
1114
1133
request : string ;
1115
1134
response : string ;
1116
1135
streams : {
@@ -1125,6 +1144,8 @@ export interface NodeRegistration {
1125
1144
export interface SectionRegistration {
1126
1145
config_schema : Schema ;
1127
1146
default_display_text : string ;
1147
+ description ?: string | null ;
1148
+ example_configs : ConfigExample [ ] ;
1128
1149
metadata : SectionMetadata ;
1129
1150
[ k : string ] : unknown ;
1130
1151
}
Original file line number Diff line number Diff line change 8
8
"type" : " node" ,
9
9
"builder" : " mul" ,
10
10
"next" : " a00aa305-9763-4602-b638-6cb190e6c452" ,
11
- "config" : 10
11
+ "config" : 100 ,
12
+ "display_text" : " x100"
12
13
},
13
14
"fee7f385-2a74-4a87-b8a7-87b8bd03fdf8" : {
14
15
"type" : " node" ,
15
16
"builder" : " add" ,
16
17
"next" : {
17
18
"builtin" : " terminate"
18
- }
19
+ },
20
+ "display_text" : " sum"
19
21
},
20
22
"31fb7423-5300-447a-b259-49c5c79654e7" : {
21
23
"type" : " join" ,
29
31
"type" : " node" ,
30
32
"builder" : " mul" ,
31
33
"next" : " 305f46be-cf0d-42ac-bd28-26d63746abc3" ,
32
- "config" : 100
34
+ "config" : 10 ,
35
+ "display_text" : " x10"
33
36
},
34
37
"74764679-1f94-49f3-8080-259e57f78be9" : {
35
38
"type" : " split" ,
You can’t perform that action at this time.
0 commit comments